diff options
Diffstat (limited to 'Source')
113 files changed, 3577 insertions, 2178 deletions
diff --git a/Source/.gitattributes b/Source/.gitattributes index bd25ea8..5002b2a 100644 --- a/Source/.gitattributes +++ b/Source/.gitattributes @@ -3,3 +3,5 @@ cm_sha2.* whitespace=indent-with-non-tab # Preserve indentation style in generated code. cmListFileLexer.c whitespace=-tab-in-indent,-indent-with-non-tab +cmFortranLexer.cxx whitespace=-tab-in-indent,-indent-with-non-tab +cmFortranLexer.h whitespace=-tab-in-indent,-indent-with-non-tab diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 6c3ebf5..39773e1 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -221,10 +221,14 @@ set(SRCS cmExprLexer.cxx cmExprParser.cxx cmExprParserHelper.cxx + cmExportBuildAndroidMKGenerator.h + cmExportBuildAndroidMKGenerator.cxx cmExportBuildFileGenerator.h cmExportBuildFileGenerator.cxx cmExportFileGenerator.h cmExportFileGenerator.cxx + cmExportInstallAndroidMKGenerator.h + cmExportInstallAndroidMKGenerator.cxx cmExportInstallFileGenerator.h cmExportInstallFileGenerator.cxx cmExportTryCompileFileGenerator.h @@ -492,6 +496,8 @@ if (WIN32) cmGlobalVisualStudio12Generator.cxx cmGlobalVisualStudio14Generator.h cmGlobalVisualStudio14Generator.cxx + cmGlobalVisualStudio15Generator.h + cmGlobalVisualStudio15Generator.cxx cmGlobalVisualStudioGenerator.cxx cmGlobalVisualStudioGenerator.h cmIDEFlagTable.h diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 1b36905..0569e8e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160907) +set(CMake_VERSION_PATCH 20160915) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 4a5eb90..a6f1585 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -12,21 +12,20 @@ #include "cmCPackIFWGenerator.h" -#include <CPack/cmCPackComponentGroup.h> -#include <CPack/cmCPackLog.h> - -#include <cmsys/Directory.hxx> -#include <cmsys/Glob.hxx> -#include <cmsys/RegularExpression.hxx> -#include <cmsys/SystemTools.hxx> - -#include <cmGeneratedFileStream.h> -#include <cmGlobalGenerator.h> -#include <cmMakefile.h> -#include <cmSystemTools.h> -#include <cmTimestamp.h> -#include <cmVersionConfig.h> -#include <cmXMLWriter.h> +#include "CPack/cmCPackComponentGroup.h" +#include "CPack/cmCPackGenerator.h" +#include "CPack/cmCPackLog.h" +#include "cmCPackIFWInstaller.h" +#include "cmCPackIFWPackage.h" +#include "cmCPackIFWRepository.h" +#include "cmGeneratedFileStream.h" +#include "cmSystemTools.h" +#include "cmTimestamp.h" +#include "cmVersionConfig.h" +#include "cmXMLWriter.h" + +#include <sstream> +#include <utility> cmCPackIFWGenerator::cmCPackIFWGenerator() { diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h index 12f2ca6..17d61bf 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.h +++ b/Source/CPack/IFW/cmCPackIFWGenerator.h @@ -13,11 +13,19 @@ #ifndef cmCPackIFWGenerator_h #define cmCPackIFWGenerator_h -#include <CPack/cmCPackGenerator.h> +#include <cmConfigure.h> +#include "CPack/cmCPackComponentGroup.h" +#include "CPack/cmCPackGenerator.h" #include "cmCPackIFWInstaller.h" #include "cmCPackIFWPackage.h" #include "cmCPackIFWRepository.h" +#include "cmTypeMacro.h" + +#include <map> +#include <set> +#include <string> +#include <vector> class cmXMLWriter; diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 13a3613..5a3efc9 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -12,12 +12,16 @@ #include "cmCPackIFWInstaller.h" +#include "CPack/cmCPackGenerator.h" #include "cmCPackIFWGenerator.h" - -#include <CPack/cmCPackLog.h> - -#include <cmGeneratedFileStream.h> -#include <cmXMLWriter.h> +#include "cmCPackIFWPackage.h" +#include "cmCPackIFWRepository.h" +#include "cmGeneratedFileStream.h" +#include "cmSystemTools.h" +#include "cmXMLWriter.h" + +#include <cmConfigure.h> +#include <utility> #ifdef cmCPackLogger #undef cmCPackLogger diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h index 3170116..f72d379 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.h +++ b/Source/CPack/IFW/cmCPackIFWInstaller.h @@ -13,10 +13,14 @@ #ifndef cmCPackIFWInstaller_h #define cmCPackIFWInstaller_h -#include <cmStandardIncludes.h> +#include <cmConfigure.h> // IWYU pragma: keep + +#include <map> +#include <string> +#include <vector> -class cmCPackIFWPackage; class cmCPackIFWGenerator; +class cmCPackIFWPackage; class cmCPackIFWRepository; class cmXMLWriter; diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index 5db06e6..bc503fc 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -12,13 +12,20 @@ #include "cmCPackIFWPackage.h" +#include "CPack/cmCPackComponentGroup.h" +#include "CPack/cmCPackGenerator.h" +#include "CPack/cmCPackLog.h" #include "cmCPackIFWGenerator.h" - -#include <CPack/cmCPackLog.h> - -#include <cmGeneratedFileStream.h> -#include <cmTimestamp.h> -#include <cmXMLWriter.h> +#include "cmCPackIFWInstaller.h" +#include "cmGeneratedFileStream.h" +#include "cmSystemTools.h" +#include "cmTimestamp.h" +#include "cmXMLWriter.h" + +#include <cmConfigure.h> +#include <map> +#include <sstream> +#include <stddef.h> //----------------------------------------------------------------- Logger --- #ifdef cmCPackLogger diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h index 55b07ec..579eeb8 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.h +++ b/Source/CPack/IFW/cmCPackIFWPackage.h @@ -13,12 +13,16 @@ #ifndef cmCPackIFWPackage_h #define cmCPackIFWPackage_h -#include <cmStandardIncludes.h> +#include <cmConfigure.h> // IWYU pragma: keep + +#include <set> +#include <string> +#include <vector> class cmCPackComponent; class cmCPackComponentGroup; -class cmCPackIFWInstaller; class cmCPackIFWGenerator; +class cmCPackIFWInstaller; class cmXMLWriter; /** \class cmCPackIFWPackage diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index fcb1c77..947e420 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -12,13 +12,15 @@ #include "cmCPackIFWRepository.h" +#include "CPack/cmCPackGenerator.h" #include "cmCPackIFWGenerator.h" +#include "cmGeneratedFileStream.h" +#include "cmSystemTools.h" +#include "cmXMLParser.h" +#include "cmXMLWriter.h" -#include <CPack/cmCPackLog.h> - -#include <cmGeneratedFileStream.h> -#include <cmXMLParser.h> -#include <cmXMLWriter.h> +#include <cmConfigure.h> +#include <stddef.h> #ifdef cmCPackLogger #undef cmCPackLogger diff --git a/Source/CPack/IFW/cmCPackIFWRepository.h b/Source/CPack/IFW/cmCPackIFWRepository.h index 5ffb775..a0c535b 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.h +++ b/Source/CPack/IFW/cmCPackIFWRepository.h @@ -13,7 +13,10 @@ #ifndef cmCPackIFWRepository_h #define cmCPackIFWRepository_h -#include <cmStandardIncludes.h> +#include <cmConfigure.h> // IWYU pragma: keep + +#include <string> +#include <vector> class cmCPackIFWGenerator; class cmXMLWriter; diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index d7f69a1..ba5787e 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -35,6 +35,7 @@ cmCPackWIXGenerator::cmCPackWIXGenerator() : Patch(0) + , ComponentGuidType(cmWIXSourceWriter::WIX_GENERATED_GUID) { } @@ -234,6 +235,12 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration() } } + // if install folder is supposed to be set absolutely, the default + // component guid "*" cannot be used + if (cmSystemTools::IsOn(GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER"))) { + this->ComponentGuidType = cmWIXSourceWriter::CMAKE_GENERATED_GUID; + } + return true; } @@ -317,7 +324,9 @@ void cmCPackWIXGenerator::CreateWiXVariablesIncludeFile() { std::string includeFilename = this->CPackTopLevel + "/cpack_variables.wxi"; - cmWIXSourceWriter includeFile(this->Logger, includeFilename, true); + cmWIXSourceWriter includeFile(this->Logger, includeFilename, + this->ComponentGuidType, + cmWIXSourceWriter::INCLUDE_ELEMENT_ROOT); CopyDefinition(includeFile, "CPACK_WIX_PRODUCT_GUID"); CopyDefinition(includeFile, "CPACK_WIX_UPGRADE_GUID"); @@ -338,7 +347,9 @@ void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile() { std::string includeFilename = this->CPackTopLevel + "/properties.wxi"; - cmWIXSourceWriter includeFile(this->Logger, includeFilename, true); + cmWIXSourceWriter includeFile(this->Logger, includeFilename, + this->ComponentGuidType, + cmWIXSourceWriter::INCLUDE_ELEMENT_ROOT); std::string prefix = "CPACK_WIX_PROPERTY_"; std::vector<std::string> options = GetOptions(); @@ -386,7 +397,9 @@ void cmCPackWIXGenerator::CreateWiXProductFragmentIncludeFile() { std::string includeFilename = this->CPackTopLevel + "/product_fragment.wxi"; - cmWIXSourceWriter includeFile(this->Logger, includeFilename, true); + cmWIXSourceWriter includeFile(this->Logger, includeFilename, + this->ComponentGuidType, + cmWIXSourceWriter::INCLUDE_ELEMENT_ROOT); this->Patch->ApplyFragment("#PRODUCT", includeFile); } @@ -413,13 +426,15 @@ void cmCPackWIXGenerator::AddDefinition(cmWIXSourceWriter& source, bool cmCPackWIXGenerator::CreateWiXSourceFiles() { + // if install folder is supposed to be set absolutely, the default + // component guid "*" cannot be used std::string directoryDefinitionsFilename = this->CPackTopLevel + "/directories.wxs"; this->WixSources.push_back(directoryDefinitionsFilename); cmWIXDirectoriesSourceWriter directoryDefinitions( - this->Logger, directoryDefinitionsFilename); + this->Logger, directoryDefinitionsFilename, this->ComponentGuidType); directoryDefinitions.BeginElement("Fragment"); std::string installRoot; @@ -439,13 +454,8 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() this->WixSources.push_back(fileDefinitionsFilename); - cmWIXFilesSourceWriter fileDefinitions(this->Logger, - fileDefinitionsFilename); - - // if install folder is supposed to be set absolutely, the default - // component guid "*" cannot be used - fileDefinitions.GenerateComponentGuids = - cmSystemTools::IsOn(GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER")); + cmWIXFilesSourceWriter fileDefinitions(this->Logger, fileDefinitionsFilename, + this->ComponentGuidType); fileDefinitions.BeginElement("Fragment"); @@ -454,8 +464,8 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() this->WixSources.push_back(featureDefinitionsFilename); - cmWIXFeaturesSourceWriter featureDefinitions(this->Logger, - featureDefinitionsFilename); + cmWIXFeaturesSourceWriter featureDefinitions( + this->Logger, featureDefinitionsFilename, this->ComponentGuidType); featureDefinitions.BeginElement("Fragment"); @@ -618,7 +628,7 @@ bool cmCPackWIXGenerator::CreateFeatureHierarchy( i != ComponentGroups.end(); ++i) { cmCPackComponentGroup const& group = i->second; if (group.ParentGroup == 0) { - featureDefinitions.EmitFeatureForComponentGroup(group); + featureDefinitions.EmitFeatureForComponentGroup(group, *this->Patch); } } @@ -628,7 +638,7 @@ bool cmCPackWIXGenerator::CreateFeatureHierarchy( cmCPackComponent const& component = i->second; if (!component.Group) { - featureDefinitions.EmitFeatureForComponent(component); + featureDefinitions.EmitFeatureForComponent(component, *this->Patch); } } @@ -764,7 +774,8 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType( fileDefinitions.BeginElement("Component"); fileDefinitions.AddAttribute("Id", componentId); - fileDefinitions.AddAttribute("Guid", "*"); + fileDefinitions.AddAttribute( + "Guid", fileDefinitions.CreateGuidFromComponentId(componentId)); this->Patch->ApplyFragment(componentId, fileDefinitions); diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h index 9d3a522..883df9a 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.h +++ b/Source/CPack/WiX/cmCPackWIXGenerator.h @@ -162,6 +162,8 @@ private: std::string CPackTopLevel; cmWIXPatch* Patch; + + cmWIXSourceWriter::GuidType ComponentGuidType; }; #endif diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx index 97e3a51..9704195 100644 --- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx @@ -13,8 +13,8 @@ #include "cmWIXDirectoriesSourceWriter.h" cmWIXDirectoriesSourceWriter::cmWIXDirectoriesSourceWriter( - cmCPackLog* logger, std::string const& filename) - : cmWIXSourceWriter(logger, filename) + cmCPackLog* logger, std::string const& filename, GuidType componentGuidType) + : cmWIXSourceWriter(logger, filename, componentGuidType) { } diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h index 023f4b8..6ebe281 100644 --- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h @@ -25,8 +25,8 @@ class cmWIXDirectoriesSourceWriter : public cmWIXSourceWriter { public: - cmWIXDirectoriesSourceWriter(cmCPackLog* logger, - std::string const& filename); + cmWIXDirectoriesSourceWriter(cmCPackLog* logger, std::string const& filename, + GuidType componentGuidType); void EmitStartMenuFolder(std::string const& startMenuFolder); diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx index 1747b62..c9f17cc 100644 --- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx @@ -13,8 +13,8 @@ #include "cmWIXFeaturesSourceWriter.h" cmWIXFeaturesSourceWriter::cmWIXFeaturesSourceWriter( - cmCPackLog* logger, std::string const& filename) - : cmWIXSourceWriter(logger, filename) + cmCPackLog* logger, std::string const& filename, GuidType componentGuidType) + : cmWIXSourceWriter(logger, filename, componentGuidType) { } @@ -24,7 +24,7 @@ void cmWIXFeaturesSourceWriter::CreateCMakePackageRegistryEntry( BeginElement("Component"); AddAttribute("Id", "CM_PACKAGE_REGISTRY"); AddAttribute("Directory", "TARGETDIR"); - AddAttribute("Guid", "*"); + AddAttribute("Guid", CreateGuidFromComponentId("CM_PACKAGE_REGISTRY")); std::string registryKey = std::string("Software\\Kitware\\CMake\\Packages\\") + package; @@ -42,7 +42,7 @@ void cmWIXFeaturesSourceWriter::CreateCMakePackageRegistryEntry( } void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup( - cmCPackComponentGroup const& group) + cmCPackComponentGroup const& group, cmWIXPatch& patch) { BeginElement("Feature"); AddAttribute("Id", "CM_G_" + group.Name); @@ -57,20 +57,22 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup( for (std::vector<cmCPackComponentGroup*>::const_iterator i = group.Subgroups.begin(); i != group.Subgroups.end(); ++i) { - EmitFeatureForComponentGroup(**i); + EmitFeatureForComponentGroup(**i, patch); } for (std::vector<cmCPackComponent*>::const_iterator i = group.Components.begin(); i != group.Components.end(); ++i) { - EmitFeatureForComponent(**i); + EmitFeatureForComponent(**i, patch); } + patch.ApplyFragment("CM_G_" + group.Name, *this); + EndElement("Feature"); } void cmWIXFeaturesSourceWriter::EmitFeatureForComponent( - cmCPackComponent const& component) + cmCPackComponent const& component, cmWIXPatch& patch) { BeginElement("Feature"); AddAttribute("Id", "CM_C_" + component.Name); @@ -90,6 +92,8 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponent( AddAttribute("Level", "2"); } + patch.ApplyFragment("CM_C_" + component.Name, *this); + EndElement("Feature"); } diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h index ee9c17a..124ed42 100644 --- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h @@ -13,6 +13,7 @@ #ifndef cmWIXFeaturesSourceWriter_h #define cmWIXFeaturesSourceWriter_h +#include "cmWIXPatch.h" #include "cmWIXSourceWriter.h" #include <CPack/cmCPackGenerator.h> @@ -23,14 +24,17 @@ class cmWIXFeaturesSourceWriter : public cmWIXSourceWriter { public: - cmWIXFeaturesSourceWriter(cmCPackLog* logger, std::string const& filename); + cmWIXFeaturesSourceWriter(cmCPackLog* logger, std::string const& filename, + GuidType componentGuidType); void CreateCMakePackageRegistryEntry(std::string const& package, std::string const& upgradeGuid); - void EmitFeatureForComponentGroup(const cmCPackComponentGroup& group); + void EmitFeatureForComponentGroup(const cmCPackComponentGroup& group, + cmWIXPatch& patch); - void EmitFeatureForComponent(const cmCPackComponent& component); + void EmitFeatureForComponent(const cmCPackComponent& component, + cmWIXPatch& patch); void EmitComponentRef(std::string const& id); }; diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx index dde9635..846edde 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx @@ -24,9 +24,9 @@ #include <sys/stat.h> cmWIXFilesSourceWriter::cmWIXFilesSourceWriter(cmCPackLog* logger, - std::string const& filename) - : cmWIXSourceWriter(logger, filename) - , GenerateComponentGuids(false) + std::string const& filename, + GuidType componentGuidType) + : cmWIXSourceWriter(logger, filename, componentGuidType) { } @@ -130,13 +130,7 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile( std::string componentId = std::string("CM_C") + id; std::string fileId = std::string("CM_F") + id; - std::string guid = "*"; - if (this->GenerateComponentGuids) { - std::string md5 = cmSystemTools::ComputeStringMD5(componentId); - cmUuid uuid; - std::vector<unsigned char> ns; - guid = uuid.FromMd5(ns, md5); - } + std::string guid = CreateGuidFromComponentId(componentId); BeginElement("DirectoryRef"); AddAttribute("Id", directoryId); diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h index eeb84cb..c1952af 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h @@ -26,7 +26,8 @@ class cmWIXFilesSourceWriter : public cmWIXSourceWriter { public: - cmWIXFilesSourceWriter(cmCPackLog* logger, std::string const& filename); + cmWIXFilesSourceWriter(cmCPackLog* logger, std::string const& filename, + GuidType componentGuidType); void EmitShortcut(std::string const& id, cmWIXShortcut const& shortcut, std::string const& shortcutPrefix, size_t shortcutIndex); @@ -47,8 +48,6 @@ public: std::string const& id, std::string const& filePath, cmWIXPatch& patch, cmInstalledFile const* installedFile); - - bool GenerateComponentGuids; }; #endif diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx index 2c0384e..a287424 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx @@ -14,19 +14,23 @@ #include <CPack/cmCPackGenerator.h> +#include <cmUuid.h> + #include <windows.h> cmWIXSourceWriter::cmWIXSourceWriter(cmCPackLog* logger, std::string const& filename, - bool isIncludeFile) + GuidType componentGuidType, + RootElementType rootElementType) : Logger(logger) , File(filename.c_str()) , State(DEFAULT) , SourceFilename(filename) + , ComponentGuidType(componentGuidType) { WriteXMLDeclaration(); - if (isIncludeFile) { + if (rootElementType == INCLUDE_ELEMENT_ROOT) { BeginElement("Include"); } else { BeginElement("Wix"); @@ -173,6 +177,19 @@ std::string cmWIXSourceWriter::CMakeEncodingToUtf8(std::string const& value) #endif } +std::string cmWIXSourceWriter::CreateGuidFromComponentId( + std::string const& componentId) +{ + std::string guid = "*"; + if (this->ComponentGuidType == CMAKE_GENERATED_GUID) { + std::string md5 = cmSystemTools::ComputeStringMD5(componentId); + cmUuid uuid; + std::vector<unsigned char> ns; + guid = uuid.FromMd5(ns, md5); + } + return guid; +} + void cmWIXSourceWriter::WriteXMLDeclaration() { File << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl; diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h index 4efc026..c29ffa7 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.h +++ b/Source/CPack/WiX/cmWIXSourceWriter.h @@ -26,8 +26,21 @@ class cmWIXSourceWriter { public: + enum GuidType + { + WIX_GENERATED_GUID, + CMAKE_GENERATED_GUID + }; + + enum RootElementType + { + WIX_ELEMENT_ROOT, + INCLUDE_ELEMENT_ROOT + }; + cmWIXSourceWriter(cmCPackLog* logger, std::string const& filename, - bool isIncludeFile = false); + GuidType componentGuidType, + RootElementType rootElementType = WIX_ELEMENT_ROOT); ~cmWIXSourceWriter(); @@ -45,6 +58,8 @@ public: void AddAttributeUnlessEmpty(std::string const& key, std::string const& value); + std::string CreateGuidFromComponentId(std::string const& componentId); + static std::string CMakeEncodingToUtf8(std::string const& value); protected: @@ -70,6 +85,8 @@ private: std::vector<std::string> Elements; std::string SourceFilename; + + GuidType ComponentGuidType; }; #endif diff --git a/Source/CPack/cmCPack7zGenerator.cxx b/Source/CPack/cmCPack7zGenerator.cxx index b01c216..39d2e54 100644 --- a/Source/CPack/cmCPack7zGenerator.cxx +++ b/Source/CPack/cmCPack7zGenerator.cxx @@ -12,6 +12,9 @@ #include "cmCPack7zGenerator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPack7zGenerator::cmCPack7zGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, "7zip") { diff --git a/Source/CPack/cmCPack7zGenerator.h b/Source/CPack/cmCPack7zGenerator.h index ddbcc34..94add69 100644 --- a/Source/CPack/cmCPack7zGenerator.h +++ b/Source/CPack/cmCPack7zGenerator.h @@ -13,7 +13,11 @@ #ifndef cmCPack7zGenerator_h #define cmCPack7zGenerator_h +#include <cmConfigure.h> + #include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPack7zGenerator * \brief A generator for 7z files diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 377fee1..ddf2ccb 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -12,17 +12,16 @@ #include "cmCPackArchiveGenerator.h" +#include "cmCPackComponentGroup.h" +#include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmGeneratedFileStream.h" -#include "cmGlobalGenerator.h" -#include "cmMakefile.h" #include "cmSystemTools.h" -#include "cmake.h" -#include <errno.h> -#include <cm_libarchive.h> -#include <cmsys/Directory.hxx> -#include <cmsys/SystemTools.hxx> +#include <map> +#include <ostream> +#include <utility> +#include <vector> cmCPackArchiveGenerator::cmCPackArchiveGenerator(cmArchiveWrite::Compress t, std::string const& format) diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h index a018ebd..6db6fb0 100644 --- a/Source/CPack/cmCPackArchiveGenerator.h +++ b/Source/CPack/cmCPackArchiveGenerator.h @@ -13,9 +13,16 @@ #ifndef cmCPackArchiveGenerator_h #define cmCPackArchiveGenerator_h -#include "cmCPackGenerator.h" +#include <cmConfigure.h> #include "cmArchiveWrite.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" + +#include <iosfwd> +#include <string> + +class cmCPackComponent; /** \class cmCPackArchiveGenerator * \brief A generator base for libarchive generation. diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h index 78b81b3..8e9218e 100644 --- a/Source/CPack/cmCPackComponentGroup.h +++ b/Source/CPack/cmCPackComponentGroup.h @@ -15,7 +15,8 @@ #include <cmConfigure.h> -#include "cmStandardIncludes.h" +#include <string> +#include <vector> class cmCPackComponentGroup; diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index b909598..2e18265 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -13,16 +13,21 @@ #include "cmCPackDebGenerator.h" #include "cmArchiveWrite.h" +#include "cmCPackComponentGroup.h" +#include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmGeneratedFileStream.h" -#include "cmMakefile.h" #include "cmSystemTools.h" #include <cmsys/Glob.hxx> -#include <cmsys/SystemTools.hxx> - -#include <limits.h> // USHRT_MAX +#include <limits.h> +#include <map> +#include <ostream> +#include <set> +#include <stdio.h> +#include <string.h> #include <sys/stat.h> +#include <utility> // NOTE: // A debian package .deb is simply an 'ar' archive. The only subtle difference @@ -743,14 +748,6 @@ std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix( * SUCH DAMAGE. */ -#include <sys/types.h> -// include sys/stat.h after sys/types.h -#include <sys/stat.h> - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - #define ARMAG "!<arch>\n" /* ar "magic number" */ #define SARMAG 8 /* strlen(ARMAG); */ diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h index bcdc509..c76bf99 100644 --- a/Source/CPack/cmCPackDebGenerator.h +++ b/Source/CPack/cmCPackDebGenerator.h @@ -13,7 +13,13 @@ #ifndef cmCPackDebGenerator_h #define cmCPackDebGenerator_h +#include <cmConfigure.h> + #include "cmCPackGenerator.h" +#include "cmTypeMacro.h" + +#include <string> +#include <vector> /** \class cmCPackDebGenerator * \brief A generator for Debian packages diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 96c218c..d6b58f2 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -17,14 +17,17 @@ #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmXMLSafe.h" +#include "cm_auto_ptr.hxx" #include "cmake.h" #include <algorithm> #include <cmsys/FStream.hxx> #include <cmsys/Glob.hxx> -#include <cmsys/SystemTools.hxx> +#include <cmsys/RegularExpression.hxx> #include <list> +#include <utility> #if defined(__HAIKU__) #include <FindDirectory.h> diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 23e4bb7..f89f349 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -13,15 +13,21 @@ #ifndef cmCPackGenerator_h #define cmCPackGenerator_h -#include "cmObject.h" +#include <cmConfigure.h> +#include "cmCPackComponentGroup.h" +#include "cmObject.h" #include "cmSystemTools.h" +#include "cmTypeMacro.h" + #include <map> +#include <sstream> +#include <string> #include <vector> -#include "cmCPackComponentGroup.h" // cmCPackComponent and friends -// Forward declarations are insufficient since we use them in -// std::map data members below... +class cmCPackLog; +class cmInstalledFile; +class cmMakefile; #define cmCPackTypeMacro(klass, superclass) \ cmTypeMacro(klass, superclass); \ @@ -46,10 +52,6 @@ #endif #define cout no_cout_use_cmCPack_Log -class cmMakefile; -class cmCPackLog; -class cmInstalledFile; - /** \class cmCPackGenerator * \brief A superclass of all CPack Generators * diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index 0f0268f..fb84739 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -49,6 +49,9 @@ #include "cmAlgorithms.h" #include "cmCPackLog.h" +#include <ostream> +#include <utility> + cmCPackGeneratorFactory::cmCPackGeneratorFactory() { if (cmCPackTGZGenerator::CanGenerate()) { diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h index f0ed57a..4c07ea3 100644 --- a/Source/CPack/cmCPackGeneratorFactory.h +++ b/Source/CPack/cmCPackGeneratorFactory.h @@ -13,10 +13,17 @@ #ifndef cmCPackGeneratorFactory_h #define cmCPackGeneratorFactory_h +#include <cmConfigure.h> + #include "cmObject.h" +#include "cmTypeMacro.h" + +#include <map> +#include <string> +#include <vector> -class cmCPackLog; class cmCPackGenerator; +class cmCPackLog; /** \class cmCPackGeneratorFactory * \brief A container for CPack generators diff --git a/Source/CPack/cmCPackLog.cxx b/Source/CPack/cmCPackLog.cxx index 339323e..8439de1 100644 --- a/Source/CPack/cmCPackLog.cxx +++ b/Source/CPack/cmCPackLog.cxx @@ -15,6 +15,8 @@ #include "cmGeneratedFileStream.h" #include "cmSystemTools.h" +#include <iostream> + cmCPackLog::cmCPackLog() { this->Verbose = false; diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h index 77f0f0b..c1bf82c 100644 --- a/Source/CPack/cmCPackLog.h +++ b/Source/CPack/cmCPackLog.h @@ -13,7 +13,14 @@ #ifndef cmCPackLog_h #define cmCPackLog_h +#include <cmConfigure.h> + #include "cmObject.h" +#include "cmTypeMacro.h" + +#include <ostream> +#include <string.h> +#include <string> #define cmCPack_Log(ctSelf, logType, msg) \ do { \ diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index d8ff907..2db94f1 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -13,16 +13,19 @@ #include "cmCPackNSISGenerator.h" #include "cmCPackComponentGroup.h" +#include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmGeneratedFileStream.h" -#include "cmGlobalGenerator.h" -#include "cmMakefile.h" #include "cmSystemTools.h" +#include <algorithm> #include <cmsys/Directory.hxx> -#include <cmsys/Glob.hxx> #include <cmsys/RegularExpression.hxx> -#include <cmsys/SystemTools.hxx> +#include <map> +#include <sstream> +#include <stdlib.h> +#include <string.h> +#include <utility> /* NSIS uses different command line syntax on Windows and others */ #ifdef _WIN32 diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h index 4923cf0..ae03e6b 100644 --- a/Source/CPack/cmCPackNSISGenerator.h +++ b/Source/CPack/cmCPackNSISGenerator.h @@ -13,9 +13,18 @@ #ifndef cmCPackNSISGenerator_h #define cmCPackNSISGenerator_h +#include <cmConfigure.h> + #include "cmCPackGenerator.h" +#include "cmTypeMacro.h" +#include <iosfwd> #include <set> +#include <string> +#include <vector> + +class cmCPackComponent; +class cmCPackComponentGroup; /** \class cmCPackNSISGenerator * \brief A generator for NSIS files diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index 5d81a49..0f2e9b9 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -11,9 +11,17 @@ ============================================================================*/ #include "cmCPackRPMGenerator.h" +#include "cmCPackComponentGroup.h" +#include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmSystemTools.h" +#include <algorithm> +#include <map> +#include <ostream> +#include <utility> +#include <vector> + cmCPackRPMGenerator::cmCPackRPMGenerator() { } diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h index 4baef08..10c5572 100644 --- a/Source/CPack/cmCPackRPMGenerator.h +++ b/Source/CPack/cmCPackRPMGenerator.h @@ -13,7 +13,12 @@ #ifndef cmCPackRPMGenerator_h #define cmCPackRPMGenerator_h +#include <cmConfigure.h> + #include "cmCPackGenerator.h" +#include "cmTypeMacro.h" + +#include <string> /** \class cmCPackRPMGenerator * \brief A generator for RPM packages diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx index 4d07a7e..4c33a08 100644 --- a/Source/CPack/cmCPackSTGZGenerator.cxx +++ b/Source/CPack/cmCPackSTGZGenerator.cxx @@ -12,13 +12,15 @@ #include "cmCPackSTGZGenerator.h" +#include "cmCPackGenerator.h" #include "cmCPackLog.h" -#include "cmGlobalGenerator.h" -#include "cmMakefile.h" #include "cmSystemTools.h" -#include "cmake.h" #include <cmsys/FStream.hxx> +#include <sstream> +#include <stdio.h> +#include <string> +#include <vector> #include <sys/types.h> // include sys/stat.h after sys/types.h diff --git a/Source/CPack/cmCPackSTGZGenerator.h b/Source/CPack/cmCPackSTGZGenerator.h index 94cc8aa..2a68f2c 100644 --- a/Source/CPack/cmCPackSTGZGenerator.h +++ b/Source/CPack/cmCPackSTGZGenerator.h @@ -13,7 +13,13 @@ #ifndef cmCPackSTGZGenerator_h #define cmCPackSTGZGenerator_h +#include <cmConfigure.h> + +#include "cmCPackGenerator.h" #include "cmCPackTGZGenerator.h" +#include "cmTypeMacro.h" + +#include <iosfwd> /** \class cmCPackSTGZGenerator * \brief A generator for Self extractable TGZ files diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx index 7c5c245..8df53a8 100644 --- a/Source/CPack/cmCPackTGZGenerator.cxx +++ b/Source/CPack/cmCPackTGZGenerator.cxx @@ -12,6 +12,9 @@ #include "cmCPackTGZGenerator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPackTGZGenerator::cmCPackTGZGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressGZip, "paxr") { diff --git a/Source/CPack/cmCPackTGZGenerator.h b/Source/CPack/cmCPackTGZGenerator.h index cb7620c..78cd109 100644 --- a/Source/CPack/cmCPackTGZGenerator.h +++ b/Source/CPack/cmCPackTGZGenerator.h @@ -13,7 +13,11 @@ #ifndef cmCPackTGZGenerator_h #define cmCPackTGZGenerator_h +#include <cmConfigure.h> + #include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPackTGZGenerator * \brief A generator for TGZ files diff --git a/Source/CPack/cmCPackTXZGenerator.cxx b/Source/CPack/cmCPackTXZGenerator.cxx index d17a164..c708022 100644 --- a/Source/CPack/cmCPackTXZGenerator.cxx +++ b/Source/CPack/cmCPackTXZGenerator.cxx @@ -12,6 +12,9 @@ #include "cmCPackTXZGenerator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPackTXZGenerator::cmCPackTXZGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ, "paxr") { diff --git a/Source/CPack/cmCPackTXZGenerator.h b/Source/CPack/cmCPackTXZGenerator.h index 87c92ef..6d6db74 100644 --- a/Source/CPack/cmCPackTXZGenerator.h +++ b/Source/CPack/cmCPackTXZGenerator.h @@ -13,7 +13,11 @@ #ifndef cmCPackTXZGenerator_h #define cmCPackTXZGenerator_h +#include <cmConfigure.h> + #include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPackTXZGenerator * \brief A generator for TXZ files diff --git a/Source/CPack/cmCPackTarBZip2Generator.cxx b/Source/CPack/cmCPackTarBZip2Generator.cxx index 694d392..09bda8c 100644 --- a/Source/CPack/cmCPackTarBZip2Generator.cxx +++ b/Source/CPack/cmCPackTarBZip2Generator.cxx @@ -12,6 +12,9 @@ #include "cmCPackTarBZip2Generator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPackTarBZip2Generator::cmCPackTarBZip2Generator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressBZip2, "paxr") { diff --git a/Source/CPack/cmCPackTarBZip2Generator.h b/Source/CPack/cmCPackTarBZip2Generator.h index 6fec882..d7b7277 100644 --- a/Source/CPack/cmCPackTarBZip2Generator.h +++ b/Source/CPack/cmCPackTarBZip2Generator.h @@ -13,7 +13,11 @@ #ifndef cmCPackTarBZip2Generator_h #define cmCPackTarBZip2Generator_h +#include <cmConfigure.h> + #include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPackTarBZip2Generator * \brief A generator for TarBZip2 files diff --git a/Source/CPack/cmCPackTarCompressGenerator.cxx b/Source/CPack/cmCPackTarCompressGenerator.cxx index aec6893..a2b0b66 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.cxx +++ b/Source/CPack/cmCPackTarCompressGenerator.cxx @@ -12,6 +12,9 @@ #include "cmCPackTarCompressGenerator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPackTarCompressGenerator::cmCPackTarCompressGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressCompress, "paxr") { diff --git a/Source/CPack/cmCPackTarCompressGenerator.h b/Source/CPack/cmCPackTarCompressGenerator.h index 02926a2..9213d81 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.h +++ b/Source/CPack/cmCPackTarCompressGenerator.h @@ -13,7 +13,11 @@ #ifndef cmCPackTarCompressGenerator_h #define cmCPackTarCompressGenerator_h -#include "cmCPackTGZGenerator.h" +#include <cmConfigure.h> + +#include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPackTarCompressGenerator * \brief A generator for TarCompress files diff --git a/Source/CPack/cmCPackZIPGenerator.cxx b/Source/CPack/cmCPackZIPGenerator.cxx index 9b42e6d..f2a2547 100644 --- a/Source/CPack/cmCPackZIPGenerator.cxx +++ b/Source/CPack/cmCPackZIPGenerator.cxx @@ -12,6 +12,9 @@ #include "cmCPackZIPGenerator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPackZIPGenerator::cmCPackZIPGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, "zip") { diff --git a/Source/CPack/cmCPackZIPGenerator.h b/Source/CPack/cmCPackZIPGenerator.h index 1130826..fdb10a9 100644 --- a/Source/CPack/cmCPackZIPGenerator.h +++ b/Source/CPack/cmCPackZIPGenerator.h @@ -13,7 +13,11 @@ #ifndef cmCPackZIPGenerator_h #define cmCPackZIPGenerator_h +#include <cmConfigure.h> + #include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPackZIPGenerator * \brief A generator for ZIP files diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index de572c0..be524b3 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -9,22 +9,30 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#include "cmSystemTools.h" +#include <cmConfigure.h> -// Need these for documentation support. #include "cmCPackGenerator.h" #include "cmCPackGeneratorFactory.h" +#include "cmCPackLog.h" #include "cmDocumentation.h" +#include "cmDocumentationEntry.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmState.h" +#include "cmSystemTools.h" +#include "cmTypeMacro.h" +#include "cm_auto_ptr.hxx" #include "cmake.h" -#include "cmake.h" - -#include "cmCPackLog.h" #include <cmsys/CommandLineArguments.hxx> #include <cmsys/Encoding.hxx> -#include <cmsys/SystemTools.hxx> +#include <iostream> +#include <map> +#include <sstream> +#include <stddef.h> +#include <string> +#include <utility> +#include <vector> static const char* cmDocumentationName[][2] = { { CM_NULLPTR, " cpack - Packaging driver provided by CMake." }, diff --git a/Source/CPack/cygwin.readme b/Source/CPack/cygwin.readme deleted file mode 100644 index c0cd4b9..0000000 --- a/Source/CPack/cygwin.readme +++ /dev/null @@ -1,69 +0,0 @@ -http://cygwin.com/setup.html - - -Need to produce two tar files: - -Source- - -- create subdirs -- copy src -- duplicate src -- configure files into duplicate src - CPack.cygwin-readme.in - CPack.cygwin-install.sh.in - CPack.setup.hint.in -- diff duplicate src and orig src -- write diff into toplevel -- create tar file call super class - -cmake-2.2.3-1 - - -1. a source release -cmake-2.2.3-2-src.tar.bz2 - -cmake-2.2.3-2.patch has cmake-2.2.3/CYGWIN-PATCHES/cmake.README cmake-2.2.3/CYGWIN-PATCHES/setup.hint -cmake-2.2.3-2.sh -> script to create cygwin release -cmake-2.2.3.tar.bz2 -> unmodified cmake sources for 2.2.3 - - - - - -2 a binary release -cmake-2.2.3-2.tar.bz2 - -normal binary release with use as the root of the tree: - -Here is the bootstrap command used: - - ${SOURCE_DIR}/bootstrap --prefix=/usr --datadir=/share/cmake-${VER} \ - --docdir=/share/doc/cmake-${VER} --mandir=/share/man - -CMAKE_DOC_DIR /share/doc/${PKG}-${VER} -CMAKE_MAN_DIR /share/man -CMAKE_DATA_DIR /share/${PKG}-${VER} - -Here is the directory stucture: - -usr/bin/cmake.exe -usr/share/doc/cmake-2.2.3/MANIFEST *** -usr/share/doc/Cygwin/cmake-2.2.3-2.README **** -usr/share/cmake-2.2.3/Modules - - - -usr/bin -usr/share/cmake-2.2.3/include -usr/share/cmake-2.2.3/Modules/Platform -usr/share/cmake-2.2.3/Modules -usr/share/cmake-2.2.3/Templates -usr/share/cmake-2.2.3 -usr/share/doc/cmake-2.2.3 -usr/share/doc/Cygwin -usr/share/doc -usr/share/man/man1 -usr/share/man -usr/share -usr - diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index f680612..0832820 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -108,13 +108,8 @@ std::string cmCTestSVN::LoadInfo(SVNInfo& svninfo) void cmCTestSVN::NoteOldRevision() { - // Info for root repository - this->Repositories.push_back(SVNInfo("")); - this->RootInfo = &(this->Repositories.back()); - // Info for the external repositories - this->LoadExternals(); + this->LoadRepositories(); - // Get info for all the repositories std::list<SVNInfo>::iterator itbeg = this->Repositories.begin(); std::list<SVNInfo>::iterator itend = this->Repositories.end(); for (; itbeg != itend; itbeg++) { @@ -134,7 +129,8 @@ void cmCTestSVN::NoteOldRevision() void cmCTestSVN::NoteNewRevision() { - // Get info for the external repositories + this->LoadRepositories(); + std::list<SVNInfo>::iterator itbeg = this->Repositories.begin(); std::list<SVNInfo>::iterator itend = this->Repositories.end(); for (; itbeg != itend; itbeg++) { @@ -534,8 +530,13 @@ private: } }; -void cmCTestSVN::LoadExternals() +void cmCTestSVN::LoadRepositories() { + // Info for root repository + this->Repositories.clear(); + this->Repositories.push_back(SVNInfo("")); + this->RootInfo = &(this->Repositories.back()); + // Run "svn status" to get the list of external repositories std::vector<const char*> svn_status; svn_status.push_back("status"); diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h index 6f2374d..2301b10 100644 --- a/Source/CTest/cmCTestSVN.h +++ b/Source/CTest/cmCTestSVN.h @@ -86,7 +86,7 @@ private: SVNInfo* RootInfo; std::string LoadInfo(SVNInfo& svninfo); - void LoadExternals(); + void LoadRepositories(); void LoadModifications() CM_OVERRIDE; void LoadRevisions() CM_OVERRIDE; void LoadRevisions(SVNInfo& svninfo); diff --git a/Source/CursesDialog/cmCursesStandardIncludes.h b/Source/CursesDialog/cmCursesStandardIncludes.h index 4929958..1d8d7c6 100644 --- a/Source/CursesDialog/cmCursesStandardIncludes.h +++ b/Source/CursesDialog/cmCursesStandardIncludes.h @@ -14,10 +14,6 @@ #include <cmConfigure.h> -#if defined(__sun__) && defined(__GNUC__) -#define _MSE_INT_H -#endif - #if defined(__hpux) #define _BOOL_DEFINED #include <sys/time.h> diff --git a/Source/CursesDialog/form/form.h b/Source/CursesDialog/form/form.h index 1219cb5..b65a3ca 100644 --- a/Source/CursesDialog/form/form.h +++ b/Source/CursesDialog/form/form.h @@ -33,10 +33,6 @@ #ifndef FORM_H #define FORM_H -#if defined(__sun__) && defined(__GNUC__) - #define _MSE_INT_H -#endif - #include <cmFormConfigure.h> /* figure out which curses.h to include */ diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 5b84597..14ce3f7 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -14,6 +14,7 @@ #include <QCloseEvent> #include <QCoreApplication> +#include <QDesktopServices> #include <QDialogButtonBox> #include <QDragEnterEvent> #include <QFileDialog> @@ -227,6 +228,8 @@ void CMakeSetupDialog::initialize() QObject::connect(this->GenerateButton, SIGNAL(clicked(bool)), this, SLOT(doGenerate())); + QObject::connect(this->OpenProjectButton, SIGNAL(clicked(bool)), this, + SLOT(doOpenProject())); QObject::connect(this->BrowseSourceDirectoryButton, SIGNAL(clicked(bool)), this, SLOT(doSourceBrowse())); @@ -499,6 +502,26 @@ void CMakeSetupDialog::doGenerate() this->ConfigureNeeded = true; } +QString CMakeSetupDialog::getProjectFilename() +{ + QStringList nameFilter; + nameFilter << "*.sln" + << "*.xcodeproj"; + QDir directory(this->BinaryDirectory->currentText()); + QStringList nlnFile = directory.entryList(nameFilter); + + if (nlnFile.count() == 1) { + return this->BinaryDirectory->currentText() + "/" + nlnFile.at(0); + } + + return QString(); +} + +void CMakeSetupDialog::doOpenProject() +{ + QDesktopServices::openUrl(QUrl::fromLocalFile(this->getProjectFilename())); +} + void CMakeSetupDialog::closeEvent(QCloseEvent* e) { // prompt for close if there are unsaved changes, and we're not busy @@ -617,6 +640,11 @@ void CMakeSetupDialog::updateBinaryDirectory(const QString& dir) this->BinaryDirectory->setEditText(dir); this->BinaryDirectory->blockSignals(false); } + if (!this->getProjectFilename().isEmpty()) { + this->OpenProjectButton->setEnabled(true); + } else { + this->OpenProjectButton->setEnabled(false); + } } void CMakeSetupDialog::doBinaryBrowse() @@ -1002,22 +1030,28 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s) if (s == Interrupting) { this->ConfigureButton->setEnabled(false); this->GenerateButton->setEnabled(false); + this->OpenProjectButton->setEnabled(false); } else if (s == Configuring) { this->setEnabledState(false); this->GenerateButton->setEnabled(false); this->GenerateAction->setEnabled(false); + this->OpenProjectButton->setEnabled(false); this->ConfigureButton->setText(tr("&Stop")); } else if (s == Generating) { this->CacheModified = false; this->setEnabledState(false); this->ConfigureButton->setEnabled(false); this->GenerateAction->setEnabled(false); + this->OpenProjectButton->setEnabled(false); this->GenerateButton->setText(tr("&Stop")); } else if (s == ReadyConfigure) { this->setEnabledState(true); this->GenerateButton->setEnabled(true); this->GenerateAction->setEnabled(true); this->ConfigureButton->setEnabled(true); + if (!this->getProjectFilename().isEmpty()) { + this->OpenProjectButton->setEnabled(true); + } this->ConfigureButton->setText(tr("&Configure")); this->GenerateButton->setText(tr("&Generate")); } else if (s == ReadyGenerate) { @@ -1025,6 +1059,9 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s) this->GenerateButton->setEnabled(true); this->GenerateAction->setEnabled(true); this->ConfigureButton->setEnabled(true); + if (!this->getProjectFilename().isEmpty()) { + this->OpenProjectButton->setEnabled(true); + } this->ConfigureButton->setText(tr("&Configure")); this->GenerateButton->setText(tr("&Generate")); } diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h index 2a4ea7a..992de01 100644 --- a/Source/QtDialog/CMakeSetupDialog.h +++ b/Source/QtDialog/CMakeSetupDialog.h @@ -41,6 +41,8 @@ protected slots: void initialize(); void doConfigure(); void doGenerate(); + QString getProjectFilename(); + void doOpenProject(); void doInstallForCommandLine(); void doHelp(); void doAbout(); diff --git a/Source/QtDialog/CMakeSetupDialog.ui b/Source/QtDialog/CMakeSetupDialog.ui index b04bd93..8d8e0cd 100644 --- a/Source/QtDialog/CMakeSetupDialog.ui +++ b/Source/QtDialog/CMakeSetupDialog.ui @@ -238,6 +238,13 @@ </property> </widget> </item> + <item> + <widget class="QPushButton" name="OpenProjectButton"> + <property name="text"> + <string>Open &Project</string> + </property> + </widget> + </item> <item> <widget class="QLabel" name="Generator"> <property name="text"> diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index 88ea049..ed11f7b 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -95,10 +95,7 @@ protected: // if there are no children if (!m->hasChildren(idx)) { bool adv = m->data(idx, QCMakeCacheModel::AdvancedRole).toBool(); - if (!adv || (adv && this->ShowAdvanced)) { - return true; - } - return false; + return !adv || this->ShowAdvanced; } // check children @@ -554,14 +551,16 @@ QWidget* QCMakeCacheModelDelegate::createEditor( QObject::connect(editor, SIGNAL(fileDialogExists(bool)), this, SLOT(setFileDialogFlag(bool))); return editor; - } else if (type == QCMakeProperty::FILEPATH) { + } + if (type == QCMakeProperty::FILEPATH) { QCMakeFilePathEditor* editor = new QCMakeFilePathEditor(p, var.data(Qt::DisplayRole).toString()); QObject::connect(editor, SIGNAL(fileDialogExists(bool)), this, SLOT(setFileDialogFlag(bool))); return editor; - } else if (type == QCMakeProperty::STRING && - var.data(QCMakeCacheModel::StringsRole).isValid()) { + } + if (type == QCMakeProperty::STRING && + var.data(QCMakeCacheModel::StringsRole).isValid()) { QCMakeComboBox* editor = new QCMakeComboBox( p, var.data(QCMakeCacheModel::StringsRole).toStringList()); editor->setFrame(false); diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 1eece98..eb4c1ec 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -130,6 +130,12 @@ bool cmDependsFortran::WriteDependencies(const std::set<std::string>& sources, if (cmFortran_yyparse(parser.Scanner) != 0) { // Failed to parse the file. Report failure to write dependencies. okay = false; + /* clang-format off */ + std::cerr << + "warning: failed to parse dependencies from Fortran source " + "'" << src << "': " << parser.Error << std::endl + ; + /* clang-format on */ } } return okay; @@ -706,10 +712,5 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, // Compare the remaining content. If no compiler id matched above, // including the case none was given, this will compare the whole // content. - if (!cmFortranStreamsDiffer(finModFile, finStampFile)) { - return false; - } - - // The modules are different. - return true; + return cmFortranStreamsDiffer(finModFile, finStampFile); } diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h index 14e1454..7302837 100644 --- a/Source/cmExecutionStatus.h +++ b/Source/cmExecutionStatus.h @@ -40,12 +40,16 @@ public: this->ReturnInvoked = false; this->BreakInvoked = false; this->ContinueInvoked = false; + this->NestedError = false; } + void SetNestedError(bool val) { this->NestedError = val; } + bool GetNestedError() { return this->NestedError; } private: bool ReturnInvoked; bool BreakInvoked; bool ContinueInvoked; + bool NestedError; }; #endif diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx new file mode 100644 index 0000000..3247cc8 --- /dev/null +++ b/Source/cmExportBuildAndroidMKGenerator.cxx @@ -0,0 +1,193 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmExportBuildAndroidMKGenerator.h" + +#include "cmExportSet.h" +#include "cmGeneratorTarget.h" +#include "cmGlobalGenerator.h" +#include "cmLocalGenerator.h" +#include "cmMakefile.h" +#include "cmTargetExport.h" + +cmExportBuildAndroidMKGenerator::cmExportBuildAndroidMKGenerator() +{ + this->LG = CM_NULLPTR; + this->ExportSet = CM_NULLPTR; +} + +void cmExportBuildAndroidMKGenerator::GenerateImportHeaderCode( + std::ostream& os, const std::string&) +{ + os << "LOCAL_PATH := $(call my-dir)\n\n"; +} + +void cmExportBuildAndroidMKGenerator::GenerateImportFooterCode(std::ostream&) +{ +} + +void cmExportBuildAndroidMKGenerator::GenerateExpectedTargetsCode( + std::ostream&, const std::string&) +{ +} + +void cmExportBuildAndroidMKGenerator::GenerateImportTargetCode( + std::ostream& os, const cmGeneratorTarget* target) +{ + std::string targetName = this->Namespace; + targetName += target->GetExportName(); + os << "include $(CLEAR_VARS)\n"; + os << "LOCAL_MODULE := "; + os << targetName << "\n"; + os << "LOCAL_SRC_FILES := "; + std::string path = target->GetLocalGenerator()->ConvertToOutputFormat( + target->GetFullPath(), cmOutputConverter::MAKERULE); + os << path << "\n"; +} + +void cmExportBuildAndroidMKGenerator::GenerateImportPropertyCode( + std::ostream&, const std::string&, cmGeneratorTarget const*, + ImportPropertyMap const&) +{ +} + +void cmExportBuildAndroidMKGenerator::GenerateMissingTargetsCheckCode( + std::ostream&, const std::vector<std::string>&) +{ +} + +void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( + const cmGeneratorTarget* target, std::ostream& os, + const ImportPropertyMap& properties) +{ + std::string config = ""; + if (this->Configurations.size()) { + config = this->Configurations[0]; + } + cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( + target, os, properties, cmExportBuildAndroidMKGenerator::BUILD, config); +} + +void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( + const cmGeneratorTarget* target, std::ostream& os, + const ImportPropertyMap& properties, GenerateType type, + std::string const& config) +{ + const bool newCMP0022Behavior = + target->GetPolicyStatusCMP0022() != cmPolicies::WARN && + target->GetPolicyStatusCMP0022() != cmPolicies::OLD; + if (!newCMP0022Behavior) { + std::ostringstream w; + if (type == cmExportBuildAndroidMKGenerator::BUILD) { + w << "export(TARGETS ... ANDROID_MK) called with policy CMP0022"; + } else { + w << "install( EXPORT_ANDROID_MK ...) called with policy CMP0022"; + } + w << " set to OLD for target " << target->Target->GetName() << ". " + << "The export will only work with CMP0022 set to NEW."; + target->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + } + if (!properties.empty()) { + os << "LOCAL_CPP_FEATURES := rtti exceptions\n"; + for (ImportPropertyMap::const_iterator pi = properties.begin(); + pi != properties.end(); ++pi) { + if (pi->first == "INTERFACE_COMPILE_OPTIONS") { + os << "LOCAL_CPP_FEATURES += "; + os << (pi->second) << "\n"; + } else if (pi->first == "INTERFACE_LINK_LIBRARIES") { + // need to look at list in pi->second and see if static or shared + // FindTargetToLink + // target->GetLocalGenerator()->FindGeneratorTargetToUse() + // then add to LOCAL_CPPFLAGS + std::vector<std::string> libraries; + cmSystemTools::ExpandListArgument(pi->second, libraries); + std::string staticLibs; + std::string sharedLibs; + std::string ldlibs; + for (std::vector<std::string>::iterator i = libraries.begin(); + i != libraries.end(); ++i) { + cmGeneratorTarget* gt = + target->GetLocalGenerator()->FindGeneratorTargetToUse(*i); + if (gt) { + + if (gt->GetType() == cmState::SHARED_LIBRARY || + gt->GetType() == cmState::MODULE_LIBRARY) { + sharedLibs += " " + *i; + } else { + staticLibs += " " + *i; + } + } else { + // evaluate any generator expressions with the current + // build type of the makefile + cmGeneratorExpression ge; + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(*i); + std::string evaluated = + cge->Evaluate(target->GetLocalGenerator(), config); + bool relpath = false; + if (type == cmExportBuildAndroidMKGenerator::INSTALL) { + relpath = i->substr(0, 3) == "../"; + } + // check for full path or if it already has a -l, or + // in the case of an install check for relative paths + // if it is full or a link library then use string directly + if (cmSystemTools::FileIsFullPath(evaluated) || + evaluated.substr(0, 2) == "-l" || relpath) { + ldlibs += " " + evaluated; + // if it is not a path and does not have a -l then add -l + } else if (!evaluated.empty()) { + ldlibs += " -l" + evaluated; + } + } + } + if (!sharedLibs.empty()) { + os << "LOCAL_SHARED_LIBRARIES :=" << sharedLibs << "\n"; + } + if (!staticLibs.empty()) { + os << "LOCAL_STATIC_LIBRARIES :=" << staticLibs << "\n"; + } + if (!ldlibs.empty()) { + os << "LOCAL_EXPORT_LDLIBS :=" << ldlibs << "\n"; + } + } else if (pi->first == "INTERFACE_INCLUDE_DIRECTORIES") { + std::string includes = pi->second; + std::vector<std::string> includeList; + cmSystemTools::ExpandListArgument(includes, includeList); + os << "LOCAL_EXPORT_C_INCLUDES := "; + std::string end; + for (std::vector<std::string>::iterator i = includeList.begin(); + i != includeList.end(); ++i) { + os << end << *i; + end = "\\\n"; + } + os << "\n"; + } else { + os << "# " << pi->first << " " << (pi->second) << "\n"; + } + } + } + switch (target->GetType()) { + case cmState::SHARED_LIBRARY: + case cmState::MODULE_LIBRARY: + os << "include $(PREBUILT_SHARED_LIBRARY)\n"; + break; + case cmState::STATIC_LIBRARY: + os << "include $(PREBUILT_STATIC_LIBRARY)\n"; + break; + case cmState::EXECUTABLE: + case cmState::UTILITY: + case cmState::OBJECT_LIBRARY: + case cmState::GLOBAL_TARGET: + case cmState::INTERFACE_LIBRARY: + case cmState::UNKNOWN_LIBRARY: + break; + } + os << "\n"; +} diff --git a/Source/cmExportBuildAndroidMKGenerator.h b/Source/cmExportBuildAndroidMKGenerator.h new file mode 100644 index 0000000..e26aba0 --- /dev/null +++ b/Source/cmExportBuildAndroidMKGenerator.h @@ -0,0 +1,68 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmExportBuildAndroidMKGenerator_h +#define cmExportBuildAndroidMKGenerator_h + +#include "cmExportBuildFileGenerator.h" +#include "cmListFileCache.h" + +class cmExportSet; + +/** \class cmExportBuildAndroidMKGenerator + * \brief Generate a file exporting targets from a build tree. + * + * cmExportBuildAndroidMKGenerator generates a file exporting targets from + * a build tree. This exports the targets to the Android ndk build tool + * makefile format for prebuilt libraries. + * + * This is used to implement the EXPORT() command. + */ +class cmExportBuildAndroidMKGenerator : public cmExportBuildFileGenerator +{ +public: + cmExportBuildAndroidMKGenerator(); + // this is so cmExportInstallAndroidMKGenerator can share this + // function as they are almost the same + enum GenerateType + { + BUILD, + INSTALL + }; + static void GenerateInterfaceProperties(cmGeneratorTarget const* target, + std::ostream& os, + const ImportPropertyMap& properties, + GenerateType type, + std::string const& config); + +protected: + // Implement virtual methods from the superclass. + virtual void GeneratePolicyHeaderCode(std::ostream&) {} + virtual void GeneratePolicyFooterCode(std::ostream&) {} + virtual void GenerateImportHeaderCode(std::ostream& os, + const std::string& config = ""); + virtual void GenerateImportFooterCode(std::ostream& os); + virtual void GenerateImportTargetCode(std::ostream& os, + const cmGeneratorTarget* target); + virtual void GenerateExpectedTargetsCode(std::ostream& os, + const std::string& expectedTargets); + virtual void GenerateImportPropertyCode(std::ostream& os, + const std::string& config, + cmGeneratorTarget const* target, + ImportPropertyMap const& properties); + virtual void GenerateMissingTargetsCheckCode( + std::ostream& os, const std::vector<std::string>& missingTargets); + virtual void GenerateInterfaceProperties( + cmGeneratorTarget const* target, std::ostream& os, + const ImportPropertyMap& properties); +}; + +#endif diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index fc62492..134a63f 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -18,6 +18,7 @@ #include <cmsys/Encoding.hxx> #include <cmsys/RegularExpression.hxx> +#include "cmExportBuildAndroidMKGenerator.h" #include "cmExportBuildFileGenerator.h" #if defined(__HAIKU__) @@ -34,6 +35,7 @@ cmExportCommand::cmExportCommand() , Namespace(&Helper, "NAMESPACE", &ArgumentGroup) , Filename(&Helper, "FILE", &ArgumentGroup) , ExportOld(&Helper, "EXPORT_LINK_INTERFACE_LIBRARIES", &ArgumentGroup) + , AndroidMKFile(&Helper, "ANDROID_MK") { this->ExportSet = CM_NULLPTR; } @@ -66,13 +68,18 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args, } std::string fname; - if (!this->Filename.WasFound()) { + bool android = false; + if (this->AndroidMKFile.WasFound()) { + fname = this->AndroidMKFile.GetString(); + android = true; + } + if (!this->Filename.WasFound() && fname.empty()) { if (args[0] != "EXPORT") { this->SetError("FILE <filename> option missing."); return false; } fname = this->ExportSetName.GetString() + ".cmake"; - } else { + } else if (fname.empty()) { // Make sure the file has a .cmake extension. if (cmSystemTools::GetFilenameLastExtension(this->Filename.GetCString()) != ".cmake") { @@ -176,7 +183,12 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args, } // Setup export file generation. - cmExportBuildFileGenerator* ebfg = new cmExportBuildFileGenerator; + cmExportBuildFileGenerator* ebfg = CM_NULLPTR; + if (android) { + ebfg = new cmExportBuildAndroidMKGenerator; + } else { + ebfg = new cmExportBuildFileGenerator; + } ebfg->SetExportFile(fname.c_str()); ebfg->SetNamespace(this->Namespace.GetCString()); ebfg->SetAppendMode(this->Append.IsEnabled()); diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h index 0a149af..481d2c5 100644 --- a/Source/cmExportCommand.h +++ b/Source/cmExportCommand.h @@ -54,6 +54,7 @@ private: cmCAString Namespace; cmCAString Filename; cmCAEnabler ExportOld; + cmCAString AndroidMKFile; cmExportSet* ExportSet; diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 23c77d9..c4c7d7d 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -96,24 +96,8 @@ bool cmExportFileGenerator::GenerateImportFile() } std::ostream& os = *foutPtr; - // Protect that file against use with older CMake versions. - /* clang-format off */ - os << "# Generated by CMake\n\n"; - os << "if(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.5)\n" - << " message(FATAL_ERROR \"CMake >= 2.6.0 required\")\n" - << "endif()\n"; - /* clang-format on */ - - // Isolate the file policy level. - // We use 2.6 here instead of the current version because newer - // versions of CMake should be able to export files imported by 2.6 - // until the import format changes. - /* clang-format off */ - os << "cmake_policy(PUSH)\n" - << "cmake_policy(VERSION 2.6)\n"; - /* clang-format on */ - // Start with the import file header. + this->GeneratePolicyHeaderCode(os); this->GenerateImportHeaderCode(os); // Create all the imported targets. @@ -121,7 +105,7 @@ bool cmExportFileGenerator::GenerateImportFile() // End with the import file footer. this->GenerateImportFooterCode(os); - os << "cmake_policy(POP)\n"; + this->GeneratePolicyFooterCode(os); return result; } @@ -832,6 +816,31 @@ void cmExportFileGenerator::SetImportLinkProperty( properties[prop] = link_entries; } +void cmExportFileGenerator::GeneratePolicyHeaderCode(std::ostream& os) +{ + // Protect that file against use with older CMake versions. + /* clang-format off */ + os << "# Generated by CMake\n\n"; + os << "if(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.5)\n" + << " message(FATAL_ERROR \"CMake >= 2.6.0 required\")\n" + << "endif()\n"; + /* clang-format on */ + + // Isolate the file policy level. + // We use 2.6 here instead of the current version because newer + // versions of CMake should be able to export files imported by 2.6 + // until the import format changes. + /* clang-format off */ + os << "cmake_policy(PUSH)\n" + << "cmake_policy(VERSION 2.6)\n"; + /* clang-format on */ +} + +void cmExportFileGenerator::GeneratePolicyFooterCode(std::ostream& os) +{ + os << "cmake_policy(POP)\n"; +} + void cmExportFileGenerator::GenerateImportHeaderCode(std::ostream& os, const std::string& config) { diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index 354994a..d106ab7 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -78,25 +78,28 @@ protected: std::vector<std::string>& missingTargets); // Methods to implement export file code generation. - void GenerateImportHeaderCode(std::ostream& os, - const std::string& config = ""); - void GenerateImportFooterCode(std::ostream& os); + virtual void GeneratePolicyHeaderCode(std::ostream& os); + virtual void GeneratePolicyFooterCode(std::ostream& os); + virtual void GenerateImportHeaderCode(std::ostream& os, + const std::string& config = ""); + virtual void GenerateImportFooterCode(std::ostream& os); void GenerateImportVersionCode(std::ostream& os); - void GenerateImportTargetCode(std::ostream& os, - cmGeneratorTarget const* target); - void GenerateImportPropertyCode(std::ostream& os, const std::string& config, - cmGeneratorTarget const* target, - ImportPropertyMap const& properties); - void GenerateImportedFileChecksCode( + virtual void GenerateImportTargetCode(std::ostream& os, + cmGeneratorTarget const* target); + virtual void GenerateImportPropertyCode(std::ostream& os, + const std::string& config, + cmGeneratorTarget const* target, + ImportPropertyMap const& properties); + virtual void GenerateImportedFileChecksCode( std::ostream& os, cmGeneratorTarget* target, ImportPropertyMap const& properties, const std::set<std::string>& importedLocations); - void GenerateImportedFileCheckLoop(std::ostream& os); - void GenerateMissingTargetsCheckCode( + virtual void GenerateImportedFileCheckLoop(std::ostream& os); + virtual void GenerateMissingTargetsCheckCode( std::ostream& os, const std::vector<std::string>& missingTargets); - void GenerateExpectedTargetsCode(std::ostream& os, - const std::string& expectedTargets); + virtual void GenerateExpectedTargetsCode(std::ostream& os, + const std::string& expectedTargets); // Collect properties with detailed information about targets beyond // their location on disk. @@ -140,9 +143,9 @@ protected: ImportPropertyMap& properties); void PopulateCompatibleInterfaceProperties(cmGeneratorTarget* target, ImportPropertyMap& properties); - void GenerateInterfaceProperties(cmGeneratorTarget const* target, - std::ostream& os, - const ImportPropertyMap& properties); + virtual void GenerateInterfaceProperties( + cmGeneratorTarget const* target, std::ostream& os, + const ImportPropertyMap& properties); void PopulateIncludeDirectoriesInterface( cmTargetExport* target, cmGeneratorExpression::PreprocessContext preprocessRule, @@ -169,8 +172,8 @@ protected: std::vector<std::string>& missingTargets, FreeTargetsReplace replace = NoReplaceFreeTargets); - void GenerateRequiredCMakeVersion(std::ostream& os, - const char* versionString); + virtual void GenerateRequiredCMakeVersion(std::ostream& os, + const char* versionString); // The namespace in which the exports are placed in the generated file. std::string Namespace; diff --git a/Source/cmExportInstallAndroidMKGenerator.cxx b/Source/cmExportInstallAndroidMKGenerator.cxx new file mode 100644 index 0000000..8f815b7 --- /dev/null +++ b/Source/cmExportInstallAndroidMKGenerator.cxx @@ -0,0 +1,146 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmExportInstallAndroidMKGenerator.h" + +#include "cmAlgorithms.h" +#include "cmExportBuildAndroidMKGenerator.h" +#include "cmExportSet.h" +#include "cmExportSetMap.h" +#include "cmGeneratedFileStream.h" +#include "cmGeneratorTarget.h" +#include "cmGlobalGenerator.h" +#include "cmInstallExportGenerator.h" +#include "cmInstallTargetGenerator.h" +#include "cmLocalGenerator.h" +#include "cmTargetExport.h" + +cmExportInstallAndroidMKGenerator::cmExportInstallAndroidMKGenerator( + cmInstallExportGenerator* iegen) + : cmExportInstallFileGenerator(iegen) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateImportHeaderCode( + std::ostream& os, const std::string&) +{ + std::string installDir = this->IEGen->GetDestination(); + os << "LOCAL_PATH := $(call my-dir)\n"; + size_t numDotDot = cmSystemTools::CountChar(installDir.c_str(), '/'); + numDotDot += (installDir.size() > 0) ? 1 : 0; + std::string path; + for (size_t n = 0; n < numDotDot; n++) { + path += "/.."; + } + os << "_IMPORT_PREFIX := " + << "$(LOCAL_PATH)" << path << "\n\n"; + for (std::vector<cmTargetExport*>::const_iterator tei = + this->IEGen->GetExportSet()->GetTargetExports()->begin(); + tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei) { + // Collect import properties for this target. + cmTargetExport const* te = *tei; + if (te->Target->GetType() == cmState::INTERFACE_LIBRARY) { + continue; + } + std::string dest; + if (te->LibraryGenerator) { + dest = te->LibraryGenerator->GetDestination(""); + } + if (te->ArchiveGenerator) { + dest = te->ArchiveGenerator->GetDestination(""); + } + te->Target->Target->SetProperty("__dest", dest.c_str()); + } +} + +void cmExportInstallAndroidMKGenerator::GenerateImportFooterCode(std::ostream&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateImportTargetCode( + std::ostream& os, const cmGeneratorTarget* target) +{ + std::string targetName = this->Namespace; + targetName += target->GetExportName(); + os << "include $(CLEAR_VARS)\n"; + os << "LOCAL_MODULE := "; + os << targetName << "\n"; + os << "LOCAL_SRC_FILES := $(_IMPORT_PREFIX)/"; + os << target->Target->GetProperty("__dest") << "/"; + std::string config = ""; + if (this->Configurations.size()) { + config = this->Configurations[0]; + } + os << target->GetFullName(config) << "\n"; +} + +void cmExportInstallAndroidMKGenerator::GenerateExpectedTargetsCode( + std::ostream&, const std::string&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateImportPropertyCode( + std::ostream&, const std::string&, cmGeneratorTarget const*, + ImportPropertyMap const&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateMissingTargetsCheckCode( + std::ostream&, const std::vector<std::string>&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateInterfaceProperties( + cmGeneratorTarget const* target, std::ostream& os, + const ImportPropertyMap& properties) +{ + std::string config = ""; + if (this->Configurations.size()) { + config = this->Configurations[0]; + } + cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( + target, os, properties, cmExportBuildAndroidMKGenerator::INSTALL, config); +} + +void cmExportInstallAndroidMKGenerator::LoadConfigFiles(std::ostream&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateImportPrefix(std::ostream&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateRequiredCMakeVersion( + std::ostream&, const char*) +{ +} + +void cmExportInstallAndroidMKGenerator::CleanupTemporaryVariables( + std::ostream&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateImportedFileCheckLoop( + std::ostream&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateImportedFileChecksCode( + std::ostream&, cmGeneratorTarget*, ImportPropertyMap const&, + const std::set<std::string>&) +{ +} + +bool cmExportInstallAndroidMKGenerator::GenerateImportFileConfig( + const std::string&, std::vector<std::string>&) +{ + return true; +} diff --git a/Source/cmExportInstallAndroidMKGenerator.h b/Source/cmExportInstallAndroidMKGenerator.h new file mode 100644 index 0000000..4b9f51c --- /dev/null +++ b/Source/cmExportInstallAndroidMKGenerator.h @@ -0,0 +1,72 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmExportInstallAndroidMKGenerator_h +#define cmExportInstallAndroidMKGenerator_h + +#include "cmExportInstallFileGenerator.h" + +class cmInstallExportGenerator; +class cmInstallTargetGenerator; + +/** \class cmExportInstallAndroidMKGenerator + * \brief Generate a file exporting targets from an install tree. + * + * cmExportInstallAndroidMKGenerator generates files exporting targets from + * install an installation tree. The files are placed in a temporary + * location for installation by cmInstallExportGenerator. The file format + * is for the ndk build system and is a makefile fragment specifing prebuilt + * libraries to the ndk build system. + * + * This is used to implement the INSTALL(EXPORT_ANDROID_MK) command. + */ +class cmExportInstallAndroidMKGenerator : public cmExportInstallFileGenerator +{ +public: + /** Construct with the export installer that will install the + files. */ + cmExportInstallAndroidMKGenerator(cmInstallExportGenerator* iegen); + +protected: + // Implement virtual methods from the superclass. + virtual void GeneratePolicyHeaderCode(std::ostream&) {} + virtual void GeneratePolicyFooterCode(std::ostream&) {} + virtual void GenerateImportHeaderCode(std::ostream& os, + const std::string& config = ""); + virtual void GenerateImportFooterCode(std::ostream& os); + virtual void GenerateImportTargetCode(std::ostream& os, + const cmGeneratorTarget* target); + virtual void GenerateExpectedTargetsCode(std::ostream& os, + const std::string& expectedTargets); + virtual void GenerateImportPropertyCode(std::ostream& os, + const std::string& config, + cmGeneratorTarget const* target, + ImportPropertyMap const& properties); + virtual void GenerateMissingTargetsCheckCode( + std::ostream& os, const std::vector<std::string>& missingTargets); + virtual void GenerateInterfaceProperties( + cmGeneratorTarget const* target, std::ostream& os, + const ImportPropertyMap& properties); + virtual void GenerateImportPrefix(std::ostream& os); + virtual void LoadConfigFiles(std::ostream&); + virtual void GenerateRequiredCMakeVersion(std::ostream& os, + const char* versionString); + virtual void CleanupTemporaryVariables(std::ostream&); + virtual void GenerateImportedFileCheckLoop(std::ostream& os); + virtual void GenerateImportedFileChecksCode( + std::ostream& os, cmGeneratorTarget* target, + ImportPropertyMap const& properties, + const std::set<std::string>& importedLocations); + virtual bool GenerateImportFileConfig(const std::string& config, + std::vector<std::string>&); +}; + +#endif diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index ceba69a..f47038f 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -75,55 +75,8 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) this->GenerateExpectedTargetsCode(os, expectedTargets); } - // Set an _IMPORT_PREFIX variable for import location properties - // to reference if they are relative to the install prefix. - std::string installPrefix = - this->IEGen->GetLocalGenerator()->GetMakefile()->GetSafeDefinition( - "CMAKE_INSTALL_PREFIX"); - std::string const& expDest = this->IEGen->GetDestination(); - if (cmSystemTools::FileIsFullPath(expDest)) { - // The export file is being installed to an absolute path so the - // package is not relocatable. Use the configured install prefix. - /* clang-format off */ - os << - "# The installation prefix configured by this project.\n" - "set(_IMPORT_PREFIX \"" << installPrefix << "\")\n" - "\n"; - /* clang-format on */ - } else { - // Add code to compute the installation prefix relative to the - // import file location. - std::string absDest = installPrefix + "/" + expDest; - std::string absDestS = absDest + "/"; - os << "# Compute the installation prefix relative to this file.\n" - << "get_filename_component(_IMPORT_PREFIX" - << " \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n"; - if (cmHasLiteralPrefix(absDestS.c_str(), "/lib/") || - cmHasLiteralPrefix(absDestS.c_str(), "/lib64/") || - cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib/") || - cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib64/")) { - // Handle "/usr move" symlinks created by some Linux distros. - /* clang-format off */ - os << - "# Use original install prefix when loaded through a\n" - "# cross-prefix symbolic link such as /lib -> /usr/lib.\n" - "get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)\n" - "get_filename_component(_realOrig \"" << absDest << "\" REALPATH)\n" - "if(_realCurr STREQUAL _realOrig)\n" - " set(_IMPORT_PREFIX \"" << absDest << "\")\n" - "endif()\n" - "unset(_realOrig)\n" - "unset(_realCurr)\n"; - /* clang-format on */ - } - std::string dest = expDest; - while (!dest.empty()) { - os << "get_filename_component(_IMPORT_PREFIX \"${_IMPORT_PREFIX}\" " - "PATH)\n"; - dest = cmSystemTools::GetFilenamePath(dest); - } - os << "\n"; - } + // Compute the relative import prefix for the file + this->GenerateImportPrefix(os); std::vector<std::string> missingTargets; @@ -201,24 +154,9 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) this->GenerateRequiredCMakeVersion(os, "2.8.12"); } - // Now load per-configuration properties for them. - /* clang-format off */ - os << "# Load information for each installed configuration.\n" - << "get_filename_component(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n" - << "file(GLOB CONFIG_FILES \"${_DIR}/" - << this->GetConfigImportFileGlob() << "\")\n" - << "foreach(f ${CONFIG_FILES})\n" - << " include(${f})\n" - << "endforeach()\n" - << "\n"; - /* clang-format on */ + this->LoadConfigFiles(os); - // Cleanup the import prefix variable. - /* clang-format off */ - os << "# Cleanup temporary variables.\n" - << "set(_IMPORT_PREFIX)\n" - << "\n"; - /* clang-format on */ + this->CleanupTemporaryVariables(os); this->GenerateImportedFileCheckLoop(os); bool result = true; @@ -239,6 +177,86 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) return result; } +void cmExportInstallFileGenerator::GenerateImportPrefix(std::ostream& os) +{ + // Set an _IMPORT_PREFIX variable for import location properties + // to reference if they are relative to the install prefix. + std::string installPrefix = + this->IEGen->GetLocalGenerator()->GetMakefile()->GetSafeDefinition( + "CMAKE_INSTALL_PREFIX"); + std::string const& expDest = this->IEGen->GetDestination(); + if (cmSystemTools::FileIsFullPath(expDest)) { + // The export file is being installed to an absolute path so the + // package is not relocatable. Use the configured install prefix. + /* clang-format off */ + os << + "# The installation prefix configured by this project.\n" + "set(_IMPORT_PREFIX \"" << installPrefix << "\")\n" + "\n"; + /* clang-format on */ + } else { + // Add code to compute the installation prefix relative to the + // import file location. + std::string absDest = installPrefix + "/" + expDest; + std::string absDestS = absDest + "/"; + os << "# Compute the installation prefix relative to this file.\n" + << "get_filename_component(_IMPORT_PREFIX" + << " \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n"; + if (cmHasLiteralPrefix(absDestS.c_str(), "/lib/") || + cmHasLiteralPrefix(absDestS.c_str(), "/lib64/") || + cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib/") || + cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib64/")) { + // Handle "/usr move" symlinks created by some Linux distros. + /* clang-format off */ + os << + "# Use original install prefix when loaded through a\n" + "# cross-prefix symbolic link such as /lib -> /usr/lib.\n" + "get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)\n" + "get_filename_component(_realOrig \"" << absDest << "\" REALPATH)\n" + "if(_realCurr STREQUAL _realOrig)\n" + " set(_IMPORT_PREFIX \"" << absDest << "\")\n" + "endif()\n" + "unset(_realOrig)\n" + "unset(_realCurr)\n"; + /* clang-format on */ + } + std::string dest = expDest; + while (!dest.empty()) { + os << "get_filename_component(_IMPORT_PREFIX \"${_IMPORT_PREFIX}\" " + "PATH)\n"; + dest = cmSystemTools::GetFilenamePath(dest); + } + os << "if(_IMPORT_PREFIX STREQUAL \"/\")\n" + << " set(_IMPORT_PREFIX \"\")\n" + << "endif()\n" + << "\n"; + } +} + +void cmExportInstallFileGenerator::CleanupTemporaryVariables(std::ostream& os) +{ + /* clang-format off */ + os << "# Cleanup temporary variables.\n" + << "set(_IMPORT_PREFIX)\n" + << "\n"; + /* clang-format on */ +} + +void cmExportInstallFileGenerator::LoadConfigFiles(std::ostream& os) +{ + // Now load per-configuration properties for them. + /* clang-format off */ + os << "# Load information for each installed configuration.\n" + << "get_filename_component(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n" + << "file(GLOB CONFIG_FILES \"${_DIR}/" + << this->GetConfigImportFileGlob() << "\")\n" + << "foreach(f ${CONFIG_FILES})\n" + << " include(${f})\n" + << "endforeach()\n" + << "\n"; + /* clang-format on */ +} + void cmExportInstallFileGenerator::ReplaceInstallPrefix(std::string& input) { std::string::size_type pos = 0; diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h index c693dc1..63f2d40 100644 --- a/Source/cmExportInstallFileGenerator.h +++ b/Source/cmExportInstallFileGenerator.h @@ -80,9 +80,17 @@ protected: std::vector<std::string> FindNamespaces(cmGlobalGenerator* gg, const std::string& name); + /** Generate the relative import prefix. */ + virtual void GenerateImportPrefix(std::ostream&); + + /** Generate the relative import prefix. */ + virtual void LoadConfigFiles(std::ostream&); + + virtual void CleanupTemporaryVariables(std::ostream&); + /** Generate a per-configuration file for the targets. */ - bool GenerateImportFileConfig(const std::string& config, - std::vector<std::string>& missingTargets); + virtual bool GenerateImportFileConfig( + const std::string& config, std::vector<std::string>& missingTargets); /** Fill in properties indicating installed file locations. */ void SetImportLocationProperty(const std::string& config, diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index a0aefb8..6c31481 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -77,9 +77,8 @@ std::string cmExportTryCompileFileGenerator::FindTargets( CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(prop); - cmTarget dummyHead; - dummyHead.SetType(cmState::EXECUTABLE, "try_compile_dummy_exe"); - dummyHead.SetMakefile(tgt->Target->GetMakefile()); + cmTarget dummyHead("try_compile_dummy_exe", cmState::EXECUTABLE, + cmTarget::VisibilityNormal, tgt->Target->GetMakefile()); cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator()); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 835b118..2c226cd 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2481,6 +2481,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) std::string hashMatchMSG; CM_AUTO_PTR<cmCryptoHash> hash; bool showProgress = false; + std::string userpwd; while (i != args.end()) { if (*i == "TIMEOUT") { @@ -2564,6 +2565,18 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) return false; } hashMatchMSG = algo + " hash"; + } else if (*i == "USERPWD") { + ++i; + if (i == args.end()) { + this->SetError("DOWNLOAD missing string for USERPWD."); + return false; + } + userpwd = *i; + } else { + // Do not return error for compatibility reason. + std::string err = "Unexpected argument: "; + err += *i; + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, err.c_str()); } ++i; } @@ -2698,6 +2711,11 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) check_curl_result(res, "DOWNLOAD cannot set progress data: "); } + if (!userpwd.empty()) { + res = ::curl_easy_setopt(curl, CURLOPT_USERPWD, userpwd.c_str()); + check_curl_result(res, "DOWNLOAD cannot set user password: "); + } + res = ::curl_easy_perform(curl); /* always cleanup */ @@ -2778,6 +2796,7 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) std::string logVar; std::string statusVar; bool showProgress = false; + std::string userpwd; while (i != args.end()) { if (*i == "TIMEOUT") { @@ -2812,6 +2831,18 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) statusVar = *i; } else if (*i == "SHOW_PROGRESS") { showProgress = true; + } else if (*i == "USERPWD") { + ++i; + if (i == args.end()) { + this->SetError("UPLOAD missing string for USERPWD."); + return false; + } + userpwd = *i; + } else { + // Do not return error for compatibility reason. + std::string err = "Unexpected argument: "; + err += *i; + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, err.c_str()); } ++i; @@ -2920,6 +2951,11 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) ::curl_easy_setopt(curl, CURLOPT_INFILESIZE, static_cast<long>(file_size)); check_curl_result(res, "UPLOAD cannot set input file size: "); + if (!userpwd.empty()) { + res = ::curl_easy_setopt(curl, CURLOPT_USERPWD, userpwd.c_str()); + check_curl_result(res, "UPLOAD cannot set user password: "); + } + res = ::curl_easy_perform(curl); /* always cleanup */ diff --git a/Source/cmFortranLexer.cxx b/Source/cmFortranLexer.cxx index 7cde4cb..7bcd993 100644 --- a/Source/cmFortranLexer.cxx +++ b/Source/cmFortranLexer.cxx @@ -1,14 +1,3 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2015 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ #line 2 "cmFortranLexer.cxx" #line 4 "cmFortranLexer.cxx" @@ -19,8 +8,8 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 39 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 1 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -99,25 +88,13 @@ typedef unsigned int flex_uint32_t; #endif /* ! FLEXINT_H */ -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* Returned upon end-of-file. */ @@ -204,83 +181,83 @@ typedef size_t yy_size_t; /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = yyg->yy_hold_char; \ - YY_RESTORE_YY_MORE_OFFSET \ - yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) + *yy_cp = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - yy_size_t yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; - int yy_buffer_status; + int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via cmFortran_yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via cmFortran_yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ #define YY_BUFFER_EOF_PENDING 2 - }; + }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* We provide macros for accessing buffer states in case in the @@ -314,7 +291,7 @@ static void cmFortran_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yys YY_BUFFER_STATE cmFortran_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE cmFortran_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); +YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); void *cmFortran_yyalloc (yy_size_t ,yyscan_t yyscanner ); void *cmFortran_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); @@ -323,30 +300,30 @@ void cmFortran_yyfree (void * ,yyscan_t yyscanner ); #define yy_new_buffer cmFortran_yy_create_buffer #define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ cmFortran_yyensure_buffer_stack (yyscanner); \ - YY_CURRENT_BUFFER_LVALUE = \ + YY_CURRENT_BUFFER_LVALUE = \ cmFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } #define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ + { \ + if ( ! YY_CURRENT_BUFFER ){\ cmFortran_yyensure_buffer_stack (yyscanner); \ - YY_CURRENT_BUFFER_LVALUE = \ + YY_CURRENT_BUFFER_LVALUE = \ cmFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ -#define cmFortran_yywrap(yyscanner) 1 +#define cmFortran_yywrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; @@ -358,51 +335,54 @@ typedef int yy_state_type; static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); static int yy_get_next_buffer (yyscan_t yyscanner ); -static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); +static void yynoreturn yy_fatal_error (yyconst char* msg ,yyscan_t yyscanner ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ - yyg->yytext_ptr = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ - yyg->yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yyg->yy_c_buf_p = yy_cp; - -#define YY_NUM_RULES 45 -#define YY_END_OF_BUFFER 46 + yyg->yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yyg->yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 50 +#define YY_END_OF_BUFFER 51 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[173] = + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[199] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 46, 40, 42, 41, 44, 1, 40, 33, 2, 35, - 40, 41, 38, 40, 39, 40, 39, 42, 40, 41, - 40, 39, 9, 8, 9, 4, 3, 40, 0, 10, - 0, 0, 0, 0, 0, 33, 33, 34, 36, 38, - 40, 39, 0, 43, 39, 0, 0, 0, 12, 0, - 0, 0, 0, 0, 0, 40, 0, 11, 39, 0, - 0, 5, 0, 0, 0, 29, 0, 0, 33, 33, - 33, 33, 0, 0, 12, 12, 0, 0, 0, 23, - 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, + 51, 45, 47, 46, 49, 1, 45, 33, 2, 35, + 45, 46, 38, 45, 44, 44, 44, 44, 44, 45, + 44, 47, 45, 46, 45, 44, 9, 8, 9, 4, + 3, 45, 0, 10, 0, 0, 0, 0, 0, 33, + 33, 34, 36, 38, 45, 44, 44, 44, 44, 44, + 0, 48, 44, 0, 0, 0, 12, 0, 0, 0, + 0, 0, 0, 45, 0, 11, 44, 0, 0, 5, + 0, 0, 0, 29, 0, 0, 33, 33, 33, 33, + 0, 0, 39, 44, 44, 44, 43, 12, 12, 0, + + 0, 0, 23, 0, 0, 0, 0, 0, 0, 6, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, + 44, 44, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 30, 31, 0, 0, 0, 0, + 0, 0, 44, 44, 44, 0, 24, 25, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 32, 27, 0, + 0, 20, 0, 44, 44, 42, 0, 26, 21, 0, + 0, 0, 19, 0, 0, 18, 28, 0, 0, 40, + 44, 17, 22, 0, 7, 37, 7, 15, 0, 44, + 14, 16, 41, 0, 0, 0, 13, 0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 30, 31, - 0, 0, 0, 0, 0, 0, 0, 24, 25, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 32, 27, - 0, 0, 20, 0, 0, 26, 21, 0, 0, 0, - 19, 0, 0, 18, 28, 0, 0, 17, 22, 0, - 7, 37, 7, 15, 0, 14, 16, 0, 0, 0, - 13, 0 } ; -static yyconst flex_int32_t yy_ec[256] = +static yyconst YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, @@ -410,14 +390,14 @@ static yyconst flex_int32_t yy_ec[256] = 1, 5, 6, 7, 8, 9, 1, 10, 11, 1, 1, 12, 1, 13, 1, 1, 1, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 16, 17, - 18, 19, 20, 1, 21, 21, 22, 23, 24, 25, - 21, 21, 26, 21, 21, 27, 21, 28, 21, 21, - 21, 21, 29, 21, 30, 21, 21, 21, 21, 21, - 1, 31, 1, 1, 32, 1, 21, 21, 33, 34, - - 35, 36, 21, 21, 37, 21, 21, 38, 21, 39, - 21, 21, 21, 21, 40, 21, 41, 21, 21, 21, - 21, 21, 1, 1, 1, 1, 1, 1, 1, 1, + 18, 19, 20, 1, 21, 22, 23, 24, 25, 26, + 22, 22, 27, 22, 22, 28, 29, 30, 31, 22, + 22, 32, 33, 34, 35, 22, 22, 22, 22, 22, + 1, 36, 1, 1, 37, 1, 21, 22, 38, 39, + + 40, 41, 22, 22, 42, 22, 22, 43, 29, 44, + 31, 22, 22, 32, 45, 34, 46, 22, 22, 22, + 22, 22, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -434,195 +414,211 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[42] = +static yyconst YY_CHAR yy_meta[47] = { 0, 1, 2, 2, 3, 4, 3, 3, 1, 1, 3, 3, 1, 3, 5, 1, 3, 1, 3, 6, 1, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 1, 5, 7, 7, 7, 7, 7, 7, 7, 7, - 7 + 7, 7, 7, 7, 7, 1, 5, 7, 7, 7, + 7, 7, 7, 7, 7, 7 } ; -static yyconst flex_int16_t yy_base[182] = +static yyconst flex_uint16_t yy_base[208] = { 0, - 0, 40, 0, 41, 220, 48, 44, 54, 56, 65, - 220, 0, 535, 535, 216, 535, 81, 74, 535, 535, - 186, 535, 153, 145, 0, 85, 122, 87, 154, 155, - 195, 227, 535, 147, 91, 535, 535, 0, 147, 535, - 267, 34, 70, 74, 34, 122, 141, 535, 0, 535, - 112, 0, 98, 535, 0, 156, 307, 0, 143, 43, - 155, 151, 48, 101, 130, 348, 130, 535, 0, 121, - 197, 165, 172, 244, 182, 183, 191, 248, 273, 293, - 308, 314, 321, 246, 275, 216, 269, 299, 304, 327, - 307, 304, 312, 116, 107, 367, 535, 327, 334, 347, - - 347, 350, 352, 349, 354, 359, 357, 363, 366, 365, - 369, 372, 369, 373, 374, 101, 86, 372, 535, 535, - 378, 380, 386, 382, 388, 388, 389, 535, 535, 393, - 394, 396, 392, 430, 400, 56, 47, 403, 535, 535, - 409, 414, 535, 409, 416, 535, 535, 416, 419, 441, - 535, 117, 0, 535, 535, 423, 426, 535, 535, 430, - 535, 535, 535, 535, 432, 457, 535, 459, 0, 25, - 535, 535, 476, 483, 489, 492, 499, 506, 513, 520, - 527 + 0, 45, 0, 46, 392, 53, 49, 59, 61, 71, + 392, 0, 572, 572, 364, 572, 91, 77, 572, 572, + 342, 572, 317, 232, 0, 19, 42, 218, 40, 92, + 137, 96, 174, 240, 220, 257, 572, 238, 97, 572, + 572, 0, 205, 572, 302, 50, 77, 83, 59, 137, + 156, 572, 0, 572, 123, 0, 84, 130, 90, 92, + 167, 572, 0, 176, 347, 0, 190, 94, 175, 200, + 121, 92, 201, 393, 193, 572, 0, 162, 222, 175, + 171, 209, 176, 281, 184, 207, 307, 313, 328, 348, + 338, 111, 0, 205, 213, 125, 0, 354, 185, 280, + + 336, 300, 340, 309, 278, 321, 139, 130, 245, 572, + 335, 347, 351, 356, 360, 375, 375, 379, 383, 300, + 80, 381, 384, 390, 392, 393, 397, 399, 397, 402, + 403, 106, 105, 284, 572, 572, 407, 408, 411, 320, + 413, 413, 420, 419, 421, 420, 572, 572, 421, 426, + 428, 420, 467, 432, 101, 83, 438, 572, 572, 439, + 446, 572, 436, 449, 63, 0, 450, 572, 572, 450, + 453, 481, 572, 64, 0, 572, 572, 454, 460, 0, + 464, 572, 572, 463, 572, 572, 572, 572, 468, 471, + 495, 572, 0, 496, 0, 38, 572, 572, 513, 520, + + 526, 529, 536, 543, 550, 557, 564 } ; -static yyconst flex_int16_t yy_def[182] = +static yyconst flex_int16_t yy_def[208] = { 0, - 172, 1, 1, 1, 1, 1, 173, 173, 173, 173, - 172, 174, 172, 172, 175, 172, 174, 172, 172, 172, - 174, 172, 172, 174, 176, 174, 176, 172, 172, 172, - 177, 172, 172, 172, 172, 172, 172, 174, 175, 172, - 172, 172, 172, 172, 172, 172, 178, 172, 174, 172, - 174, 176, 172, 172, 27, 172, 172, 57, 174, 172, - 172, 172, 172, 172, 172, 177, 177, 172, 32, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 178, 178, - 178, 178, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 179, 180, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 181, 181, - 172, 0, 172, 172, 172, 172, 172, 172, 172, 172, - 172 + 198, 1, 1, 1, 1, 1, 199, 199, 199, 199, + 198, 200, 198, 198, 201, 198, 200, 198, 198, 198, + 200, 198, 198, 200, 202, 202, 202, 202, 202, 200, + 202, 198, 198, 198, 203, 198, 198, 198, 198, 198, + 198, 200, 201, 198, 198, 198, 198, 198, 198, 198, + 204, 198, 200, 198, 200, 202, 202, 202, 202, 202, + 198, 198, 31, 198, 198, 65, 200, 198, 198, 198, + 198, 198, 198, 203, 203, 198, 36, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 204, 204, 204, 204, + 198, 198, 202, 202, 202, 202, 202, 198, 198, 198, + + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 202, + 202, 202, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 202, 202, 202, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 202, 202, 202, 198, 198, 198, 198, + 198, 198, 198, 205, 206, 198, 198, 198, 198, 202, + 202, 198, 198, 198, 198, 198, 198, 198, 198, 202, + 198, 198, 202, 198, 207, 207, 198, 0, 198, 198, + + 198, 198, 198, 198, 198, 198, 198 } ; -static yyconst flex_int16_t yy_nxt[577] = +static yyconst flex_uint16_t yy_nxt[619] = { 0, 12, 13, 14, 13, 13, 15, 16, 12, 17, 18, 19, 12, 20, 12, 21, 22, 12, 23, 12, 24, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 26, 27, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 28, 28, 171, 28, 28, 34, 29, 29, 28, - 30, 153, 28, 35, 36, 29, 34, 73, 34, 31, - 152, 78, 37, 35, 36, 35, 87, 34, 73, 32, - 32, 37, 78, 92, 35, 46, 46, 87, 46, 47, - 32, 32, 41, 48, 92, 41, 53, 54, 56, 53, - 137, 56, 71, 72, 57, 71, 74, 75, 76, 53, - - 54, 77, 53, 42, 43, 136, 44, 74, 75, 76, - 45, 117, 77, 83, 42, 43, 83, 44, 162, 162, - 116, 45, 38, 46, 46, 95, 46, 47, 93, 38, - 38, 48, 68, 38, 94, 55, 38, 84, 38, 93, - 38, 38, 80, 46, 86, 80, 81, 86, 84, 40, - 82, 70, 38, 55, 38, 58, 59, 56, 58, 65, - 56, 38, 38, 57, 51, 38, 96, 59, 38, 96, - 38, 50, 38, 38, 97, 90, 60, 61, 91, 62, - 63, 88, 89, 64, 38, 38, 90, 60, 61, 91, - 62, 63, 88, 89, 64, 66, 98, 68, 71, 72, - - 49, 71, 66, 66, 101, 102, 66, 98, 66, 66, - 103, 66, 104, 66, 66, 101, 102, 86, 40, 172, - 86, 103, 30, 104, 172, 66, 66, 67, 67, 68, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 69, 67, 67, 67, 67, 67, 67, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 67, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 41, 99, - 105, 41, 100, 106, 80, 46, 86, 80, 81, 86, - 99, 105, 82, 100, 106, 172, 172, 172, 85, 42, - 43, 172, 44, 107, 80, 46, 45, 80, 81, 172, - - 42, 43, 82, 44, 107, 172, 172, 45, 58, 80, - 46, 58, 80, 81, 172, 80, 46, 82, 80, 81, - 85, 172, 83, 82, 108, 83, 110, 109, 113, 60, - 61, 114, 62, 63, 115, 108, 64, 110, 109, 113, - 60, 61, 114, 62, 63, 115, 84, 64, 66, 111, - 68, 172, 118, 172, 112, 66, 66, 84, 119, 66, - 111, 66, 66, 118, 66, 112, 66, 66, 96, 119, - 120, 96, 121, 122, 123, 124, 97, 125, 66, 66, - 126, 120, 127, 121, 122, 123, 124, 128, 125, 129, - 130, 126, 131, 127, 132, 133, 134, 135, 128, 138, - - 129, 130, 139, 131, 140, 132, 133, 134, 135, 141, - 138, 142, 143, 139, 144, 140, 145, 146, 147, 148, - 141, 149, 142, 143, 151, 144, 154, 145, 146, 147, - 148, 150, 149, 155, 150, 151, 156, 154, 157, 158, - 159, 160, 150, 85, 155, 150, 164, 156, 165, 157, - 158, 159, 160, 166, 85, 167, 172, 164, 168, 165, - 168, 168, 172, 168, 166, 172, 167, 172, 172, 172, - 172, 172, 172, 169, 172, 169, 33, 33, 33, 33, - 33, 33, 33, 38, 172, 172, 172, 38, 38, 39, - 39, 39, 39, 39, 39, 39, 52, 172, 52, 67, - - 67, 67, 67, 67, 67, 67, 79, 79, 79, 79, - 79, 79, 79, 161, 161, 161, 172, 161, 161, 161, - 163, 172, 163, 172, 163, 163, 163, 170, 170, 170, - 170, 170, 172, 170, 11, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172 + 25, 25, 25, 25, 26, 25, 27, 25, 28, 25, + 25, 25, 25, 25, 29, 30, 31, 25, 25, 26, + 25, 27, 25, 25, 25, 29, 32, 32, 57, 32, + 32, 38, 33, 33, 32, 34, 197, 32, 39, 40, + 33, 38, 57, 38, 35, 186, 186, 41, 39, 40, + 39, 58, 60, 38, 81, 36, 36, 41, 50, 50, + 39, 50, 51, 181, 60, 58, 52, 175, 86, 81, + 36, 36, 45, 61, 62, 45, 61, 64, 79, 80, + + 64, 79, 86, 65, 82, 174, 83, 93, 84, 156, + 155, 144, 85, 96, 46, 47, 97, 48, 100, 82, + 83, 106, 93, 84, 91, 49, 85, 91, 96, 46, + 47, 97, 48, 100, 133, 106, 49, 42, 50, 50, + 119, 50, 51, 132, 42, 42, 52, 105, 42, 92, + 63, 42, 94, 42, 119, 42, 42, 88, 50, 122, + 88, 89, 105, 95, 92, 90, 108, 94, 61, 62, + 122, 61, 42, 63, 42, 66, 109, 64, 66, 109, + 64, 42, 42, 65, 110, 42, 99, 67, 42, 99, + 42, 99, 42, 42, 99, 76, 111, 68, 69, 114, + + 70, 71, 101, 67, 102, 107, 117, 44, 72, 42, + 42, 111, 68, 69, 114, 70, 71, 101, 102, 72, + 74, 117, 76, 79, 80, 103, 79, 74, 74, 104, + 118, 74, 120, 74, 74, 112, 74, 121, 74, 74, + 103, 113, 78, 104, 73, 118, 109, 120, 59, 109, + 112, 55, 121, 113, 110, 74, 74, 75, 75, 76, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 77, 75, 75, 75, 75, 75, 75, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 75, 77, 77, 77, 77, 77, 77, 77, + + 77, 77, 77, 45, 115, 123, 45, 130, 88, 50, + 116, 88, 89, 157, 88, 50, 90, 88, 89, 115, + 123, 130, 90, 126, 116, 46, 47, 157, 48, 88, + 50, 129, 88, 89, 143, 54, 49, 90, 126, 91, + 46, 47, 91, 48, 131, 143, 129, 49, 66, 88, + 50, 66, 88, 89, 161, 99, 53, 90, 99, 131, + 98, 134, 124, 127, 92, 161, 44, 98, 125, 128, + 68, 69, 135, 70, 71, 136, 134, 124, 127, 92, + 125, 72, 137, 128, 138, 68, 69, 135, 70, 71, + 136, 198, 72, 74, 34, 76, 198, 137, 139, 138, + + 74, 74, 140, 141, 74, 142, 74, 74, 145, 74, + 146, 74, 74, 139, 198, 147, 148, 140, 141, 149, + 142, 150, 151, 145, 152, 146, 153, 154, 74, 74, + 147, 148, 158, 159, 149, 160, 150, 151, 162, 152, + 163, 153, 154, 164, 165, 166, 168, 158, 159, 167, + 160, 169, 170, 162, 171, 163, 198, 173, 164, 165, + 166, 168, 176, 167, 177, 171, 169, 170, 172, 178, + 179, 172, 173, 180, 182, 183, 184, 176, 188, 177, + 98, 179, 172, 189, 178, 172, 190, 191, 180, 182, + 183, 184, 192, 188, 98, 193, 194, 194, 189, 194, + + 194, 190, 191, 198, 198, 198, 198, 192, 198, 198, + 193, 195, 195, 37, 37, 37, 37, 37, 37, 37, + 42, 198, 198, 198, 42, 42, 43, 43, 43, 43, + 43, 43, 43, 56, 198, 56, 75, 75, 75, 75, + 75, 75, 75, 87, 87, 87, 87, 87, 87, 87, + 185, 185, 185, 198, 185, 185, 185, 187, 198, 187, + 198, 187, 187, 187, 196, 196, 196, 196, 196, 198, + 196, 11, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198 } ; -static yyconst flex_int16_t yy_chk[577] = +static yyconst flex_int16_t yy_chk[619] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 4, 170, 2, 4, 7, 2, 4, 6, - 6, 137, 6, 7, 7, 6, 8, 42, 9, 6, - 136, 45, 9, 8, 8, 9, 60, 10, 42, 6, - 6, 10, 45, 63, 10, 18, 18, 60, 18, 18, - 6, 6, 17, 18, 63, 17, 26, 26, 28, 26, - 117, 28, 35, 35, 28, 35, 43, 43, 44, 53, - - 53, 44, 53, 17, 17, 116, 17, 43, 43, 44, - 17, 95, 44, 51, 17, 17, 51, 17, 152, 152, - 94, 17, 27, 46, 46, 70, 46, 46, 64, 27, - 27, 46, 67, 27, 65, 27, 27, 51, 27, 64, - 27, 27, 47, 47, 59, 47, 47, 59, 51, 39, - 47, 34, 27, 27, 29, 29, 59, 56, 29, 30, - 56, 29, 29, 56, 24, 29, 72, 29, 29, 72, - 29, 23, 29, 29, 72, 62, 29, 29, 62, 29, - 29, 61, 61, 29, 29, 29, 62, 29, 29, 62, - 29, 29, 61, 61, 29, 31, 73, 31, 71, 71, - - 21, 71, 31, 31, 75, 76, 31, 73, 31, 31, - 76, 31, 77, 31, 31, 75, 76, 86, 15, 11, - 86, 76, 5, 77, 0, 31, 31, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 41, 74, - 78, 41, 74, 84, 79, 79, 85, 79, 79, 85, - 74, 78, 79, 74, 84, 0, 0, 0, 85, 41, - 41, 0, 41, 87, 80, 80, 41, 80, 80, 0, - - 41, 41, 80, 41, 87, 0, 0, 41, 57, 81, - 81, 57, 81, 81, 0, 82, 82, 81, 82, 82, - 57, 0, 83, 82, 88, 83, 89, 88, 91, 57, - 57, 92, 57, 57, 93, 88, 57, 89, 88, 91, - 57, 57, 92, 57, 57, 93, 83, 57, 66, 90, - 66, 0, 98, 0, 90, 66, 66, 83, 99, 66, - 90, 66, 66, 98, 66, 90, 66, 66, 96, 99, - 100, 96, 101, 102, 103, 104, 96, 105, 66, 66, - 106, 100, 107, 101, 102, 103, 104, 108, 105, 109, - 110, 106, 111, 107, 112, 113, 114, 115, 108, 118, - - 109, 110, 121, 111, 122, 112, 113, 114, 115, 123, - 118, 124, 125, 121, 126, 122, 127, 130, 131, 132, - 123, 133, 124, 125, 135, 126, 138, 127, 130, 131, - 132, 134, 133, 141, 134, 135, 142, 138, 144, 145, - 148, 149, 150, 134, 141, 150, 156, 142, 157, 144, - 145, 148, 149, 160, 150, 165, 0, 156, 166, 157, - 168, 166, 0, 168, 160, 0, 165, 0, 0, 0, - 0, 0, 0, 166, 0, 168, 173, 173, 173, 173, - 173, 173, 173, 174, 0, 0, 0, 174, 174, 175, - 175, 175, 175, 175, 175, 175, 176, 0, 176, 177, - - 177, 177, 177, 177, 177, 177, 178, 178, 178, 178, - 178, 178, 178, 179, 179, 179, 0, 179, 179, 179, - 180, 0, 180, 0, 180, 180, 180, 181, 181, 181, - 181, 181, 0, 181, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172 + 1, 1, 1, 1, 1, 1, 2, 4, 26, 2, + 4, 7, 2, 4, 6, 6, 196, 6, 7, 7, + 6, 8, 26, 9, 6, 174, 174, 9, 8, 8, + 9, 27, 29, 10, 46, 6, 6, 10, 18, 18, + 10, 18, 18, 165, 29, 27, 18, 156, 49, 46, + 6, 6, 17, 30, 30, 17, 30, 32, 39, 39, + + 32, 39, 49, 32, 47, 155, 47, 57, 48, 133, + 132, 121, 48, 59, 17, 17, 60, 17, 68, 47, + 47, 72, 57, 48, 55, 17, 48, 55, 59, 17, + 17, 60, 17, 68, 108, 72, 17, 31, 50, 50, + 92, 50, 50, 107, 31, 31, 50, 71, 31, 55, + 31, 31, 58, 31, 92, 31, 31, 51, 51, 96, + 51, 51, 71, 58, 55, 51, 78, 58, 61, 61, + 96, 61, 31, 31, 33, 33, 80, 64, 33, 80, + 64, 33, 33, 64, 80, 33, 99, 33, 33, 99, + 33, 67, 33, 33, 67, 75, 81, 33, 33, 83, + + 33, 33, 69, 67, 69, 73, 85, 43, 33, 33, + 33, 81, 33, 33, 83, 33, 33, 69, 69, 33, + 35, 85, 35, 79, 79, 70, 79, 35, 35, 70, + 86, 35, 94, 35, 35, 82, 35, 95, 35, 35, + 70, 82, 38, 70, 34, 86, 109, 94, 28, 109, + 82, 24, 95, 82, 109, 35, 35, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + + 36, 36, 36, 45, 84, 100, 45, 105, 87, 87, + 84, 87, 87, 134, 88, 88, 87, 88, 88, 84, + 100, 105, 88, 102, 84, 45, 45, 134, 45, 89, + 89, 104, 89, 89, 120, 23, 45, 89, 102, 91, + 45, 45, 91, 45, 106, 120, 104, 45, 65, 90, + 90, 65, 90, 90, 140, 98, 21, 90, 98, 106, + 65, 111, 101, 103, 91, 140, 15, 98, 101, 103, + 65, 65, 112, 65, 65, 113, 111, 101, 103, 91, + 101, 65, 114, 103, 115, 65, 65, 112, 65, 65, + 113, 11, 65, 74, 5, 74, 0, 114, 116, 115, + + 74, 74, 117, 118, 74, 119, 74, 74, 122, 74, + 123, 74, 74, 116, 0, 124, 125, 117, 118, 126, + 119, 127, 128, 122, 129, 123, 130, 131, 74, 74, + 124, 125, 137, 138, 126, 139, 127, 128, 141, 129, + 142, 130, 131, 143, 144, 145, 149, 137, 138, 146, + 139, 150, 151, 141, 152, 142, 0, 154, 143, 144, + 145, 149, 157, 146, 160, 152, 150, 151, 153, 161, + 163, 153, 154, 164, 167, 170, 171, 157, 178, 160, + 153, 163, 172, 179, 161, 172, 181, 184, 164, 167, + 170, 171, 189, 178, 172, 190, 191, 194, 179, 191, + + 194, 181, 184, 0, 0, 0, 0, 189, 0, 0, + 190, 191, 194, 199, 199, 199, 199, 199, 199, 199, + 200, 0, 0, 0, 200, 200, 201, 201, 201, 201, + 201, 201, 201, 202, 0, 202, 203, 203, 203, 203, + 203, 203, 203, 204, 204, 204, 204, 204, 204, 204, + 205, 205, 205, 0, 205, 205, 205, 206, 0, 206, + 0, 206, 206, 206, 207, 207, 207, 207, 207, 0, + 207, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198 } ; /* The intent behind this definition is that it'll catch @@ -636,7 +632,7 @@ static yyconst flex_int16_t yy_chk[577] = #line 2 "cmFortranLexer.in.l" /*============================================================================ CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium Distributed under the OSI-approved BSD License (the "License"); see accompanying file Copyright.txt for details. @@ -659,28 +655,21 @@ static yyconst flex_int16_t yy_chk[577] = This file must be translated to C and modified to build everywhere. -Run flex like this: +Run flex >= 2.6 like this: flex -i --prefix=cmFortran_yy --header-file=cmFortranLexer.h -ocmFortranLexer.cxx cmFortranLexer.in.l Modify cmFortranLexer.cxx: - - remove TABs - - remove use of the 'register' storage class specifier - - remove "yyscanner" argument from these methods: - yy_fatal_error, cmFortran_yyalloc, cmFortran_yyrealloc, cmFortran_yyfree + - remove trailing whitespace: sed -i 's/\s*$//' cmFortranLexer.h cmFortranLexer.cxx + - remove blank lines at end of file - remove "yyscanner = NULL" from end of cmFortran_yylex_destroy - remove all YY_BREAK lines occurring right after return statements - - change while ( 1 ) to for(;;) - -Modify cmFortranLexer.h: - - remove TABs - - remove the yy_init_globals function - - remove the block that includes unistd.h - - remove #line directives (avoids bogus warning on old Sun) + - add cast in cmFortran_yy_scan_bytes for loop condition of _yybytes_len to size_t */ #include "cmStandardLexer.h" +#undef YY_NO_UNPUT #define cmFortranLexer_cxx #include "cmFortranParser.h" /* Interface to parser object. */ @@ -729,8 +718,8 @@ struct yyguts_t size_t yy_buffer_stack_max; /**< capacity of stack. */ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ char yy_hold_char; - yy_size_t yy_n_chars; - yy_size_t yyleng_r; + int yy_n_chars; + int yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; @@ -771,23 +760,23 @@ void cmFortran_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); FILE *cmFortran_yyget_in (yyscan_t yyscanner ); -void cmFortran_yyset_in (FILE * in_str ,yyscan_t yyscanner ); +void cmFortran_yyset_in (FILE * _in_str ,yyscan_t yyscanner ); FILE *cmFortran_yyget_out (yyscan_t yyscanner ); -void cmFortran_yyset_out (FILE * out_str ,yyscan_t yyscanner ); +void cmFortran_yyset_out (FILE * _out_str ,yyscan_t yyscanner ); -yy_size_t cmFortran_yyget_leng (yyscan_t yyscanner ); + int cmFortran_yyget_leng (yyscan_t yyscanner ); char *cmFortran_yyget_text (yyscan_t yyscanner ); int cmFortran_yyget_lineno (yyscan_t yyscanner ); -void cmFortran_yyset_lineno (int line_number ,yyscan_t yyscanner ); +void cmFortran_yyset_lineno (int _line_number ,yyscan_t yyscanner ); int cmFortran_yyget_column (yyscan_t yyscanner ); -void cmFortran_yyset_column (int column_no ,yyscan_t yyscanner ); +void cmFortran_yyset_column (int _column_no ,yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -801,8 +790,12 @@ extern int cmFortran_yywrap (yyscan_t yyscanner ); #endif #endif +#ifndef YY_NO_UNPUT + static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner); +#endif + #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); #endif @@ -836,7 +829,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -844,33 +837,33 @@ static int input (yyscan_t yyscanner ); */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ \ #endif @@ -915,135 +908,135 @@ extern int cmFortran_yylex (yyscan_t yyscanner); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ - if ( yyleng > 0 ) \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ - (yytext[yyleng - 1] == '\n'); \ - YY_USER_ACTION + if ( yyleng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (yytext[yyleng - 1] == '\n'); \ + YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if ( !yyg->yy_init ) - { - yyg->yy_init = 1; + if ( !yyg->yy_init ) + { + yyg->yy_init = 1; #ifdef YY_USER_INIT - YY_USER_INIT; + YY_USER_INIT; #endif - if ( ! yyg->yy_start ) - yyg->yy_start = 1; /* first start state */ + if ( ! yyg->yy_start ) + yyg->yy_start = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if ( ! yyin ) + yyin = stdin; - if ( ! yyout ) - yyout = stdout; + if ( ! yyout ) + yyout = stdout; - if ( ! YY_CURRENT_BUFFER ) { - cmFortran_yyensure_buffer_stack (yyscanner); - YY_CURRENT_BUFFER_LVALUE = - cmFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); - } + if ( ! YY_CURRENT_BUFFER ) { + cmFortran_yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + cmFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } - cmFortran_yy_load_buffer_state(yyscanner ); - } + cmFortran_yy_load_buffer_state(yyscanner ); + } - { -#line 72 "cmFortranLexer.in.l" + { +#line 65 "cmFortranLexer.in.l" -#line 956 "cmFortranLexer.cxx" +#line 960 "cmFortranLexer.cxx" - for(;;) /* loops until end-of-file is reached */ - { - yy_cp = yyg->yy_c_buf_p; + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + { + yy_cp = yyg->yy_c_buf_p; - /* Support of yytext. */ - *yy_cp = yyg->yy_hold_char; + /* Support of yytext. */ + *yy_cp = yyg->yy_hold_char; - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; - yy_current_state = yyg->yy_start; - yy_current_state += YY_AT_BOL(); + yy_current_state = yyg->yy_start; + yy_current_state += YY_AT_BOL(); yy_match: - do - { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; - if ( yy_accept[yy_current_state] ) - { - yyg->yy_last_accepting_state = yy_current_state; - yyg->yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 173 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 535 ); + do + { + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 199 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 572 ); yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yyg->yy_last_accepting_cpos; - yy_current_state = yyg->yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yyg->yy_hold_char; - yy_cp = yyg->yy_last_accepting_cpos; - yy_current_state = yyg->yy_last_accepting_state; - goto yy_find_action; + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yyg->yy_hold_char; + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; case 1: YY_RULE_SETUP -#line 74 "cmFortranLexer.in.l" +#line 67 "cmFortranLexer.in.l" { cmFortranParser_StringStart(yyextra); cmFortranParser_SetOldStartcond(yyextra, YY_START); BEGIN(str_dq); } - YY_BREAK + YY_BREAK case 2: YY_RULE_SETUP -#line 80 "cmFortranLexer.in.l" +#line 73 "cmFortranLexer.in.l" { cmFortranParser_StringStart(yyextra); cmFortranParser_SetOldStartcond(yyextra, YY_START); BEGIN(str_sq); } - YY_BREAK + YY_BREAK case 3: -#line 87 "cmFortranLexer.in.l" +#line 80 "cmFortranLexer.in.l" case 4: YY_RULE_SETUP -#line 87 "cmFortranLexer.in.l" +#line 80 "cmFortranLexer.in.l" { BEGIN(cmFortranParser_GetOldStartcond(yyextra) ); yylvalp->string = strdup(cmFortranParser_StringEnd(yyextra)); @@ -1051,17 +1044,17 @@ YY_RULE_SETUP } case 5: /* rule 5 can match eol */ -#line 94 "cmFortranLexer.in.l" +#line 87 "cmFortranLexer.in.l" case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 94 "cmFortranLexer.in.l" +#line 87 "cmFortranLexer.in.l" /* Ignore (continued strings, free fmt) */ - YY_BREAK + YY_BREAK case 7: /* rule 7 can match eol */ YY_RULE_SETUP -#line 96 "cmFortranLexer.in.l" +#line 89 "cmFortranLexer.in.l" { if (cmFortranParser_GetOldStartcond(yyextra) == fixed_fmt) ; /* Ignore (cont. strings, fixed fmt) */ @@ -1070,11 +1063,11 @@ YY_RULE_SETUP unput(yytext[strlen(yytext)-1]); } } - YY_BREAK + YY_BREAK case 8: /* rule 8 can match eol */ YY_RULE_SETUP -#line 106 "cmFortranLexer.in.l" +#line 99 "cmFortranLexer.in.l" { unput ('\n'); BEGIN(INITIAL); @@ -1082,29 +1075,29 @@ YY_RULE_SETUP } case 9: YY_RULE_SETUP -#line 112 "cmFortranLexer.in.l" +#line 105 "cmFortranLexer.in.l" { cmFortranParser_StringAppend(yyextra, yytext[0]); } - YY_BREAK + YY_BREAK case 10: /* rule 10 can match eol */ YY_RULE_SETUP -#line 116 "cmFortranLexer.in.l" +#line 109 "cmFortranLexer.in.l" { return EOSTMT; } /* Treat comments like */ case 11: /* rule 11 can match eol */ YY_RULE_SETUP -#line 117 "cmFortranLexer.in.l" +#line 110 "cmFortranLexer.in.l" { return EOSTMT; } /* empty lines */ case 12: YY_RULE_SETUP -#line 119 "cmFortranLexer.in.l" +#line 112 "cmFortranLexer.in.l" { return CPP_LINE_DIRECTIVE; } case 13: /* rule 13 can match eol */ YY_RULE_SETUP -#line 120 "cmFortranLexer.in.l" +#line 113 "cmFortranLexer.in.l" { yytext[yyleng-1] = 0; yylvalp->string = strdup(strchr(yytext, '<')+1); @@ -1112,530 +1105,554 @@ YY_RULE_SETUP } case 14: YY_RULE_SETUP -#line 125 "cmFortranLexer.in.l" +#line 118 "cmFortranLexer.in.l" { return CPP_INCLUDE; } case 15: YY_RULE_SETUP -#line 126 "cmFortranLexer.in.l" +#line 119 "cmFortranLexer.in.l" { return F90PPR_INCLUDE; } case 16: YY_RULE_SETUP -#line 127 "cmFortranLexer.in.l" +#line 120 "cmFortranLexer.in.l" { return COCO_INCLUDE; } case 17: YY_RULE_SETUP -#line 129 "cmFortranLexer.in.l" +#line 122 "cmFortranLexer.in.l" { return CPP_DEFINE; } case 18: YY_RULE_SETUP -#line 130 "cmFortranLexer.in.l" +#line 123 "cmFortranLexer.in.l" { return F90PPR_DEFINE; } case 19: YY_RULE_SETUP -#line 132 "cmFortranLexer.in.l" +#line 125 "cmFortranLexer.in.l" { return CPP_UNDEF; } case 20: YY_RULE_SETUP -#line 133 "cmFortranLexer.in.l" +#line 126 "cmFortranLexer.in.l" { return F90PPR_UNDEF; } case 21: YY_RULE_SETUP -#line 135 "cmFortranLexer.in.l" +#line 128 "cmFortranLexer.in.l" { return CPP_IFDEF; } case 22: YY_RULE_SETUP -#line 136 "cmFortranLexer.in.l" +#line 129 "cmFortranLexer.in.l" { return CPP_IFNDEF; } case 23: YY_RULE_SETUP -#line 137 "cmFortranLexer.in.l" +#line 130 "cmFortranLexer.in.l" { return CPP_IF; } case 24: YY_RULE_SETUP -#line 138 "cmFortranLexer.in.l" +#line 131 "cmFortranLexer.in.l" { return CPP_ELIF; } case 25: YY_RULE_SETUP -#line 139 "cmFortranLexer.in.l" +#line 132 "cmFortranLexer.in.l" { return CPP_ELSE; } case 26: YY_RULE_SETUP -#line 140 "cmFortranLexer.in.l" +#line 133 "cmFortranLexer.in.l" { return CPP_ENDIF; } case 27: YY_RULE_SETUP -#line 142 "cmFortranLexer.in.l" +#line 135 "cmFortranLexer.in.l" { return F90PPR_IFDEF; } case 28: YY_RULE_SETUP -#line 143 "cmFortranLexer.in.l" +#line 136 "cmFortranLexer.in.l" { return F90PPR_IFNDEF; } case 29: YY_RULE_SETUP -#line 144 "cmFortranLexer.in.l" +#line 137 "cmFortranLexer.in.l" { return F90PPR_IF; } case 30: YY_RULE_SETUP -#line 145 "cmFortranLexer.in.l" +#line 138 "cmFortranLexer.in.l" { return F90PPR_ELIF; } case 31: YY_RULE_SETUP -#line 146 "cmFortranLexer.in.l" +#line 139 "cmFortranLexer.in.l" { return F90PPR_ELSE; } case 32: YY_RULE_SETUP -#line 147 "cmFortranLexer.in.l" +#line 140 "cmFortranLexer.in.l" { return F90PPR_ENDIF; } /* Line continuations, possible involving comments. */ case 33: /* rule 33 can match eol */ YY_RULE_SETUP -#line 150 "cmFortranLexer.in.l" +#line 143 "cmFortranLexer.in.l" - YY_BREAK + YY_BREAK case 34: /* rule 34 can match eol */ YY_RULE_SETUP -#line 151 "cmFortranLexer.in.l" +#line 144 "cmFortranLexer.in.l" - YY_BREAK + YY_BREAK case 35: YY_RULE_SETUP -#line 153 "cmFortranLexer.in.l" +#line 146 "cmFortranLexer.in.l" { return COMMA; } case 36: YY_RULE_SETUP -#line 155 "cmFortranLexer.in.l" +#line 148 "cmFortranLexer.in.l" { return DCOLON; } case 37: /* rule 37 can match eol */ YY_RULE_SETUP -#line 157 "cmFortranLexer.in.l" +#line 150 "cmFortranLexer.in.l" { return GARBAGE; } case 38: YY_RULE_SETUP -#line 159 "cmFortranLexer.in.l" +#line 152 "cmFortranLexer.in.l" { return ASSIGNMENT_OP; } case 39: YY_RULE_SETUP -#line 161 "cmFortranLexer.in.l" +#line 154 "cmFortranLexer.in.l" +{ return END; } +case 40: +YY_RULE_SETUP +#line 155 "cmFortranLexer.in.l" +{ return INCLUDE; } +case 41: +YY_RULE_SETUP +#line 156 "cmFortranLexer.in.l" +{ return INTERFACE; } +case 42: +YY_RULE_SETUP +#line 157 "cmFortranLexer.in.l" +{ return MODULE; } +case 43: +YY_RULE_SETUP +#line 158 "cmFortranLexer.in.l" +{ return USE; } +case 44: +YY_RULE_SETUP +#line 160 "cmFortranLexer.in.l" { yylvalp->string = strdup(yytext); return WORD; } -case 40: +case 45: YY_RULE_SETUP -#line 166 "cmFortranLexer.in.l" +#line 165 "cmFortranLexer.in.l" { return GARBAGE; } -case 41: -/* rule 41 can match eol */ +case 46: +/* rule 46 can match eol */ YY_RULE_SETUP -#line 168 "cmFortranLexer.in.l" +#line 167 "cmFortranLexer.in.l" { return EOSTMT; } -case 42: +case 47: YY_RULE_SETUP -#line 171 "cmFortranLexer.in.l" +#line 170 "cmFortranLexer.in.l" /* Ignore */ - YY_BREAK -case 43: -/* rule 43 can match eol */ + YY_BREAK +case 48: +/* rule 48 can match eol */ YY_RULE_SETUP -#line 172 "cmFortranLexer.in.l" +#line 171 "cmFortranLexer.in.l" /* Ignore line-endings preceded by \ */ - YY_BREAK -case 44: + YY_BREAK +case 49: YY_RULE_SETUP -#line 174 "cmFortranLexer.in.l" +#line 173 "cmFortranLexer.in.l" { return *yytext; } case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(free_fmt): case YY_STATE_EOF(fixed_fmt): case YY_STATE_EOF(str_sq): case YY_STATE_EOF(str_dq): -#line 176 "cmFortranLexer.in.l" +#line 175 "cmFortranLexer.in.l" { if(!cmFortranParser_FilePop(yyextra) ) { return YY_NULL; } } - YY_BREAK -case 45: + YY_BREAK +case 50: YY_RULE_SETUP -#line 183 "cmFortranLexer.in.l" +#line 182 "cmFortranLexer.in.l" ECHO; - YY_BREAK -#line 1291 "cmFortranLexer.cxx" - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yyg->yy_hold_char; - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * cmFortran_yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( yyscanner ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); - - yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yyg->yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = yyg->yy_c_buf_p; - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( yyscanner ) ) - { - case EOB_ACT_END_OF_FILE: - { - yyg->yy_did_buffer_switch_on_eof = 0; - - if ( cmFortran_yywrap(yyscanner ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yyg->yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yyg->yy_c_buf_p = - yyg->yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( yyscanner ); - - yy_cp = yyg->yy_c_buf_p; - yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yyg->yy_c_buf_p = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; - - yy_current_state = yy_get_previous_state( yyscanner ); - - yy_cp = yyg->yy_c_buf_p; - yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of user's declarations */ + YY_BREAK +#line 1320 "cmFortranLexer.cxx" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * cmFortran_yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); + + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yyg->yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yyg->yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_END_OF_FILE: + { + yyg->yy_did_buffer_switch_on_eof = 0; + + if ( cmFortran_yywrap(yyscanner ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = + yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of cmFortran_yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char *source = yyg->yytext_ptr; - int number_to_move, i; - int ret_val; - - if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; - - else - { - yy_size_t num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; - - int yy_c_buf_p_offset = - (int) (yyg->yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - yy_size_t new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - cmFortran_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - yyg->yy_n_chars, num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; - } - - if ( yyg->yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - cmFortran_yyrestart(yyin ,yyscanner); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) cmFortran_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - } - - yyg->yy_n_chars += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = yyg->yytext_ptr; + yy_size_t number_to_move, i; + int ret_val; + + if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + + int yy_c_buf_p_offset = + (int) (yyg->yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + cmFortran_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = NULL; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + yyg->yy_n_chars, num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if ( yyg->yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + cmFortran_yyrestart(yyin ,yyscanner); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((int) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) cmFortran_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - return ret_val; + return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (yyscan_t yyscanner) { - yy_state_type yy_current_state; - char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yy_current_state = yyg->yy_start; - yy_current_state += YY_AT_BOL(); - - for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) - { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - yyg->yy_last_accepting_state = yy_current_state; - yyg->yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 173 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; + yy_current_state = yyg->yy_start; + yy_current_state += YY_AT_BOL(); + + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) + { + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 199 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; + } + + return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis - * next_state = yy_try_NUL_trans( current_state ); + * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) { - int yy_is_jam; + int yy_is_jam; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ - char *yy_cp = yyg->yy_c_buf_p; - - YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yyg->yy_last_accepting_state = yy_current_state; - yyg->yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 173 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 172); - - (void)yyg; - return yy_is_jam ? 0 : yy_current_state; + char *yy_cp = yyg->yy_c_buf_p; + + YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 199 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; + yy_is_jam = (yy_current_state == 198); + + (void)yyg; + return yy_is_jam ? 0 : yy_current_state; } +#ifndef YY_NO_UNPUT + static void yyunput (int c, char * yy_bp , yyscan_t yyscanner) { - char *yy_cp; + char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_cp = yyg->yy_c_buf_p; - /* undo effects of setting up yytext */ - *yy_cp = yyg->yy_hold_char; + /* undo effects of setting up yytext */ + *yy_cp = yyg->yy_hold_char; - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - yy_size_t number_to_move = yyg->yy_n_chars + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + int number_to_move = yyg->yy_n_chars + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + yyg->yy_n_chars = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } - *--yy_cp = (char) c; + *--yy_cp = (char) c; - yyg->yytext_ptr = yy_bp; - yyg->yy_hold_char = *yy_cp; - yyg->yy_c_buf_p = yy_cp; + yyg->yytext_ptr = yy_bp; + yyg->yy_hold_char = *yy_cp; + yyg->yy_c_buf_p = yy_cp; } +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (yyscan_t yyscanner) @@ -1644,74 +1661,74 @@ static int yy_get_next_buffer (yyscan_t yyscanner) #endif { - int c; + int c; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - *yyg->yy_c_buf_p = yyg->yy_hold_char; - - if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) - /* This was really a NUL. */ - *yyg->yy_c_buf_p = '\0'; - - else - { /* need more input */ - yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; - ++yyg->yy_c_buf_p; - - switch ( yy_get_next_buffer( yyscanner ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - cmFortran_yyrestart(yyin ,yyscanner); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( cmFortran_yywrap(yyscanner ) ) - return EOF; - - if ( ! yyg->yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; + *yyg->yy_c_buf_p = yyg->yy_hold_char; + + if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + ++yyg->yy_c_buf_p; + + switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + cmFortran_yyrestart(yyin ,yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( cmFortran_yywrap(yyscanner ) ) + return 0; + + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; #ifdef __cplusplus - return yyinput(yyscanner); + return yyinput(yyscanner); #else - return input(yyscanner); + return input(yyscanner); #endif - } + } - case EOB_ACT_CONTINUE_SCAN: - yyg->yy_c_buf_p = yyg->yytext_ptr + offset; - break; - } - } - } + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = yyg->yytext_ptr + offset; + break; + } + } + } - c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ - *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ - yyg->yy_hold_char = *++yyg->yy_c_buf_p; + c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ + yyg->yy_hold_char = *++yyg->yy_c_buf_p; - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); - return c; + return c; } -#endif /* ifndef YY_NO_INPUT */ +#endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. @@ -1722,14 +1739,14 @@ static int yy_get_next_buffer (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if ( ! YY_CURRENT_BUFFER ){ + if ( ! YY_CURRENT_BUFFER ){ cmFortran_yyensure_buffer_stack (yyscanner); - YY_CURRENT_BUFFER_LVALUE = + YY_CURRENT_BUFFER_LVALUE = cmFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); - } + } - cmFortran_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); - cmFortran_yy_load_buffer_state(yyscanner ); + cmFortran_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + cmFortran_yy_load_buffer_state(yyscanner ); } /** Switch to a different input buffer. @@ -1740,41 +1757,41 @@ static int yy_get_next_buffer (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - /* TODO. We should be able to replace this entire function body - * with - * cmFortran_yypop_buffer_state(); - * cmFortran_yypush_buffer_state(new_buffer); + /* TODO. We should be able to replace this entire function body + * with + * cmFortran_yypop_buffer_state(); + * cmFortran_yypush_buffer_state(new_buffer); */ - cmFortran_yyensure_buffer_stack (yyscanner); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *yyg->yy_c_buf_p = yyg->yy_hold_char; - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - cmFortran_yy_load_buffer_state(yyscanner ); - - /* We don't actually know whether we did this switch during - * EOF (cmFortran_yywrap()) processing, but the only time this flag - * is looked at is after cmFortran_yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yyg->yy_did_buffer_switch_on_eof = 1; + cmFortran_yyensure_buffer_stack (yyscanner); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + cmFortran_yy_load_buffer_state(yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (cmFortran_yywrap()) processing, but the only time this flag + * is looked at is after cmFortran_yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; } static void cmFortran_yy_load_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - yyg->yy_hold_char = *yyg->yy_c_buf_p; + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyg->yy_hold_char = *yyg->yy_c_buf_p; } /** Allocate and initialize an input buffer state. @@ -1785,26 +1802,26 @@ static void cmFortran_yy_load_buffer_state (yyscan_t yyscanner) */ YY_BUFFER_STATE cmFortran_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) { - YY_BUFFER_STATE b; + YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) cmFortran_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_create_buffer()" ); + b = (YY_BUFFER_STATE) cmFortran_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_create_buffer()" ); - b->yy_buf_size = size; + b->yy_buf_size = (yy_size_t)size; - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) cmFortran_yyalloc(b->yy_buf_size + 2 ,yyscanner ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_create_buffer()" ); + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) cmFortran_yyalloc(b->yy_buf_size + 2 ,yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_create_buffer()" ); - b->yy_is_our_buffer = 1; + b->yy_is_our_buffer = 1; - cmFortran_yy_init_buffer(b,file ,yyscanner); + cmFortran_yy_init_buffer(b,file ,yyscanner); - return b; + return b; } /** Destroy the buffer. @@ -1815,16 +1832,16 @@ static void cmFortran_yy_load_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if ( ! b ) - return; + if ( ! b ) + return; - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - if ( b->yy_is_our_buffer ) - cmFortran_yyfree((void *) b->yy_ch_buf ,yyscanner ); + if ( b->yy_is_our_buffer ) + cmFortran_yyfree((void *) b->yy_ch_buf ,yyscanner ); - cmFortran_yyfree((void *) b ,yyscanner ); + cmFortran_yyfree((void *) b ,yyscanner ); } /* Initializes or reinitializes a buffer. @@ -1834,13 +1851,13 @@ static void cmFortran_yy_load_buffer_state (yyscan_t yyscanner) static void cmFortran_yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) { - int oerrno = errno; + int oerrno = errno; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - cmFortran_yy_flush_buffer(b ,yyscanner); + cmFortran_yy_flush_buffer(b ,yyscanner); - b->yy_input_file = file; - b->yy_fill_buffer = 1; + b->yy_input_file = file; + b->yy_fill_buffer = 1; /* If b is the current buffer, then cmFortran_yy_init_buffer was _probably_ * called from cmFortran_yyrestart() or through yy_get_next_buffer. @@ -1853,7 +1870,7 @@ static void cmFortran_yy_load_buffer_state (yyscan_t yyscanner) b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - errno = oerrno; + errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. @@ -1863,25 +1880,25 @@ static void cmFortran_yy_load_buffer_state (yyscan_t yyscanner) void cmFortran_yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if ( ! b ) - return; + if ( ! b ) + return; - b->yy_n_chars = 0; + b->yy_n_chars = 0; - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - b->yy_buf_pos = &b->yy_ch_buf[0]; + b->yy_buf_pos = &b->yy_ch_buf[0]; - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == YY_CURRENT_BUFFER ) - cmFortran_yy_load_buffer_state(yyscanner ); + if ( b == YY_CURRENT_BUFFER ) + cmFortran_yy_load_buffer_state(yyscanner ); } /** Pushes the new state onto the stack. The new state becomes @@ -1893,28 +1910,28 @@ static void cmFortran_yy_load_buffer_state (yyscan_t yyscanner) void cmFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if (new_buffer == NULL) - return; - - cmFortran_yyensure_buffer_stack(yyscanner); - - /* This block is copied from cmFortran_yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *yyg->yy_c_buf_p = yyg->yy_hold_char; - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - yyg->yy_buffer_stack_top++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from cmFortran_yy_switch_to_buffer. */ - cmFortran_yy_load_buffer_state(yyscanner ); - yyg->yy_did_buffer_switch_on_eof = 1; + if (new_buffer == NULL) + return; + + cmFortran_yyensure_buffer_stack(yyscanner); + + /* This block is copied from cmFortran_yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from cmFortran_yy_switch_to_buffer. */ + cmFortran_yy_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; } /** Removes and deletes the top of the stack, if present. @@ -1924,18 +1941,18 @@ void cmFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscan void cmFortran_yypop_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if (!YY_CURRENT_BUFFER) - return; - - cmFortran_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); - YY_CURRENT_BUFFER_LVALUE = NULL; - if (yyg->yy_buffer_stack_top > 0) - --yyg->yy_buffer_stack_top; - - if (YY_CURRENT_BUFFER) { - cmFortran_yy_load_buffer_state(yyscanner ); - yyg->yy_did_buffer_switch_on_eof = 1; - } + if (!YY_CURRENT_BUFFER) + return; + + cmFortran_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + cmFortran_yy_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } } /* Allocates the stack if it does not exist. @@ -1943,46 +1960,46 @@ void cmFortran_yypop_buffer_state (yyscan_t yyscanner) */ static void cmFortran_yyensure_buffer_stack (yyscan_t yyscanner) { - yy_size_t num_to_alloc; + int num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if (!yyg->yy_buffer_stack) { + if (!yyg->yy_buffer_stack) { - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. */ - num_to_alloc = 1; - yyg->yy_buffer_stack = (struct yy_buffer_state**)cmFortran_yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - , yyscanner); - if ( ! yyg->yy_buffer_stack ) - YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yyensure_buffer_stack()" ); - - memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - yyg->yy_buffer_stack_max = num_to_alloc; - yyg->yy_buffer_stack_top = 0; - return; - } - - if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = yyg->yy_buffer_stack_max + grow_size; - yyg->yy_buffer_stack = (struct yy_buffer_state**)cmFortran_yyrealloc - (yyg->yy_buffer_stack, - num_to_alloc * sizeof(struct yy_buffer_state*) - , yyscanner); - if ( ! yyg->yy_buffer_stack ) - YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yyensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); - yyg->yy_buffer_stack_max = num_to_alloc; - } + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + yyg->yy_buffer_stack = (struct yy_buffer_state**)cmFortran_yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yyensure_buffer_stack()" ); + + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + yyg->yy_buffer_stack_max = num_to_alloc; + yyg->yy_buffer_stack_top = 0; + return; + } + + if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + yy_size_t grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)cmFortran_yyrealloc + (yyg->yy_buffer_stack, + num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); + yyg->yy_buffer_stack_max = num_to_alloc; + } } /** Setup the input buffer state to scan directly from a user-specified character buffer. @@ -1993,31 +2010,31 @@ static void cmFortran_yyensure_buffer_stack (yyscan_t yyscanner) */ YY_BUFFER_STATE cmFortran_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) cmFortran_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - cmFortran_yy_switch_to_buffer(b ,yyscanner ); - - return b; + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return NULL; + + b = (YY_BUFFER_STATE) cmFortran_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = NULL; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + cmFortran_yy_switch_to_buffer(b ,yyscanner ); + + return b; } /** Setup the input buffer state to scan a string. The next call to cmFortran_yylex() will @@ -2031,7 +2048,7 @@ YY_BUFFER_STATE cmFortran_yy_scan_buffer (char * base, yy_size_t size , yyscan YY_BUFFER_STATE cmFortran_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) { - return cmFortran_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); + return cmFortran_yy_scan_bytes(yystr,(int) strlen(yystr) ,yyscanner); } /** Setup the input buffer state to scan the given bytes. The next call to cmFortran_yylex() will @@ -2041,62 +2058,64 @@ YY_BUFFER_STATE cmFortran_yy_scan_string (yyconst char * yystr , yyscan_t yyscan * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - yy_size_t i; + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + yy_size_t i; - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) cmFortran_yyalloc(n ,yyscanner ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_scan_bytes()" ); + /* Get memory for full buffer, including space for trailing EOB's. */ + n = (yy_size_t) _yybytes_len + 2; + buf = (char *) cmFortran_yyalloc(n ,yyscanner ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_scan_bytes()" ); - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; + for ( i = 0; i < (size_t)_yybytes_len; ++i ) + buf[i] = yybytes[i]; - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = cmFortran_yy_scan_buffer(buf,n ,yyscanner); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in cmFortran_yy_scan_bytes()" ); + b = cmFortran_yy_scan_buffer(buf,n ,yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in cmFortran_yy_scan_bytes()" ); - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; - return b; + return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg , yyscan_t) +static void yynoreturn yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = yyg->yy_hold_char; \ - yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ - yyg->yy_hold_char = *yyg->yy_c_buf_p; \ - *yyg->yy_c_buf_p = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) + yytext[yyleng] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ @@ -2156,7 +2175,7 @@ FILE *cmFortran_yyget_out (yyscan_t yyscanner) /** Get the length of the current token. * @param yyscanner The scanner object. */ -yy_size_t cmFortran_yyget_leng (yyscan_t yyscanner) +int cmFortran_yyget_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; @@ -2183,10 +2202,10 @@ void cmFortran_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) } /** Set the current line number. - * @param line_number The line number to set. + * @param _line_number line number * @param yyscanner The scanner object. */ -void cmFortran_yyset_lineno (int line_number , yyscan_t yyscanner) +void cmFortran_yyset_lineno (int _line_number , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -2194,14 +2213,14 @@ void cmFortran_yyset_lineno (int line_number , yyscan_t yyscanner) if (! YY_CURRENT_BUFFER ) YY_FATAL_ERROR( "cmFortran_yyset_lineno called with no buffer" ); - yylineno = line_number; + yylineno = _line_number; } /** Set the current column. - * @param column_no The column number to set. + * @param _column_no column number * @param yyscanner The scanner object. */ -void cmFortran_yyset_column (int column_no , yyscan_t yyscanner) +void cmFortran_yyset_column (int _column_no , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -2209,25 +2228,25 @@ void cmFortran_yyset_column (int column_no , yyscan_t yyscanner) if (! YY_CURRENT_BUFFER ) YY_FATAL_ERROR( "cmFortran_yyset_column called with no buffer" ); - yycolumn = column_no; + yycolumn = _column_no; } /** Set the input stream. This does not discard the current * input buffer. - * @param in_str A readable stream. + * @param _in_str A readable stream. * @param yyscanner The scanner object. * @see cmFortran_yy_switch_to_buffer */ -void cmFortran_yyset_in (FILE * in_str , yyscan_t yyscanner) +void cmFortran_yyset_in (FILE * _in_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyin = in_str ; + yyin = _in_str ; } -void cmFortran_yyset_out (FILE * out_str , yyscan_t yyscanner) +void cmFortran_yyset_out (FILE * _out_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyout = out_str ; + yyout = _out_str ; } int cmFortran_yyget_debug (yyscan_t yyscanner) @@ -2236,10 +2255,10 @@ int cmFortran_yyget_debug (yyscan_t yyscanner) return yy_flex_debug; } -void cmFortran_yyset_debug (int bdebug , yyscan_t yyscanner) +void cmFortran_yyset_debug (int _bdebug , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yy_flex_debug = bdebug ; + yy_flex_debug = _bdebug ; } /* Accessor methods for yylval and yylloc */ @@ -2315,10 +2334,10 @@ static int yy_init_globals (yyscan_t yyscanner) * This function is called from cmFortran_yylex_destroy(), so don't allocate here. */ - yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack = NULL; yyg->yy_buffer_stack_top = 0; yyg->yy_buffer_stack_max = 0; - yyg->yy_c_buf_p = (char *) 0; + yyg->yy_c_buf_p = NULL; yyg->yy_init = 0; yyg->yy_start = 0; @@ -2331,8 +2350,8 @@ static int yy_init_globals (yyscan_t yyscanner) yyin = stdin; yyout = stdout; #else - yyin = (FILE *) 0; - yyout = (FILE *) 0; + yyin = NULL; + yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by @@ -2347,15 +2366,15 @@ int cmFortran_yylex_destroy (yyscan_t yyscanner) struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - cmFortran_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); - YY_CURRENT_BUFFER_LVALUE = NULL; - cmFortran_yypop_buffer_state(yyscanner); - } + while(YY_CURRENT_BUFFER){ + cmFortran_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + cmFortran_yypop_buffer_state(yyscanner); + } - /* Destroy the stack itself. */ - cmFortran_yyfree(yyg->yy_buffer_stack ,yyscanner); - yyg->yy_buffer_stack = NULL; + /* Destroy the stack itself. */ + cmFortran_yyfree(yyg->yy_buffer_stack ,yyscanner); + yyg->yy_buffer_stack = NULL; /* Destroy the start condition stack. */ cmFortran_yyfree(yyg->yy_start_stack ,yyscanner ); @@ -2377,43 +2396,53 @@ int cmFortran_yylex_destroy (yyscan_t yyscanner) #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) { - int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + + int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) { - int n; - for ( n = 0; s[n]; ++n ) - ; + int n; + for ( n = 0; s[n]; ++n ) + ; - return n; + return n; } #endif -void *cmFortran_yyalloc (yy_size_t size , yyscan_t) +void *cmFortran_yyalloc (yy_size_t size , yyscan_t yyscanner) { - return (void *) malloc( size ); + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + return malloc(size); } -void *cmFortran_yyrealloc (void * ptr, yy_size_t size , yyscan_t) +void *cmFortran_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return realloc(ptr, size); } -void cmFortran_yyfree (void * ptr , yyscan_t) +void cmFortran_yyfree (void * ptr , yyscan_t yyscanner) { - free( (char *) ptr ); /* see cmFortran_yyrealloc() for (char *) cast */ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + free( (char *) ptr ); /* see cmFortran_yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" diff --git a/Source/cmFortranLexer.h b/Source/cmFortranLexer.h index b9ff0dc..cb175ec 100644 --- a/Source/cmFortranLexer.h +++ b/Source/cmFortranLexer.h @@ -1,26 +1,19 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2015 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ #ifndef cmFortran_yyHEADER_H #define cmFortran_yyHEADER_H 1 #define cmFortran_yyIN_HEADER 1 +#line 6 "cmFortranLexer.h" + +#line 8 "cmFortranLexer.h" + #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 39 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 1 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -99,25 +92,13 @@ typedef unsigned int flex_uint32_t; #endif /* ! FLEXINT_H */ -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* An opaque pointer. */ @@ -163,52 +144,52 @@ typedef size_t yy_size_t; #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - yy_size_t yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; - int yy_buffer_status; + int yy_buffer_status; - }; + }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ void cmFortran_yyrestart (FILE *input_file ,yyscan_t yyscanner ); @@ -221,7 +202,7 @@ void cmFortran_yypop_buffer_state (yyscan_t yyscanner ); YY_BUFFER_STATE cmFortran_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE cmFortran_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); +YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); void *cmFortran_yyalloc (yy_size_t ,yyscan_t yyscanner ); void *cmFortran_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); @@ -229,7 +210,7 @@ void cmFortran_yyfree (void * ,yyscan_t yyscanner ); /* Begin user sect3 */ -#define cmFortran_yywrap(yyscanner) 1 +#define cmFortran_yywrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP #define yytext_ptr yytext_r @@ -243,6 +224,14 @@ void cmFortran_yyfree (void * ,yyscan_t yyscanner ); #endif +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> +#endif + #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif @@ -266,23 +255,23 @@ void cmFortran_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); FILE *cmFortran_yyget_in (yyscan_t yyscanner ); -void cmFortran_yyset_in (FILE * in_str ,yyscan_t yyscanner ); +void cmFortran_yyset_in (FILE * _in_str ,yyscan_t yyscanner ); FILE *cmFortran_yyget_out (yyscan_t yyscanner ); -void cmFortran_yyset_out (FILE * out_str ,yyscan_t yyscanner ); +void cmFortran_yyset_out (FILE * _out_str ,yyscan_t yyscanner ); -yy_size_t cmFortran_yyget_leng (yyscan_t yyscanner ); + int cmFortran_yyget_leng (yyscan_t yyscanner ); char *cmFortran_yyget_text (yyscan_t yyscanner ); int cmFortran_yyget_lineno (yyscan_t yyscanner ); -void cmFortran_yyset_lineno (int line_number ,yyscan_t yyscanner ); +void cmFortran_yyset_lineno (int _line_number ,yyscan_t yyscanner ); int cmFortran_yyget_column (yyscan_t yyscanner ); -void cmFortran_yyset_column (int column_no ,yyscan_t yyscanner ); +void cmFortran_yyset_column (int _column_no ,yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -348,5 +337,9 @@ extern int cmFortran_yylex (yyscan_t yyscanner); #undef YY_DECL #endif +#line 182 "cmFortranLexer.in.l" + + +#line 344 "cmFortranLexer.h" #undef cmFortran_yyIN_HEADER #endif /* cmFortran_yyHEADER_H */ diff --git a/Source/cmFortranLexer.in.l b/Source/cmFortranLexer.in.l index e59ff5f..6870f7c 100644 --- a/Source/cmFortranLexer.in.l +++ b/Source/cmFortranLexer.in.l @@ -24,28 +24,21 @@ This file must be translated to C and modified to build everywhere. -Run flex like this: +Run flex >= 2.6 like this: flex -i --prefix=cmFortran_yy --header-file=cmFortranLexer.h -ocmFortranLexer.cxx cmFortranLexer.in.l Modify cmFortranLexer.cxx: - - remove TABs - - remove use of the 'register' storage class specifier - - remove "yyscanner" argument from these methods: - yy_fatal_error, cmFortran_yyalloc, cmFortran_yyrealloc, cmFortran_yyfree + - remove trailing whitespace: sed -i 's/\s*$//' cmFortranLexer.h cmFortranLexer.cxx + - remove blank lines at end of file - remove "yyscanner = NULL" from end of cmFortran_yylex_destroy - remove all YY_BREAK lines occurring right after return statements - - change while ( 1 ) to for(;;) - -Modify cmFortranLexer.h: - - remove TABs - - remove the yy_init_globals function - - remove the block that includes unistd.h - - remove #line directives (avoids bogus warning on old Sun) + - add cast in yy_scan_bytes for loop condition of _yybytes_len to size_t */ #include "cmStandardLexer.h" +#undef YY_NO_UNPUT #define cmFortranLexer_cxx #include "cmFortranParser.h" /* Interface to parser object. */ @@ -158,6 +151,12 @@ $[ \t]*endif { return F90PPR_ENDIF; } =|=> { return ASSIGNMENT_OP; } +[Ee][Nn][Dd] { return END; } +[Ii][Nn][Cc][Ll][Uu][Dd][Ee] { return INCLUDE; } +[Ii][Nn][Tt][Ee][Rr][Ff][Aa][Cc][Ee] { return INTERFACE; } +[Mm][Oo][Dd][Uu][Ll][Ee] { return MODULE; } +[Uu][Ss][Ee] { return USE; } + [a-zA-Z_][a-zA-Z_0-9]* { yylvalp->string = strdup(yytext); return WORD; diff --git a/Source/cmFortranParser.cxx b/Source/cmFortranParser.cxx index 21a6443..bf4e7c4 100644 --- a/Source/cmFortranParser.cxx +++ b/Source/cmFortranParser.cxx @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0.2" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -123,12 +123,6 @@ static void cmFortran_yyerror(yyscan_t yyscanner, const char* message) cmFortranParser_Error(parser, message); } -static bool cmFortranParserIsKeyword(const char* word, - const char* keyword) -{ - return cmsysString_strcasecmp(word, keyword) == 0; -} - /* Disable some warnings in the generated code. */ #ifdef _MSC_VER # pragma warning (disable: 4102) /* Unused goto label. */ @@ -139,7 +133,7 @@ static bool cmFortranParserIsKeyword(const char* word, # pragma warning (disable: 4244) /* Conversion to smaller type, data loss. */ #endif -#line 143 "cmFortranParser.cxx" /* yacc.c:339 */ +#line 137 "cmFortranParser.cxx" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus @@ -199,11 +193,15 @@ extern int cmFortran_yydebug; F90PPR_ENDIF = 280, COMMA = 281, DCOLON = 282, - CPP_TOENDL = 283, - UNTERMINATED_STRING = 284, - STRING = 285, - WORD = 286, - CPP_INCLUDE_ANGLE = 287 + UNTERMINATED_STRING = 283, + STRING = 284, + WORD = 285, + CPP_INCLUDE_ANGLE = 286, + END = 287, + INCLUDE = 288, + INTERFACE = 289, + MODULE = 290, + USE = 291 }; #endif /* Tokens. */ @@ -232,23 +230,29 @@ extern int cmFortran_yydebug; #define F90PPR_ENDIF 280 #define COMMA 281 #define DCOLON 282 -#define CPP_TOENDL 283 -#define UNTERMINATED_STRING 284 -#define STRING 285 -#define WORD 286 -#define CPP_INCLUDE_ANGLE 287 +#define UNTERMINATED_STRING 283 +#define STRING 284 +#define WORD 285 +#define CPP_INCLUDE_ANGLE 286 +#define END 287 +#define INCLUDE 288 +#define INTERFACE 289 +#define MODULE 290 +#define USE 291 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; + union YYSTYPE { -#line 81 "cmFortranParser.y" /* yacc.c:355 */ +#line 75 "cmFortranParser.y" /* yacc.c:355 */ char* string; -#line 251 "cmFortranParser.cxx" /* yacc.c:355 */ +#line 253 "cmFortranParser.cxx" /* yacc.c:355 */ }; + +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif @@ -261,7 +265,7 @@ int cmFortran_yyparse (yyscan_t yyscanner); /* Copy the second part of user declarations. */ -#line 265 "cmFortranParser.cxx" /* yacc.c:358 */ +#line 269 "cmFortranParser.cxx" /* yacc.c:358 */ #ifdef short # undef short @@ -503,21 +507,21 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 290 +#define YYLAST 469 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 33 +#define YYNTOKENS 37 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 16 +#define YYNNTS 14 /* YYNRULES -- Number of rules. */ -#define YYNRULES 54 +#define YYNRULES 57 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 101 +#define YYNSTATES 109 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 287 +#define YYMAXUTOK 291 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -554,19 +558,20 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32 + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = +static const yytype_uint8 yyrline[] = { - 0, 104, 104, 104, 106, 106, 108, 114, 124, 154, - 165, 178, 189, 196, 203, 210, 216, 222, 228, 234, - 239, 244, 249, 254, 258, 259, 260, 265, 265, 265, - 266, 266, 267, 267, 268, 268, 269, 269, 270, 270, - 271, 271, 272, 272, 273, 273, 274, 274, 277, 278, - 279, 280, 281, 282, 283 + 0, 102, 102, 102, 105, 109, 114, 119, 124, 128, + 133, 141, 146, 151, 156, 161, 166, 171, 176, 181, + 185, 189, 193, 197, 198, 203, 203, 203, 204, 204, + 205, 205, 206, 206, 207, 207, 208, 208, 209, 209, + 210, 210, 211, 211, 212, 212, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226 }; #endif @@ -580,11 +585,10 @@ static const char *const yytname[] = "F90PPR_DEFINE", "CPP_DEFINE", "F90PPR_UNDEF", "CPP_UNDEF", "CPP_IFDEF", "CPP_IFNDEF", "CPP_IF", "CPP_ELSE", "CPP_ELIF", "CPP_ENDIF", "F90PPR_IFDEF", "F90PPR_IFNDEF", "F90PPR_IF", "F90PPR_ELSE", - "F90PPR_ELIF", "F90PPR_ENDIF", "COMMA", "DCOLON", "CPP_TOENDL", - "UNTERMINATED_STRING", "STRING", "WORD", "CPP_INCLUDE_ANGLE", "$accept", - "code", "stmt", "assignment_stmt", "keyword_stmt", "include", "define", - "undef", "ifdef", "ifndef", "if", "elif", "else", "endif", "other", - "misc_code", YY_NULLPTR + "F90PPR_ELIF", "F90PPR_ENDIF", "COMMA", "DCOLON", "UNTERMINATED_STRING", + "STRING", "WORD", "CPP_INCLUDE_ANGLE", "END", "INCLUDE", "INTERFACE", + "MODULE", "USE", "$accept", "code", "stmt", "include", "define", "undef", + "ifdef", "ifndef", "if", "elif", "else", "endif", "other", "misc_code", YY_NULLPTR }; #endif @@ -596,14 +600,14 @@ static const yytype_uint16 yytoknum[] = 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287 + 285, 286, 287, 288, 289, 290, 291 }; # endif -#define YYPACT_NINF -30 +#define YYPACT_NINF -38 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-30))) + (!!((Yystate) == (-38))) #define YYTABLE_NINF -1 @@ -614,17 +618,17 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int16 yypact[] = { - -30, 41, -30, -30, -30, -30, -29, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, 259, -30, -30, -30, - -30, -28, -23, -18, -16, -13, -30, -30, -30, -30, - 2, -30, -30, -30, -30, -12, -9, -30, -30, 64, - -30, -30, -30, -30, -30, 71, 77, 83, 112, -30, - -30, -30, -30, -30, -30, -30, -30, -30, 118, 124, - 130, -24, -30, 159, 165, -30, 171, 177, 206, 212, - 218, -30, -30, -30, -30, -30, -30, -30, -1, 224, - -30, -30, -30, -30, -30, -30, -30, -30, -30, 253, - -30 + -38, 39, -38, 3, -38, -20, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -22, -16, 1, -8, + -6, -38, -4, -7, -3, -2, -1, -38, -38, -38, + -38, -38, -38, 62, -38, -38, -38, -38, -38, 0, + 2, -38, -38, -38, -38, -38, -38, 73, 107, 118, + 152, 163, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, 197, 208, 242, 253, + 6, -38, 287, 298, 332, 343, 377, 388, -38, -38, + -38, -38, -38, -38, -38, -38, -38, 4, 422, -38, + -38, -38, -38, -38, -38, -38, -38, 433, -38 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -632,31 +636,31 @@ static const yytype_int16 yypact[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 2, 0, 1, 26, 25, 46, 0, 27, 28, 29, - 31, 30, 33, 32, 34, 36, 38, 42, 40, 44, - 35, 37, 39, 43, 41, 45, 0, 46, 3, 5, - 4, 0, 0, 0, 0, 0, 46, 46, 46, 46, - 0, 46, 7, 46, 46, 0, 0, 46, 46, 0, - 46, 46, 46, 46, 46, 0, 0, 0, 0, 24, - 51, 50, 53, 52, 54, 49, 48, 47, 0, 0, - 0, 0, 46, 0, 0, 13, 0, 0, 0, 0, - 0, 19, 20, 21, 22, 12, 6, 23, 0, 0, - 11, 8, 14, 15, 16, 17, 18, 46, 9, 0, - 10 + 2, 0, 1, 0, 23, 0, 25, 26, 27, 29, + 28, 31, 30, 32, 34, 36, 40, 38, 42, 33, + 35, 37, 41, 39, 43, 44, 0, 0, 0, 0, + 0, 3, 0, 0, 0, 0, 0, 44, 44, 44, + 44, 24, 44, 0, 44, 44, 4, 44, 44, 0, + 0, 44, 44, 44, 44, 44, 44, 0, 0, 0, + 0, 0, 13, 54, 53, 56, 55, 57, 52, 46, + 47, 48, 49, 50, 51, 45, 0, 0, 0, 0, + 0, 44, 0, 0, 0, 0, 0, 0, 19, 20, + 21, 22, 12, 8, 11, 7, 6, 0, 0, 5, + 14, 15, 16, 17, 18, 44, 9, 0, 10 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -27, -30 + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -37, -38 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 1, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 67 + -1, 1, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 43, 75 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -664,109 +668,143 @@ static const yytype_int8 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { - 49, 41, 50, 88, 0, 59, 60, 61, 51, 55, - 56, 57, 58, 52, 68, 53, 69, 70, 54, 71, - 73, 74, 72, 76, 77, 78, 79, 80, 62, 63, - 97, 64, 65, 66, 0, 0, 0, 0, 0, 0, - 0, 2, 3, 0, 4, 89, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 75, 60, 61, - 99, 0, 26, 27, 81, 60, 61, 0, 0, 0, - 82, 60, 61, 0, 0, 0, 83, 60, 61, 0, - 62, 63, 0, 64, 65, 66, 0, 62, 63, 0, - 64, 65, 66, 62, 63, 0, 64, 65, 66, 62, - 63, 0, 64, 65, 66, 84, 60, 61, 0, 0, - 0, 85, 60, 61, 0, 0, 0, 86, 60, 61, - 0, 0, 0, 87, 60, 61, 0, 0, 62, 63, - 0, 64, 65, 66, 62, 63, 0, 64, 65, 66, - 62, 63, 0, 64, 65, 66, 62, 63, 0, 64, - 65, 66, 90, 60, 61, 0, 0, 0, 91, 60, - 61, 0, 0, 0, 92, 60, 61, 0, 0, 0, - 93, 60, 61, 0, 0, 62, 63, 0, 64, 65, - 66, 62, 63, 0, 64, 65, 66, 62, 63, 0, - 64, 65, 66, 62, 63, 0, 64, 65, 66, 94, - 60, 61, 0, 0, 0, 95, 60, 61, 0, 0, - 0, 96, 60, 61, 0, 0, 0, 98, 60, 61, - 0, 0, 62, 63, 0, 64, 65, 66, 62, 63, - 0, 64, 65, 66, 62, 63, 0, 64, 65, 66, - 62, 63, 0, 64, 65, 66, 100, 60, 61, 0, - 0, 0, 42, 43, 44, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, - 63, 0, 64, 65, 66, 45, 46, 0, 0, 47, - 48 + 57, 58, 59, 60, 46, 61, 41, 76, 77, 42, + 78, 79, 44, 45, 82, 83, 84, 85, 86, 87, + 49, 50, 48, 53, 51, 52, 0, 54, 55, 56, + 80, 47, 81, 97, 105, 0, 0, 0, 0, 2, + 3, 0, 4, 0, 98, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 62, 63, 64, 107, 0, + 25, 26, 27, 28, 29, 30, 88, 63, 64, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, + 67, 68, 69, 0, 70, 71, 72, 73, 74, 65, + 66, 67, 68, 69, 0, 70, 71, 72, 73, 74, + 89, 63, 64, 0, 0, 0, 0, 0, 0, 0, + 0, 90, 63, 64, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 65, 66, 67, 68, 69, 0, 70, + 71, 72, 73, 74, 65, 66, 67, 68, 69, 0, + 70, 71, 72, 73, 74, 91, 63, 64, 0, 0, + 0, 0, 0, 0, 0, 0, 92, 63, 64, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, + 67, 68, 69, 0, 70, 71, 72, 73, 74, 65, + 66, 67, 68, 69, 0, 70, 71, 72, 73, 74, + 93, 63, 64, 0, 0, 0, 0, 0, 0, 0, + 0, 94, 63, 64, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 65, 66, 67, 68, 69, 0, 70, + 71, 72, 73, 74, 65, 66, 67, 68, 69, 0, + 70, 71, 72, 73, 74, 95, 63, 64, 0, 0, + 0, 0, 0, 0, 0, 0, 96, 63, 64, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, + 67, 68, 69, 0, 70, 71, 72, 73, 74, 65, + 66, 67, 68, 69, 0, 70, 71, 72, 73, 74, + 99, 63, 64, 0, 0, 0, 0, 0, 0, 0, + 0, 100, 63, 64, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 65, 66, 67, 68, 69, 0, 70, + 71, 72, 73, 74, 65, 66, 67, 68, 69, 0, + 70, 71, 72, 73, 74, 101, 63, 64, 0, 0, + 0, 0, 0, 0, 0, 0, 102, 63, 64, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, + 67, 68, 69, 0, 70, 71, 72, 73, 74, 65, + 66, 67, 68, 69, 0, 70, 71, 72, 73, 74, + 103, 63, 64, 0, 0, 0, 0, 0, 0, 0, + 0, 104, 63, 64, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 65, 66, 67, 68, 69, 0, 70, + 71, 72, 73, 74, 65, 66, 67, 68, 69, 0, + 70, 71, 72, 73, 74, 106, 63, 64, 0, 0, + 0, 0, 0, 0, 0, 0, 108, 63, 64, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, + 67, 68, 69, 0, 70, 71, 72, 73, 74, 65, + 66, 67, 68, 69, 0, 70, 71, 72, 73, 74 }; static const yytype_int8 yycheck[] = { - 27, 30, 30, 27, -1, 3, 4, 5, 31, 36, - 37, 38, 39, 31, 41, 31, 43, 44, 31, 31, - 47, 48, 31, 50, 51, 52, 53, 54, 26, 27, - 31, 29, 30, 31, -1, -1, -1, -1, -1, -1, - -1, 0, 1, -1, 3, 72, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 3, 4, 5, - 97, -1, 31, 32, 3, 4, 5, -1, -1, -1, - 3, 4, 5, -1, -1, -1, 3, 4, 5, -1, - 26, 27, -1, 29, 30, 31, -1, 26, 27, -1, - 29, 30, 31, 26, 27, -1, 29, 30, 31, 26, - 27, -1, 29, 30, 31, 3, 4, 5, -1, -1, - -1, 3, 4, 5, -1, -1, -1, 3, 4, 5, - -1, -1, -1, 3, 4, 5, -1, -1, 26, 27, - -1, 29, 30, 31, 26, 27, -1, 29, 30, 31, - 26, 27, -1, 29, 30, 31, 26, 27, -1, 29, - 30, 31, 3, 4, 5, -1, -1, -1, 3, 4, - 5, -1, -1, -1, 3, 4, 5, -1, -1, -1, - 3, 4, 5, -1, -1, 26, 27, -1, 29, 30, - 31, 26, 27, -1, 29, 30, 31, 26, 27, -1, - 29, 30, 31, 26, 27, -1, 29, 30, 31, 3, - 4, 5, -1, -1, -1, 3, 4, 5, -1, -1, - -1, 3, 4, 5, -1, -1, -1, 3, 4, 5, - -1, -1, 26, 27, -1, 29, 30, 31, 26, 27, - -1, 29, 30, 31, 26, 27, -1, 29, 30, 31, - 26, 27, -1, 29, 30, 31, 3, 4, 5, -1, - -1, -1, 3, 4, 5, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 26, - 27, -1, 29, 30, 31, 26, 27, -1, -1, 30, - 31 + 37, 38, 39, 40, 3, 42, 3, 44, 45, 29, + 47, 48, 34, 29, 51, 52, 53, 54, 55, 56, + 26, 27, 30, 30, 30, 29, -1, 30, 30, 30, + 30, 30, 30, 27, 30, -1, -1, -1, -1, 0, + 1, -1, 3, -1, 81, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 3, 4, 5, 105, -1, + 31, 32, 33, 34, 35, 36, 3, 4, 5, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 26, 27, + 28, 29, 30, -1, 32, 33, 34, 35, 36, 26, + 27, 28, 29, 30, -1, 32, 33, 34, 35, 36, + 3, 4, 5, -1, -1, -1, -1, -1, -1, -1, + -1, 3, 4, 5, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 26, 27, 28, 29, 30, -1, 32, + 33, 34, 35, 36, 26, 27, 28, 29, 30, -1, + 32, 33, 34, 35, 36, 3, 4, 5, -1, -1, + -1, -1, -1, -1, -1, -1, 3, 4, 5, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 26, 27, + 28, 29, 30, -1, 32, 33, 34, 35, 36, 26, + 27, 28, 29, 30, -1, 32, 33, 34, 35, 36, + 3, 4, 5, -1, -1, -1, -1, -1, -1, -1, + -1, 3, 4, 5, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 26, 27, 28, 29, 30, -1, 32, + 33, 34, 35, 36, 26, 27, 28, 29, 30, -1, + 32, 33, 34, 35, 36, 3, 4, 5, -1, -1, + -1, -1, -1, -1, -1, -1, 3, 4, 5, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 26, 27, + 28, 29, 30, -1, 32, 33, 34, 35, 36, 26, + 27, 28, 29, 30, -1, 32, 33, 34, 35, 36, + 3, 4, 5, -1, -1, -1, -1, -1, -1, -1, + -1, 3, 4, 5, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 26, 27, 28, 29, 30, -1, 32, + 33, 34, 35, 36, 26, 27, 28, 29, 30, -1, + 32, 33, 34, 35, 36, 3, 4, 5, -1, -1, + -1, -1, -1, -1, -1, -1, 3, 4, 5, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 26, 27, + 28, 29, 30, -1, 32, 33, 34, 35, 36, 26, + 27, 28, 29, 30, -1, 32, 33, 34, 35, 36, + 3, 4, 5, -1, -1, -1, -1, -1, -1, -1, + -1, 3, 4, 5, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 26, 27, 28, 29, 30, -1, 32, + 33, 34, 35, 36, 26, 27, 28, 29, 30, -1, + 32, 33, 34, 35, 36, 3, 4, 5, -1, -1, + -1, -1, -1, -1, -1, -1, 3, 4, 5, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 26, 27, + 28, 29, 30, -1, 32, 33, 34, 35, 36, 26, + 27, 28, 29, 30, -1, 32, 33, 34, 35, 36 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 34, 0, 1, 3, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 31, 32, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 30, 3, 4, 5, 26, 27, 30, 31, 47, - 30, 31, 31, 31, 31, 47, 47, 47, 47, 3, - 4, 5, 26, 27, 29, 30, 31, 48, 47, 47, - 47, 31, 31, 47, 47, 3, 47, 47, 47, 47, - 47, 3, 3, 3, 3, 3, 3, 3, 27, 47, - 3, 3, 3, 3, 3, 3, 3, 31, 3, 47, - 3 + 0, 38, 0, 1, 3, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 31, 32, 33, 34, 35, + 36, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 3, 29, 49, 34, 29, 3, 30, 30, 26, + 27, 30, 29, 30, 30, 30, 30, 49, 49, 49, + 49, 49, 3, 4, 5, 26, 27, 28, 29, 30, + 32, 33, 34, 35, 36, 50, 49, 49, 49, 49, + 30, 30, 49, 49, 49, 49, 49, 49, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 27, 49, 3, + 3, 3, 3, 3, 3, 30, 3, 49, 3 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 33, 34, 34, 35, 35, 36, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 38, 38, 38, - 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, - 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, - 48, 48, 48, 48, 48 + 0, 37, 38, 38, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 40, 40, 40, 41, 41, + 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, + 47, 47, 48, 48, 49, 49, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { - 0, 2, 0, 2, 1, 1, 4, 2, 4, 5, + 0, 2, 0, 2, 2, 4, 4, 4, 4, 5, 7, 4, 4, 3, 4, 4, 4, 4, 4, 3, - 3, 3, 3, 4, 3, 1, 1, 1, 1, 1, + 3, 3, 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, - 1, 1, 1, 1, 1 + 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1 }; @@ -1448,240 +1486,207 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 6: + case 4: +#line 105 "cmFortranParser.y" /* yacc.c:1646 */ + { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, true); + } +#line 1496 "cmFortranParser.cxx" /* yacc.c:1646 */ + break; + + case 5: #line 109 "cmFortranParser.y" /* yacc.c:1646 */ { - free((yyvsp[-3].string)); - } -#line 1457 "cmFortranParser.cxx" /* yacc.c:1646 */ + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); + free((yyvsp[-2].string)); + } +#line 1506 "cmFortranParser.cxx" /* yacc.c:1646 */ + break; + + case 6: +#line 114 "cmFortranParser.y" /* yacc.c:1646 */ + { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleModule(parser, (yyvsp[-2].string)); + free((yyvsp[-2].string)); + } +#line 1516 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 7: -#line 115 "cmFortranParser.y" /* yacc.c:1646 */ +#line 119 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmFortranParserIsKeyword((yyvsp[-1].string), "interface")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_SetInInterface(parser, true); - } - free((yyvsp[-1].string)); - } -#line 1471 "cmFortranParser.cxx" /* yacc.c:1646 */ + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, true); + free((yyvsp[-2].string)); + } +#line 1526 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 8: -#line 125 "cmFortranParser.y" /* yacc.c:1646 */ +#line 124 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmFortranParserIsKeyword((yyvsp[-3].string), "use")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); - } - else if (cmFortranParserIsKeyword((yyvsp[-3].string), "module")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleModule(parser, (yyvsp[-2].string)); - } - else if (cmFortranParserIsKeyword((yyvsp[-3].string), "interface")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_SetInInterface(parser, true); - } - else if (cmFortranParserIsKeyword((yyvsp[-2].string), "interface") && - cmFortranParserIsKeyword((yyvsp[-3].string), "end")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_SetInInterface(parser, false); - } - free((yyvsp[-3].string)); - free((yyvsp[-2].string)); - } -#line 1505 "cmFortranParser.cxx" /* yacc.c:1646 */ + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, false); + } +#line 1535 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 9: -#line 155 "cmFortranParser.y" /* yacc.c:1646 */ +#line 128 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmFortranParserIsKeyword((yyvsp[-4].string), "use")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); - } - free((yyvsp[-4].string)); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); - } -#line 1520 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1545 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 10: -#line 166 "cmFortranParser.y" /* yacc.c:1646 */ +#line 133 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmFortranParserIsKeyword((yyvsp[-6].string), "use") && - cmFortranParserIsKeyword((yyvsp[-4].string), "non_intrinsic") ) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); + if (cmsysString_strcasecmp((yyvsp[-4].string), "non_intrinsic") == 0) { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); - } - free((yyvsp[-6].string)); + } free((yyvsp[-4].string)); free((yyvsp[-2].string)); - } -#line 1537 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1558 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 11: -#line 179 "cmFortranParser.y" /* yacc.c:1646 */ +#line 141 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmFortranParserIsKeyword((yyvsp[-3].string), "include")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); - } - free((yyvsp[-3].string)); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); - } -#line 1552 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1568 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 12: -#line 190 "cmFortranParser.y" /* yacc.c:1646 */ +#line 146 "cmFortranParser.y" /* yacc.c:1646 */ { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleLineDirective(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); - } -#line 1563 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1578 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 13: -#line 197 "cmFortranParser.y" /* yacc.c:1646 */ +#line 151 "cmFortranParser.y" /* yacc.c:1646 */ { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); - } -#line 1574 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1588 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 14: -#line 204 "cmFortranParser.y" /* yacc.c:1646 */ +#line 156 "cmFortranParser.y" /* yacc.c:1646 */ { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); - } -#line 1585 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1598 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 15: -#line 211 "cmFortranParser.y" /* yacc.c:1646 */ +#line 161 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleDefine(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); - } -#line 1595 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1608 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 16: -#line 217 "cmFortranParser.y" /* yacc.c:1646 */ +#line 166 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUndef(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); - } -#line 1605 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1618 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 17: -#line 223 "cmFortranParser.y" /* yacc.c:1646 */ +#line 171 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIfdef(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); - } -#line 1615 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1628 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 18: -#line 229 "cmFortranParser.y" /* yacc.c:1646 */ +#line 176 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIfndef(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); - } -#line 1625 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1638 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 19: -#line 235 "cmFortranParser.y" /* yacc.c:1646 */ +#line 181 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIf(parser); - } -#line 1634 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1647 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 20: -#line 240 "cmFortranParser.y" /* yacc.c:1646 */ +#line 185 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleElif(parser); - } -#line 1643 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1656 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 21: -#line 245 "cmFortranParser.y" /* yacc.c:1646 */ +#line 189 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleElse(parser); - } -#line 1652 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1665 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 22: -#line 250 "cmFortranParser.y" /* yacc.c:1646 */ +#line 193 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleEndif(parser); - } -#line 1661 "cmFortranParser.cxx" /* yacc.c:1646 */ - break; - - case 23: -#line 255 "cmFortranParser.y" /* yacc.c:1646 */ - { - free((yyvsp[-3].string)); - } -#line 1669 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1674 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 48: -#line 277 "cmFortranParser.y" /* yacc.c:1646 */ + case 46: +#line 215 "cmFortranParser.y" /* yacc.c:1646 */ { free ((yyvsp[0].string)); } -#line 1675 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1680 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 49: -#line 278 "cmFortranParser.y" /* yacc.c:1646 */ + case 52: +#line 221 "cmFortranParser.y" /* yacc.c:1646 */ { free ((yyvsp[0].string)); } -#line 1681 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1686 "cmFortranParser.cxx" /* yacc.c:1646 */ break; -#line 1685 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1690 "cmFortranParser.cxx" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1911,6 +1916,6 @@ yyreturn: #endif return yyresult; } -#line 286 "cmFortranParser.y" /* yacc.c:1906 */ +#line 229 "cmFortranParser.y" /* yacc.c:1906 */ /* End of grammar */ diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h index 5f1c7ac..2b58375 100644 --- a/Source/cmFortranParser.h +++ b/Source/cmFortranParser.h @@ -73,6 +73,7 @@ union cmFortran_yystype_u #define YYSTYPE cmFortran_yystype #define YYSTYPE_IS_DECLARED 1 #if !defined(cmFortranLexer_cxx) +#define YY_NO_UNISTD_H #include "cmFortranLexer.h" #endif #if !defined(cmFortranLexer_cxx) @@ -117,11 +118,13 @@ struct cmFortranFile : File(file) , Buffer(buffer) , Directory(dir) + , LastCharWasNewline(false) { } FILE* File; YY_BUFFER_STATE Buffer; std::string Directory; + bool LastCharWasNewline; }; struct cmFortranParser_s @@ -146,6 +149,9 @@ struct cmFortranParser_s // Buffer for string literals. std::string TokenString; + // Error message text if a parser error occurs. + std::string Error; + // Flag for whether lexer is reading from inside an interface. bool InInterface; diff --git a/Source/cmFortranParser.y b/Source/cmFortranParser.y index 83f441a..b856a1a 100644 --- a/Source/cmFortranParser.y +++ b/Source/cmFortranParser.y @@ -52,12 +52,6 @@ static void cmFortran_yyerror(yyscan_t yyscanner, const char* message) cmFortranParser_Error(parser, message); } -static bool cmFortranParserIsKeyword(const char* word, - const char* keyword) -{ - return cmsysString_strcasecmp(word, keyword) == 0; -} - /* Disable some warnings in the generated code. */ #ifdef _MSC_VER # pragma warning (disable: 4102) /* Unused goto label. */ @@ -92,10 +86,14 @@ static bool cmFortranParserIsKeyword(const char* word, %token F90PPR_IFDEF F90PPR_IFNDEF F90PPR_IF %token F90PPR_ELSE F90PPR_ELIF F90PPR_ENDIF %token COMMA DCOLON -%token <string> CPP_TOENDL %token <number> UNTERMINATED_STRING %token <string> STRING WORD %token <string> CPP_INCLUDE_ANGLE +%token END +%token INCLUDE +%token INTERFACE +%token MODULE +%token USE /*-------------------------------------------------------------------------*/ /* grammar */ @@ -103,161 +101,101 @@ static bool cmFortranParserIsKeyword(const char* word, code: /* empty */ | code stmt; -stmt: keyword_stmt | assignment_stmt; - -assignment_stmt: WORD ASSIGNMENT_OP other EOSTMT /* Ignore */ - { - free($1); - } - -keyword_stmt: - WORD EOSTMT - { - if (cmFortranParserIsKeyword($1, "interface")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_SetInInterface(parser, true); - } - free($1); - } -| WORD WORD other EOSTMT - { - if (cmFortranParserIsKeyword($1, "use")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleUse(parser, $2); - } - else if (cmFortranParserIsKeyword($1, "module")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleModule(parser, $2); - } - else if (cmFortranParserIsKeyword($1, "interface")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_SetInInterface(parser, true); - } - else if (cmFortranParserIsKeyword($2, "interface") && - cmFortranParserIsKeyword($1, "end")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_SetInInterface(parser, false); - } - free($1); +stmt: + INTERFACE EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, true); + } +| USE WORD other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, $2); free($2); - } -| WORD DCOLON WORD other EOSTMT - { - if (cmFortranParserIsKeyword($1, "use")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleUse(parser, $3); - } - free($1); + } +| MODULE WORD other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleModule(parser, $2); + free($2); + } +| INTERFACE WORD other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, true); + free($2); + } +| END INTERFACE other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, false); + } +| USE DCOLON WORD other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, $3); free($3); - } -| WORD COMMA WORD DCOLON WORD other EOSTMT - { - if (cmFortranParserIsKeyword($1, "use") && - cmFortranParserIsKeyword($3, "non_intrinsic") ) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); + } +| USE COMMA WORD DCOLON WORD other EOSTMT { + if (cmsysString_strcasecmp($3, "non_intrinsic") == 0) { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUse(parser, $5); - } - free($1); + } free($3); free($5); - } -| WORD STRING other EOSTMT /* Ignore */ - { - if (cmFortranParserIsKeyword($1, "include")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleInclude(parser, $2); - } - free($1); + } +| INCLUDE STRING other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleInclude(parser, $2); free($2); - } -| CPP_LINE_DIRECTIVE STRING other EOSTMT - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); + } +| CPP_LINE_DIRECTIVE STRING other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleLineDirective(parser, $2); free($2); - } -| CPP_INCLUDE_ANGLE other EOSTMT - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); + } +| CPP_INCLUDE_ANGLE other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleInclude(parser, $1); free($1); - } -| include STRING other EOSTMT - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); + } +| include STRING other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleInclude(parser, $2); free($2); - } -| define WORD other EOSTMT - { + } +| define WORD other EOSTMT { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleDefine(parser, $2); free($2); - } -| undef WORD other EOSTMT - { + } +| undef WORD other EOSTMT { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUndef(parser, $2); free($2); - } -| ifdef WORD other EOSTMT - { + } +| ifdef WORD other EOSTMT { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIfdef(parser, $2); free($2); - } -| ifndef WORD other EOSTMT - { + } +| ifndef WORD other EOSTMT { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIfndef(parser, $2); free($2); - } -| if other EOSTMT - { + } +| if other EOSTMT { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIf(parser); - } -| elif other EOSTMT - { + } +| elif other EOSTMT { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleElif(parser); - } -| else other EOSTMT - { + } +| else other EOSTMT { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleElse(parser); - } -| endif other EOSTMT - { + } +| endif other EOSTMT { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleEndif(parser); - } -| WORD GARBAGE other EOSTMT /* Ignore */ - { - free($1); - } -| GARBAGE other EOSTMT + } | EOSTMT -| error +| error EOSTMT /* tolerate unknown statements until their end */ ; @@ -275,6 +213,11 @@ other: /* empty */ | other misc_code ; misc_code: WORD { free ($1); } +| END +| INCLUDE +| INTERFACE +| MODULE +| USE | STRING { free ($1); } | GARBAGE | ASSIGNMENT_OP diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx index 71edf9f..639b3f0 100644 --- a/Source/cmFortranParserImpl.cxx +++ b/Source/cmFortranParserImpl.cxx @@ -119,8 +119,19 @@ int cmFortranParser_Input(cmFortranParser* parser, char* buffer, // Read from the file on top of the stack. If the stack is empty, // the end of the translation unit has been reached. if (!parser->FileStack.empty()) { - FILE* file = parser->FileStack.top().File; - return (int)fread(buffer, 1, bufferSize, file); + cmFortranFile& ff = parser->FileStack.top(); + FILE* file = ff.File; + size_t n = fread(buffer, 1, bufferSize, file); + if (n > 0) { + ff.LastCharWasNewline = buffer[n - 1] == '\n'; + } else if (!ff.LastCharWasNewline) { + // The file ended without a newline. Inject one so + // that the file always ends in an end-of-statement. + buffer[0] = '\n'; + n = 1; + ff.LastCharWasNewline = true; + } + return (int)n; } return 0; } @@ -164,11 +175,9 @@ int cmFortranParser_GetOldStartcond(cmFortranParser* parser) return parser->OldStartcond; } -void cmFortranParser_Error(cmFortranParser* /*unused*/, const char* /*unused*/) +void cmFortranParser_Error(cmFortranParser* parser, const char* msg) { - // If there is a parser error just ignore it. The source will not - // compile and the user will edit it. Then dependencies will have - // to be regenerated anyway. + parser->Error = msg ? msg : "unknown error"; } void cmFortranParser_RuleUse(cmFortranParser* parser, const char* name) diff --git a/Source/cmFortranParserTokens.h b/Source/cmFortranParserTokens.h index ac49840..e988df4 100644 --- a/Source/cmFortranParserTokens.h +++ b/Source/cmFortranParserTokens.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -70,11 +70,15 @@ extern int cmFortran_yydebug; F90PPR_ENDIF = 280, COMMA = 281, DCOLON = 282, - CPP_TOENDL = 283, - UNTERMINATED_STRING = 284, - STRING = 285, - WORD = 286, - CPP_INCLUDE_ANGLE = 287 + UNTERMINATED_STRING = 283, + STRING = 284, + WORD = 285, + CPP_INCLUDE_ANGLE = 286, + END = 287, + INCLUDE = 288, + INTERFACE = 289, + MODULE = 290, + USE = 291 }; #endif /* Tokens. */ @@ -103,23 +107,29 @@ extern int cmFortran_yydebug; #define F90PPR_ENDIF 280 #define COMMA 281 #define DCOLON 282 -#define CPP_TOENDL 283 -#define UNTERMINATED_STRING 284 -#define STRING 285 -#define WORD 286 -#define CPP_INCLUDE_ANGLE 287 +#define UNTERMINATED_STRING 283 +#define STRING 284 +#define WORD 285 +#define CPP_INCLUDE_ANGLE 286 +#define END 287 +#define INCLUDE 288 +#define INTERFACE 289 +#define MODULE 290 +#define USE 291 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; + union YYSTYPE { -#line 81 "cmFortranParser.y" /* yacc.c:1909 */ +#line 75 "cmFortranParser.y" /* yacc.c:1909 */ char* string; -#line 122 "cmFortranParserTokens.h" /* yacc.c:1909 */ +#line 130 "cmFortranParserTokens.h" /* yacc.c:1909 */ }; + +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index f0e4854..40c54db 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -76,7 +76,7 @@ public: }; bool cmFunctionHelperCommand::InvokeInitialPass( - const std::vector<cmListFileArgument>& args, cmExecutionStatus&) + const std::vector<cmListFileArgument>& args, cmExecutionStatus& inStatus) { // Expand the argument list to the function. std::vector<std::string> expandedArgs; @@ -129,11 +129,11 @@ bool cmFunctionHelperCommand::InvokeInitialPass( for (unsigned int c = 0; c < this->Functions.size(); ++c) { cmExecutionStatus status; if (!this->Makefile->ExecuteCommand(this->Functions[c], status) || - (cmSystemTools::GetErrorOccuredFlag() && - !cmSystemTools::GetFatalErrorOccured())) { + status.GetNestedError()) { // The error message should have already included the call stack // so we do not need to report an error here. functionScope.Quiet(); + inStatus.SetNestedError(true); return false; } if (status.GetReturnInvoked()) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index ee2907c..4f8c036 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -327,7 +327,6 @@ cmGeneratorTarget::~cmGeneratorTarget() cmDeleteAll(this->CompileDefinitionsEntries); cmDeleteAll(this->SourceEntries); cmDeleteAll(this->LinkInformation); - this->LinkInformation.clear(); } cmLocalGenerator* cmGeneratorTarget::GetLocalGenerator() const @@ -469,9 +468,8 @@ std::string cmGeneratorTarget::GetOutputName(const std::string& config, return i->second; } -void cmGeneratorTarget::AddSource(const std::string& src) +void cmGeneratorTarget::AddSourceCommon(const std::string& src) { - this->Target->AddSource(src); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmGeneratorExpression ge(lfbt); CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(src); @@ -481,19 +479,17 @@ void cmGeneratorTarget::AddSource(const std::string& src) this->LinkImplementationLanguageIsContextDependent = true; } +void cmGeneratorTarget::AddSource(const std::string& src) +{ + this->Target->AddSource(src); + this->AddSourceCommon(src); +} + void cmGeneratorTarget::AddTracedSources(std::vector<std::string> const& srcs) { this->Target->AddTracedSources(srcs); if (!srcs.empty()) { - std::string srcFiles = cmJoin(srcs, ";"); - this->SourceFilesMap.clear(); - this->LinkImplementationLanguageIsContextDependent = true; - cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); - cge->SetEvaluateForBuildsystem(true); - this->SourceEntries.push_back( - new cmGeneratorTarget::TargetPropertyEntry(cge)); + this->AddSourceCommon(cmJoin(srcs, ";")); } } @@ -840,14 +836,10 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory( &dagChecker, result, excludeImported); } - std::set<std::string> unique; - for (std::vector<std::string>::iterator li = result.begin(); - li != result.end(); ++li) { - cmSystemTools::ConvertToUnixSlashes(*li); - unique.insert(*li); - } - result.clear(); - result.insert(result.end(), unique.begin(), unique.end()); + std::for_each(result.begin(), result.end(), + cmSystemTools::ConvertToUnixSlashes); + std::sort(result.begin(), result.end()); + result.erase(std::unique(result.begin(), result.end()), result.end()); IncludeCacheType::value_type entry(config_upper, result); iter = this->SystemIncludesCache.insert(entry).first; @@ -1288,11 +1280,11 @@ bool cmGeneratorTarget::HasMacOSXRpathInstallNameDir( if (!this->Makefile->IsSet("CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG")) { std::ostringstream w; - w << "Attempting to use"; + w << "Attempting to use "; if (macosx_rpath) { - w << " MACOSX_RPATH"; + w << "MACOSX_RPATH"; } else { - w << " @rpath"; + w << "@rpath"; } w << " without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being set."; w << " This could be because you are using a Mac OS X version"; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 173f15d..715220e 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -540,6 +540,8 @@ public: std::string GetFortranModuleDirectory() const; private: + void AddSourceCommon(const std::string& src); + std::string CreateFortranModuleDirectory() const; mutable bool FortranModuleDirectoryCreated; mutable std::string FortranModuleDirectory; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ef8266f..e85d80e 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1068,8 +1068,8 @@ void cmGlobalGenerator::Configure() cmTargets* targets = &(mf->GetTargets()); cmTargets::iterator tit; for (tit = globalTargets.begin(); tit != globalTargets.end(); ++tit) { - (*targets)[tit->first] = tit->second; - (*targets)[tit->first].SetMakefile(mf); + targets->insert( + cmTargets::value_type(tit->first, tit->second.CopyForDirectory(mf))); } } @@ -2101,9 +2101,12 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) } } if (cmSystemTools::FileExists(configFile.c_str())) { - (*targets)[this->GetPackageTargetName()] = this->CreateGlobalTarget( - this->GetPackageTargetName(), "Run CPack packaging tool...", - &cpackCommandLines, depends, workingDir.c_str(), /*uses_terminal*/ true); + targets->insert(cmTargets::value_type( + this->GetPackageTargetName(), + this->CreateGlobalTarget(this->GetPackageTargetName(), + "Run CPack packaging tool...", + &cpackCommandLines, depends, workingDir.c_str(), + /*uses_terminal*/ true))); } // CPack source const char* packageSourceTargetName = this->GetPackageSourceTargetName(); @@ -2122,10 +2125,12 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) if (cmSystemTools::FileExists(configFile.c_str())) { singleLine.push_back(configFile); cpackCommandLines.push_back(singleLine); - (*targets)[packageSourceTargetName] = this->CreateGlobalTarget( - packageSourceTargetName, "Run CPack packaging tool for source...", - &cpackCommandLines, depends, workingDir.c_str(), - /*uses_terminal*/ true); + targets->insert(cmTargets::value_type( + packageSourceTargetName, + this->CreateGlobalTarget( + packageSourceTargetName, "Run CPack packaging tool for source...", + &cpackCommandLines, depends, workingDir.c_str(), + /*uses_terminal*/ true))); } } @@ -2146,10 +2151,11 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) singleLine.push_back("$(ARGS)"); } cpackCommandLines.push_back(singleLine); - (*targets)[this->GetTestTargetName()] = + targets->insert(cmTargets::value_type( + this->GetTestTargetName(), this->CreateGlobalTarget(this->GetTestTargetName(), "Running tests...", &cpackCommandLines, depends, CM_NULLPTR, - /*uses_terminal*/ true); + /*uses_terminal*/ true))); } // Edit Cache @@ -2167,18 +2173,22 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) singleLine.push_back("-H$(CMAKE_SOURCE_DIR)"); singleLine.push_back("-B$(CMAKE_BINARY_DIR)"); cpackCommandLines.push_back(singleLine); - (*targets)[editCacheTargetName] = this->CreateGlobalTarget( - editCacheTargetName, "Running CMake cache editor...", - &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true); + targets->insert(cmTargets::value_type( + editCacheTargetName, + this->CreateGlobalTarget( + editCacheTargetName, "Running CMake cache editor...", + &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true))); } else { singleLine.push_back(cmSystemTools::GetCMakeCommand()); singleLine.push_back("-E"); singleLine.push_back("echo"); singleLine.push_back("No interactive CMake dialog available."); cpackCommandLines.push_back(singleLine); - (*targets)[editCacheTargetName] = this->CreateGlobalTarget( - editCacheTargetName, "No interactive CMake dialog available...", - &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ false); + targets->insert(cmTargets::value_type( + editCacheTargetName, + this->CreateGlobalTarget( + editCacheTargetName, "No interactive CMake dialog available...", + &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ false))); } } @@ -2193,9 +2203,11 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) singleLine.push_back("-H$(CMAKE_SOURCE_DIR)"); singleLine.push_back("-B$(CMAKE_BINARY_DIR)"); cpackCommandLines.push_back(singleLine); - (*targets)[rebuildCacheTargetName] = this->CreateGlobalTarget( - rebuildCacheTargetName, "Running CMake to regenerate build system...", - &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true); + targets->insert(cmTargets::value_type( + rebuildCacheTargetName, + this->CreateGlobalTarget( + rebuildCacheTargetName, "Running CMake to regenerate build system...", + &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true))); } // Install @@ -2219,9 +2231,11 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) ostr << "Only default component available"; } singleLine.push_back(ostr.str()); - (*targets)["list_install_components"] = this->CreateGlobalTarget( - "list_install_components", ostr.str().c_str(), &cpackCommandLines, - depends, CM_NULLPTR, /*uses_terminal*/ false); + targets->insert(cmTargets::value_type( + "list_install_components", + this->CreateGlobalTarget("list_install_components", ostr.str().c_str(), + &cpackCommandLines, depends, CM_NULLPTR, + /*uses_terminal*/ false))); } std::string cmd = cmSystemTools::GetCMakeCommand(); cpackCommandLines.erase(cpackCommandLines.begin(), @@ -2260,9 +2274,11 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) singleLine.push_back("-P"); singleLine.push_back("cmake_install.cmake"); cpackCommandLines.push_back(singleLine); - (*targets)[this->GetInstallTargetName()] = this->CreateGlobalTarget( - this->GetInstallTargetName(), "Install the project...", - &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true); + targets->insert(cmTargets::value_type( + this->GetInstallTargetName(), + this->CreateGlobalTarget(this->GetInstallTargetName(), + "Install the project...", &cpackCommandLines, + depends, CM_NULLPTR, /*uses_terminal*/ true))); // install_local if (const char* install_local = this->GetInstallLocalTargetName()) { @@ -2274,9 +2290,11 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) cpackCommandLines.end()); cpackCommandLines.push_back(localCmdLine); - (*targets)[install_local] = this->CreateGlobalTarget( - install_local, "Installing only the local directory...", - &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true); + targets->insert(cmTargets::value_type( + install_local, + this->CreateGlobalTarget( + install_local, "Installing only the local directory...", + &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true))); } // install_strip @@ -2290,9 +2308,11 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) cpackCommandLines.end()); cpackCommandLines.push_back(stripCmdLine); - (*targets)[install_strip] = this->CreateGlobalTarget( - install_strip, "Installing the project stripped...", - &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true); + targets->insert(cmTargets::value_type( + install_strip, + this->CreateGlobalTarget( + install_strip, "Installing the project stripped...", + &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true))); } } } @@ -2332,8 +2352,8 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget( const char* workingDirectory, bool uses_terminal) { // Package - cmTarget target; - target.SetType(cmState::GLOBAL_TARGET, name); + cmTarget target(name, cmState::GLOBAL_TARGET, cmTarget::VisibilityNormal, + CM_NULLPTR); target.SetProperty("EXCLUDE_FROM_ALL", "TRUE"); std::vector<std::string> no_outputs; diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 819feb1..ac9c8ef 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -350,16 +350,36 @@ std::string const& cmGlobalVisualStudio10Generator::GetMSBuildCommand() std::string cmGlobalVisualStudio10Generator::FindMSBuildCommand() { std::string msbuild; - std::string mskey = - "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\"; + std::string mskey; + + // Search in standard location. + mskey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\"; mskey += this->GetToolsVersion(); mskey += ";MSBuildToolsPath"; if (cmSystemTools::ReadRegistryValue(mskey.c_str(), msbuild, cmSystemTools::KeyWOW64_32)) { cmSystemTools::ConvertToUnixSlashes(msbuild); - msbuild += "/"; + msbuild += "/MSBuild.exe"; + if (cmSystemTools::FileExists(msbuild, true)) { + return msbuild; + } + } + + // Search where VS15Preview places it. + mskey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;"; + mskey += this->GetIDEVersion(); + if (cmSystemTools::ReadRegistryValue(mskey.c_str(), msbuild, + cmSystemTools::KeyWOW64_32)) { + cmSystemTools::ConvertToUnixSlashes(msbuild); + msbuild += "/MSBuild/"; + msbuild += this->GetIDEVersion(); + msbuild += "/Bin/MSBuild.exe"; + if (cmSystemTools::FileExists(msbuild, true)) { + return msbuild; + } } - msbuild += "MSBuild.exe"; + + msbuild = "MSBuild.exe"; return msbuild; } @@ -462,6 +482,10 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf) { + if (this->DefaultPlatformToolset == "v100") { + // The v100 64-bit toolset does not exist in the express edition. + this->DefaultPlatformToolset.clear(); + } if (this->GetPlatformToolset()) { return true; } diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx new file mode 100644 index 0000000..98076c3 --- /dev/null +++ b/Source/cmGlobalVisualStudio15Generator.cxx @@ -0,0 +1,151 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2016 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGlobalVisualStudio15Generator.h" + +#include "cmAlgorithms.h" +#include "cmLocalVisualStudio10Generator.h" +#include "cmMakefile.h" + +static const char vs15generatorName[] = "Visual Studio 15"; + +// Map generator name without year to name with year. +static const char* cmVS15GenName(const std::string& name, std::string& genName) +{ + if (strncmp(name.c_str(), vs15generatorName, + sizeof(vs15generatorName) - 1) != 0) { + return 0; + } + const char* p = name.c_str() + sizeof(vs15generatorName) - 1; + genName = std::string(vs15generatorName) + p; + return p; +} + +class cmGlobalVisualStudio15Generator::Factory + : public cmGlobalGeneratorFactory +{ +public: + virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& name, + cmake* cm) const + { + std::string genName; + const char* p = cmVS15GenName(name, genName); + if (!p) { + return 0; + } + if (!*p) { + return new cmGlobalVisualStudio15Generator(cm, genName, ""); + } + if (*p++ != ' ') { + return 0; + } + if (strcmp(p, "Win64") == 0) { + return new cmGlobalVisualStudio15Generator(cm, genName, "x64"); + } + if (strcmp(p, "ARM") == 0) { + return new cmGlobalVisualStudio15Generator(cm, genName, "ARM"); + } + return 0; + } + + virtual void GetDocumentation(cmDocumentationEntry& entry) const + { + entry.Name = std::string(vs15generatorName) + " [arch]"; + entry.Brief = "Generates Visual Studio 15 project files. " + "Optional [arch] can be \"Win64\" or \"ARM\"."; + } + + virtual void GetGenerators(std::vector<std::string>& names) const + { + names.push_back(vs15generatorName); + names.push_back(vs15generatorName + std::string(" ARM")); + names.push_back(vs15generatorName + std::string(" Win64")); + } + + bool SupportsToolset() const CM_OVERRIDE { return true; } + bool SupportsPlatform() const CM_OVERRIDE { return true; } +}; + +cmGlobalGeneratorFactory* cmGlobalVisualStudio15Generator::NewFactory() +{ + return new Factory; +} + +cmGlobalVisualStudio15Generator::cmGlobalVisualStudio15Generator( + cmake* cm, const std::string& name, const std::string& platformName) + : cmGlobalVisualStudio14Generator(cm, name, platformName) +{ + std::string vc15Express; + this->ExpressEdition = cmSystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\15.0\\Setup\\VC;" + "ProductDir", + vc15Express, cmSystemTools::KeyWOW64_32); + this->DefaultPlatformToolset = "v140"; + this->Version = VS15; +} + +bool cmGlobalVisualStudio15Generator::MatchesGeneratorName( + const std::string& name) const +{ + std::string genName; + if (cmVS15GenName(name, genName)) { + return genName == this->GetName(); + } + return false; +} + +void cmGlobalVisualStudio15Generator::WriteSLNHeader(std::ostream& fout) +{ + // Visual Studio 15 writes .sln format 12.00 + fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; + if (this->ExpressEdition) { + fout << "# Visual Studio Express 15 for Windows Desktop\n"; + } else { + fout << "# Visual Studio 15\n"; + } +} + +bool cmGlobalVisualStudio15Generator::SelectWindowsStoreToolset( + std::string& toolset) const +{ + if (cmHasLiteralPrefix(this->SystemVersion, "10.0")) { + if (this->IsWindowsStoreToolsetInstalled() && + this->IsWindowsDesktopToolsetInstalled()) { + toolset = "v140"; // VS 15 uses v140 toolset + return true; + } else { + return false; + } + } + return this->cmGlobalVisualStudio14Generator::SelectWindowsStoreToolset( + toolset); +} + +bool cmGlobalVisualStudio15Generator::IsWindowsDesktopToolsetInstalled() const +{ + const char desktop10Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" + "VisualStudio\\15.0\\VC\\Runtimes"; + + std::vector<std::string> vc15; + return cmSystemTools::GetRegistrySubKeys(desktop10Key, vc15, + cmSystemTools::KeyWOW64_32); +} + +bool cmGlobalVisualStudio15Generator::IsWindowsStoreToolsetInstalled() const +{ + const char universal10Key[] = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" + "VisualStudio\\15.0\\Setup\\Build Tools for Windows 10;SrcPath"; + + std::string win10SDK; + return cmSystemTools::ReadRegistryValue(universal10Key, win10SDK, + cmSystemTools::KeyWOW64_32); +} diff --git a/Source/cmGlobalVisualStudio15Generator.h b/Source/cmGlobalVisualStudio15Generator.h new file mode 100644 index 0000000..f673883 --- /dev/null +++ b/Source/cmGlobalVisualStudio15Generator.h @@ -0,0 +1,46 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2016 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGlobalVisualStudio15Generator_h +#define cmGlobalVisualStudio15Generator_h + +#include "cmGlobalVisualStudio14Generator.h" + +/** \class cmGlobalVisualStudio15Generator */ +class cmGlobalVisualStudio15Generator : public cmGlobalVisualStudio14Generator +{ +public: + cmGlobalVisualStudio15Generator(cmake* cm, const std::string& name, + const std::string& platformName); + static cmGlobalGeneratorFactory* NewFactory(); + + virtual bool MatchesGeneratorName(const std::string& name) const; + + virtual void WriteSLNHeader(std::ostream& fout); + + virtual const char* GetToolsVersion() { return "15.0"; } +protected: + virtual bool SelectWindowsStoreToolset(std::string& toolset) const; + + virtual const char* GetIDEVersion() { return "15.0"; } + + // Used to verify that the Desktop toolset for the current generator is + // installed on the machine. + virtual bool IsWindowsDesktopToolsetInstalled() const; + + // These aren't virtual because we need to check if the selected version + // of the toolset is installed + bool IsWindowsStoreToolsetInstalled() const; + +private: + class Factory; +}; +#endif diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 08be304..0dc4497 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -150,13 +150,32 @@ std::string const& cmGlobalVisualStudio7Generator::GetDevEnvCommand() std::string cmGlobalVisualStudio7Generator::FindDevEnvCommand() { std::string vscmd; - std::string vskey = this->GetRegistryBase() + ";InstallDir"; + std::string vskey; + + // Search in standard location. + vskey = this->GetRegistryBase() + ";InstallDir"; if (cmSystemTools::ReadRegistryValue(vskey.c_str(), vscmd, cmSystemTools::KeyWOW64_32)) { cmSystemTools::ConvertToUnixSlashes(vscmd); - vscmd += "/"; + vscmd += "/devenv.com"; + if (cmSystemTools::FileExists(vscmd, true)) { + return vscmd; + } } - vscmd += "devenv.com"; + + // Search where VS15Preview places it. + vskey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;"; + vskey += this->GetIDEVersion(); + if (cmSystemTools::ReadRegistryValue(vskey.c_str(), vscmd, + cmSystemTools::KeyWOW64_32)) { + cmSystemTools::ConvertToUnixSlashes(vscmd); + vscmd += "/Common7/IDE/devenv.com"; + if (cmSystemTools::FileExists(vscmd, true)) { + return vscmd; + } + } + + vscmd = "devenv.com"; return vscmd; } diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 1d456ff..3312ed6 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -34,7 +34,8 @@ public: VS11 = 110, VS12 = 120, /* VS13 = 130 was skipped */ - VS14 = 140 + VS14 = 140, + VS15 = 150 }; cmGlobalVisualStudioGenerator(cmake* cm); diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 4912eac..e464bce 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -83,6 +83,8 @@ bool cmInstallCommand::InitialPass(std::vector<std::string> const& args, return this->HandleDirectoryMode(args); } else if (args[0] == "EXPORT") { return this->HandleExportMode(args); + } else if (args[0] == "EXPORT_ANDROID_MK") { + return this->HandleExportAndroidMKMode(args); } // Unknown mode. @@ -1097,6 +1099,100 @@ bool cmInstallCommand::HandleDirectoryMode( return true; } +bool cmInstallCommand::HandleExportAndroidMKMode( + std::vector<std::string> const& args) +{ +#ifdef CMAKE_BUILD_WITH_CMAKE + // This is the EXPORT mode. + cmInstallCommandArguments ica(this->DefaultComponentName); + cmCAString exp(&ica.Parser, "EXPORT_ANDROID_MK"); + cmCAString name_space(&ica.Parser, "NAMESPACE", &ica.ArgumentGroup); + cmCAEnabler exportOld(&ica.Parser, "EXPORT_LINK_INTERFACE_LIBRARIES", + &ica.ArgumentGroup); + cmCAString filename(&ica.Parser, "FILE", &ica.ArgumentGroup); + exp.Follows(0); + + ica.ArgumentGroup.Follows(&exp); + std::vector<std::string> unknownArgs; + ica.Parse(&args, &unknownArgs); + + if (!unknownArgs.empty()) { + // Unknown argument. + std::ostringstream e; + e << args[0] << " given unknown argument \"" << unknownArgs[0] << "\"."; + this->SetError(e.str()); + return false; + } + + if (!ica.Finalize()) { + return false; + } + + // Make sure there is a destination. + if (ica.GetDestination().empty()) { + // A destination is required. + std::ostringstream e; + e << args[0] << " given no DESTINATION!"; + this->SetError(e.str()); + return false; + } + + // Check the file name. + std::string fname = filename.GetString(); + if (fname.find_first_of(":/\\") != fname.npos) { + std::ostringstream e; + e << args[0] << " given invalid export file name \"" << fname << "\". " + << "The FILE argument may not contain a path. " + << "Specify the path in the DESTINATION argument."; + this->SetError(e.str()); + return false; + } + + // Check the file extension. + if (!fname.empty() && + cmSystemTools::GetFilenameLastExtension(fname) != ".mk") { + std::ostringstream e; + e << args[0] << " given invalid export file name \"" << fname << "\". " + << "The FILE argument must specify a name ending in \".mk\"."; + this->SetError(e.str()); + return false; + } + if (fname.find_first_of(":/\\") != fname.npos) { + std::ostringstream e; + e << args[0] << " given export name \"" << exp.GetString() << "\". " + << "This name cannot be safely converted to a file name. " + << "Specify a different export name or use the FILE option to set " + << "a file name explicitly."; + this->SetError(e.str()); + return false; + } + // Use the default name + if (fname.empty()) { + fname = "Android.mk"; + } + + cmExportSet* exportSet = + this->Makefile->GetGlobalGenerator()->GetExportSets()[exp.GetString()]; + + cmInstallGenerator::MessageLevel message = + cmInstallGenerator::SelectMessageLevel(this->Makefile); + + // Create the export install generator. + cmInstallExportGenerator* exportGenerator = new cmInstallExportGenerator( + exportSet, ica.GetDestination().c_str(), ica.GetPermissions().c_str(), + ica.GetConfigurations(), ica.GetComponent().c_str(), message, + ica.GetExcludeFromAll(), fname.c_str(), name_space.GetCString(), + exportOld.IsEnabled(), true); + this->Makefile->AddInstallGenerator(exportGenerator); + + return true; +#else + static_cast<void>(args); + this->SetError("EXPORT_ANDROID_MK not supported in bootstrap cmake"); + return false; +#endif +} + bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) { // This is the EXPORT mode. @@ -1203,7 +1299,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) exportSet, ica.GetDestination().c_str(), ica.GetPermissions().c_str(), ica.GetConfigurations(), ica.GetComponent().c_str(), message, ica.GetExcludeFromAll(), fname.c_str(), name_space.GetCString(), - exportOld.IsEnabled()); + exportOld.IsEnabled(), false); this->Makefile->AddInstallGenerator(exportGenerator); return true; diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index 3718ad5..7bc974c 100644 --- a/Source/cmInstallCommand.h +++ b/Source/cmInstallCommand.h @@ -48,6 +48,7 @@ private: bool HandleFilesMode(std::vector<std::string> const& args); bool HandleDirectoryMode(std::vector<std::string> const& args); bool HandleExportMode(std::vector<std::string> const& args); + bool HandleExportAndroidMKMode(std::vector<std::string> const& args); bool MakeFilesFullPath(const char* modeName, const std::vector<std::string>& relFiles, std::vector<std::string>& absFiles); diff --git a/Source/cmInstallExportAndroidMKGenerator.cxx b/Source/cmInstallExportAndroidMKGenerator.cxx new file mode 100644 index 0000000..43bdc01 --- /dev/null +++ b/Source/cmInstallExportAndroidMKGenerator.cxx @@ -0,0 +1,149 @@ + +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmInstallExportAndroidMKGenerator.h" + +#include <stdio.h> + +#include "cmExportInstallFileGenerator.h" +#include "cmExportSet.h" +#include "cmGeneratedFileStream.h" +#include "cmGlobalGenerator.h" +#include "cmInstallFilesGenerator.h" +#include "cmInstallTargetGenerator.h" +#include "cmLocalGenerator.h" +#include "cmMakefile.h" +#include "cmake.h" + +cmInstallExportAndroidMKGenerator::cmInstallExportAndroidMKGenerator( + cmExportSet* exportSet, const char* destination, + const char* file_permissions, std::vector<std::string> const& configurations, + const char* component, MessageLevel message, bool exclude_from_all, + const char* filename, const char* name_space, bool exportOld) + : cmInstallExportGenerator(exportSet, destination, file_permissions, + configurations, component, message, + exclude_from_all, filename, name_space, exportOld) +{ +} + +cmInstallExportAndroidMKGenerator::~cmInstallExportAndroidMKGenerator() +{ +} + +void cmInstallExportAndroidMKGenerator::Compute(cmLocalGenerator* lg) +{ + this->LocalGenerator = lg; + this->ExportSet->Compute(lg); +} + +void cmInstallExportAndroidMKGenerator::GenerateScript(std::ostream& os) +{ + // Skip empty sets. + if (ExportSet->GetTargetExports()->empty()) { + std::ostringstream e; + e << "INSTALL(EXPORT) given unknown export \"" << ExportSet->GetName() + << "\""; + cmSystemTools::Error(e.str().c_str()); + return; + } + + // Create the temporary directory in which to store the files. + this->ComputeTempDir(); + cmSystemTools::MakeDirectory(this->TempDir.c_str()); + + // Construct a temporary location for the file. + this->MainImportFile = this->TempDir; + this->MainImportFile += "/"; + this->MainImportFile += this->FileName; + + // Generate the import file for this export set. + this->EFGen->SetExportFile(this->MainImportFile.c_str()); + this->EFGen->SetNamespace(this->Namespace); + this->EFGen->SetExportOld(this->ExportOld); + if (this->ConfigurationTypes->empty()) { + if (!this->ConfigurationName.empty()) { + this->EFGen->AddConfiguration(this->ConfigurationName); + } else { + this->EFGen->AddConfiguration(""); + } + } else { + for (std::vector<std::string>::const_iterator ci = + this->ConfigurationTypes->begin(); + ci != this->ConfigurationTypes->end(); ++ci) { + this->EFGen->AddConfiguration(*ci); + } + } + this->EFGen->GenerateImportFile(); + + // Perform the main install script generation. + this->cmInstallGenerator::GenerateScript(os); +} + +void cmInstallExportAndroidMKGenerator::GenerateScriptConfigs( + std::ostream& os, Indent const& indent) +{ + // Create the main install rules first. + this->cmInstallGenerator::GenerateScriptConfigs(os, indent); + + // Now create a configuration-specific install rule for the import + // file of each configuration. + std::vector<std::string> files; + for (std::map<std::string, std::string>::const_iterator i = + this->EFGen->GetConfigImportFiles().begin(); + i != this->EFGen->GetConfigImportFiles().end(); ++i) { + files.push_back(i->second); + std::string config_test = this->CreateConfigTest(i->first); + os << indent << "if(" << config_test << ")\n"; + this->AddInstallRule(os, this->Destination, cmInstallType_FILES, files, + false, this->FilePermissions.c_str(), CM_NULLPTR, + CM_NULLPTR, CM_NULLPTR, indent.Next()); + os << indent << "endif()\n"; + files.clear(); + } +} + +void cmInstallExportAndroidMKGenerator::GenerateScriptActions( + std::ostream& os, Indent const& indent) +{ + // Remove old per-configuration export files if the main changes. + std::string installedDir = "$ENV{DESTDIR}"; + installedDir += this->ConvertToAbsoluteDestination(this->Destination); + installedDir += "/"; + std::string installedFile = installedDir; + installedFile += this->FileName; + os << indent << "if(EXISTS \"" << installedFile << "\")\n"; + Indent indentN = indent.Next(); + Indent indentNN = indentN.Next(); + Indent indentNNN = indentNN.Next(); + /* clang-format off */ + os << indentN << "file(DIFFERENT EXPORT_FILE_CHANGED FILES\n" + << indentN << " \"" << installedFile << "\"\n" + << indentN << " \"" << this->MainImportFile << "\")\n"; + os << indentN << "if(EXPORT_FILE_CHANGED)\n"; + os << indentNN << "file(GLOB OLD_CONFIG_FILES \"" << installedDir + << this->EFGen->GetConfigImportFileGlob() << "\")\n"; + os << indentNN << "if(OLD_CONFIG_FILES)\n"; + os << indentNNN << "message(STATUS \"Old export file \\\"" << installedFile + << "\\\" will be replaced. Removing files [${OLD_CONFIG_FILES}].\")\n"; + os << indentNNN << "file(REMOVE ${OLD_CONFIG_FILES})\n"; + os << indentNN << "endif()\n"; + os << indentN << "endif()\n"; + os << indent << "endif()\n"; + /* clang-format on */ + + // Install the main export file. + std::vector<std::string> files; + files.push_back(this->MainImportFile); + this->AddInstallRule(os, this->Destination, cmInstallType_FILES, files, + false, this->FilePermissions.c_str(), CM_NULLPTR, + CM_NULLPTR, CM_NULLPTR, indent); +} diff --git a/Source/cmInstallExportAndroidMKGenerator.h b/Source/cmInstallExportAndroidMKGenerator.h new file mode 100644 index 0000000..158972d --- /dev/null +++ b/Source/cmInstallExportAndroidMKGenerator.h @@ -0,0 +1,46 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmInstallExportAndroidMKGenerator_h +#define cmInstallExportAndroidMKGenerator_h + +#include "cmInstallExportGenerator.h" + +class cmExportInstallFileGenerator; +class cmInstallFilesGenerator; +class cmInstallTargetGenerator; +class cmExportSet; +class cmMakefile; + +/** \class cmInstallExportAndroidMKGenerator + * \brief Generate rules for creating an export files. + */ +class cmInstallExportAndroidMKGenerator : public cmInstallExportGenerator +{ +public: + cmInstallExportAndroidMKGenerator( + cmExportSet* exportSet, const char* dest, const char* file_permissions, + const std::vector<std::string>& configurations, const char* component, + MessageLevel message, bool exclude_from_all, const char* filename, + const char* name_space, bool exportOld); + ~cmInstallExportAndroidMKGenerator(); + + void Compute(cmLocalGenerator* lg); + +protected: + virtual void GenerateScript(std::ostream& os); + virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent); + virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); + void GenerateImportFile(cmExportSet const* exportSet); + void GenerateImportFile(const char* config, cmExportSet const* exportSet); +}; + +#endif diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 27628f4..5ea7faf 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -16,6 +16,9 @@ #include <sstream> #include <utility> +#ifdef CMAKE_BUILD_WITH_CMAKE +#include "cmExportInstallAndroidMKGenerator.h" +#endif #include "cmExportInstallFileGenerator.h" #include "cmExportSet.h" #include "cmInstallType.h" @@ -27,7 +30,7 @@ cmInstallExportGenerator::cmInstallExportGenerator( cmExportSet* exportSet, const char* destination, const char* file_permissions, std::vector<std::string> const& configurations, const char* component, MessageLevel message, bool exclude_from_all, - const char* filename, const char* name_space, bool exportOld) + const char* filename, const char* name_space, bool exportOld, bool android) : cmInstallGenerator(destination, configurations, component, message, exclude_from_all) , ExportSet(exportSet) @@ -37,7 +40,13 @@ cmInstallExportGenerator::cmInstallExportGenerator( , ExportOld(exportOld) , LocalGenerator(CM_NULLPTR) { - this->EFGen = new cmExportInstallFileGenerator(this); + if (android) { +#ifdef CMAKE_BUILD_WITH_CMAKE + this->EFGen = new cmExportInstallAndroidMKGenerator(this); +#endif + } else { + this->EFGen = new cmExportInstallFileGenerator(this); + } exportSet->AddInstallation(this); } diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h index 5539827..ac02386 100644 --- a/Source/cmInstallExportGenerator.h +++ b/Source/cmInstallExportGenerator.h @@ -37,7 +37,8 @@ public: const std::vector<std::string>& configurations, const char* component, MessageLevel message, bool exclude_from_all, const char* filename, - const char* name_space, bool exportOld); + const char* name_space, bool exportOld, + bool android); ~cmInstallExportGenerator() CM_OVERRIDE; cmExportSet* GetExportSet() { return this->ExportSet; } diff --git a/Source/cmInstallTargetsCommand.cxx b/Source/cmInstallTargetsCommand.cxx index 056ea24..6b594b6 100644 --- a/Source/cmInstallTargetsCommand.cxx +++ b/Source/cmInstallTargetsCommand.cxx @@ -37,14 +37,17 @@ bool cmInstallTargetsCommand::InitialPass(std::vector<std::string> const& args, } runtime_dir = *s; - } else if (tgts.find(*s) != tgts.end()) { - tgts[*s].SetInstallPath(args[0].c_str()); - tgts[*s].SetRuntimeInstallPath(runtime_dir.c_str()); - tgts[*s].SetHaveInstallRule(true); } else { - std::string str = "Cannot find target: \"" + *s + "\" to install."; - this->SetError(str); - return false; + cmTargets::iterator ti = tgts.find(*s); + if (ti != tgts.end()) { + ti->second.SetInstallPath(args[0].c_str()); + ti->second.SetRuntimeInstallPath(runtime_dir.c_str()); + ti->second.SetHaveInstallRule(true); + } else { + std::string str = "Cannot find target: \"" + *s + "\" to install."; + this->SetError(str); + return false; + } } } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 694a9f6..a76bed3 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -175,15 +175,14 @@ void cmLocalGenerator::GenerateTestFiles() (*gi)->Compute(this); (*gi)->Generate(fout, config, configurationTypes); } - size_t i; - std::vector<cmState::Snapshot> children = - this->Makefile->GetStateSnapshot().GetChildren(); - for (i = 0; i < children.size(); ++i) { + typedef std::vector<cmState::Snapshot> vec_t; + vec_t const& children = this->Makefile->GetStateSnapshot().GetChildren(); + for (vec_t::const_iterator i = children.begin(); i != children.end(); ++i) { // TODO: Use add_subdirectory instead? - fout << "subdirs("; - std::string outP = children[i].GetDirectory().GetCurrentBinary(); - fout << this->ConvertToRelativePath(outP, START_OUTPUT); - fout << ")" << std::endl; + std::string outP = i->GetDirectory().GetCurrentBinary(); + outP = this->ConvertToRelativePath(outP, START_OUTPUT); + outP = cmOutputConverter::EscapeForCMake(outP); + fout << "subdirs(" << outP << ")" << std::endl; } } @@ -1531,9 +1530,6 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, linkLibs += " "; } - // Write the library flags to the build rule. - fout << linkLibs; - // Check what kind of rpath flags to use. if (cli.GetRuntimeSep().empty()) { // Each rpath entry gets its own option ("-R a -R b -R c") @@ -1560,6 +1556,9 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, } } + // Write the library flags to the build rule. + fout << linkLibs; + // Add the linker runtime search path if any. std::string rpath_link = cli.GetRPathLinkString(); if (!cli.GetRPathLinkFlag().empty() && !rpath_link.empty()) { diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 9d312ee..ee9dc8a 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -159,11 +159,11 @@ bool cmMacroHelperCommand::InvokeInitialPass( } cmExecutionStatus status; if (!this->Makefile->ExecuteCommand(newLFF, status) || - (cmSystemTools::GetErrorOccuredFlag() && - !cmSystemTools::GetFatalErrorOccured())) { + status.GetNestedError()) { // The error message should have already included the call stack // so we do not need to report an error here. macroScope.Quiet(); + inStatus.SetNestedError(true); return false; } if (status.GetReturnInvoked()) { diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 11ccca1..508c670 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -117,6 +117,11 @@ cmMakefile::~cmMakefile() void cmMakefile::IssueMessage(cmake::MessageType t, std::string const& text) const { + if (!this->ExecutionStatusStack.empty()) { + if ((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR)) { + this->ExecutionStatusStack.back()->SetNestedError(true); + } + } this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace()); } @@ -277,19 +282,11 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, if (this->GetCMakeInstance()->GetTrace()) { this->PrintCommandTrace(lff); } - - bool hadPreviousNonFatalError = cmSystemTools::GetErrorOccuredFlag() && - !cmSystemTools::GetFatalErrorOccured(); - cmSystemTools::ResetErrorOccuredFlag(); - + // Try invoking the command. bool invokeSucceeded = pcmd->InvokeInitialPass(lff.Arguments, status); - bool hadNestedError = cmSystemTools::GetErrorOccuredFlag() && - !cmSystemTools::GetFatalErrorOccured(); - if (hadPreviousNonFatalError) { - cmSystemTools::SetErrorOccured(); - } + bool hadNestedError = status.GetNestedError(); if (!invokeSucceeded || hadNestedError) { - if (!hadNestedError && !cmSystemTools::GetFatalErrorOccured()) { + if (!hadNestedError) { // The command invocation requested that we report an error. this->IssueMessage(cmake::FATAL_ERROR, pcmd->GetError()); } @@ -982,8 +979,9 @@ void cmMakefile::AddCustomCommandOldStyle( // then add the source to the target to make sure the rule is // included. if (sf && !sf->GetPropertyAsBool("__CMAKE_RULE")) { - if (this->Targets.find(target) != this->Targets.end()) { - this->Targets[target].AddSource(sf->GetFullPath()); + cmTargets::iterator ti = this->Targets.find(target); + if (ti != this->Targets.end()) { + ti->second.AddSource(sf->GetFullPath()); } else { cmSystemTools::Error("Attempt to add a custom rule to a target " "that does not exist yet for target ", @@ -1927,10 +1925,10 @@ cmTarget* cmMakefile::AddNewTarget(cmState::TargetType type, const std::string& name) { cmTargets::iterator it = - this->Targets.insert(cmTargets::value_type(name, cmTarget())).first; - cmTarget& target = it->second; - target.SetType(type, name); - target.SetMakefile(this); + this->Targets + .insert(cmTargets::value_type( + name, cmTarget(name, type, cmTarget::VisibilityNormal, this))) + .first; this->GetGlobalGenerator()->IndexTarget(&it->second); return &it->second; } @@ -3712,10 +3710,10 @@ cmTarget* cmMakefile::AddImportedTarget(const std::string& name, cmState::TargetType type, bool global) { // Create the target. - CM_AUTO_PTR<cmTarget> target(new cmTarget); - target->SetType(type, name); - target->MarkAsImported(global); - target->SetMakefile(this); + CM_AUTO_PTR<cmTarget> target( + new cmTarget(name, type, global ? cmTarget::VisibilityImportedGlobally + : cmTarget::VisibilityImported, + this)); // Add to the set of available imported targets. this->ImportedTargets[name] = target.get(); diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx index 8f524ec..f9313c5 100644 --- a/Source/cmParseArgumentsCommand.cxx +++ b/Source/cmParseArgumentsCommand.cxx @@ -20,6 +20,8 @@ bool cmParseArgumentsCommand::InitialPass(std::vector<std::string> const& args, { // cmake_parse_arguments(prefix options single multi <ARGN>) // 1 2 3 4 + // or + // cmake_parse_arguments(PARSE_ARGV N prefix options single multi) if (args.size() < 4) { this->SetError("must be called with at least 4 arguments."); return false; @@ -27,6 +29,27 @@ bool cmParseArgumentsCommand::InitialPass(std::vector<std::string> const& args, std::vector<std::string>::const_iterator argIter = args.begin(), argEnd = args.end(); + bool parseFromArgV = false; + unsigned long argvStart = 0; + if (*argIter == "PARSE_ARGV") { + if (args.size() != 6) { + this->Makefile->IssueMessage( + cmake::FATAL_ERROR, + "PARSE_ARGV must be called with exactly 6 arguments."); + cmSystemTools::SetFatalErrorOccured(); + return true; + } + parseFromArgV = true; + argIter++; // move past PARSE_ARGV + if (!cmSystemTools::StringToULong(argIter->c_str(), &argvStart)) { + this->Makefile->IssueMessage(cmake::FATAL_ERROR, "PARSE_ARGV index '" + + *argIter + + "' is not an unsigned integer"); + cmSystemTools::SetFatalErrorOccured(); + return true; + } + argIter++; // move past N + } // the first argument is the prefix const std::string prefix = (*argIter++) + "_"; @@ -90,11 +113,37 @@ bool cmParseArgumentsCommand::InitialPass(std::vector<std::string> const& args, } insideValues = NONE; std::string currentArgName; - // Flatten ;-lists in the arguments into a single list as was done - // by the original function(CMAKE_PARSE_ARGUMENTS). list.clear(); - for (; argIter != argEnd; ++argIter) { - cmSystemTools::ExpandListArgument(*argIter, list); + if (!parseFromArgV) { + // Flatten ;-lists in the arguments into a single list as was done + // by the original function(CMAKE_PARSE_ARGUMENTS). + for (; argIter != argEnd; ++argIter) { + cmSystemTools::ExpandListArgument(*argIter, list); + } + } else { + // in the PARSE_ARGV move read the arguments from ARGC and ARGV# + std::string argc = this->Makefile->GetSafeDefinition("ARGC"); + unsigned long count; + if (!cmSystemTools::StringToULong(argc.c_str(), &count)) { + this->Makefile->IssueMessage(cmake::FATAL_ERROR, + "PARSE_ARGV called with ARGC='" + argc + + "' that is not an unsigned integer"); + cmSystemTools::SetFatalErrorOccured(); + return true; + } + for (unsigned long i = argvStart; i < count; ++i) { + std::ostringstream argName; + argName << "ARGV" << i; + const char* arg = this->Makefile->GetDefinition(argName.str()); + if (!arg) { + this->Makefile->IssueMessage(cmake::FATAL_ERROR, + "PARSE_ARGV called with " + + argName.str() + " not set"); + cmSystemTools::SetFatalErrorOccured(); + return true; + } + list.push_back(arg); + } } // iterate over the arguments list and fill in the values where applicable diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index a0a9c50..36ed614 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1766,9 +1766,7 @@ bool cmSystemTools::CopyFileTime(const char* fromFile, const char* toFile) if (!GetFileTime(hFrom, &timeCreation, &timeLastAccess, &timeLastWrite)) { return false; } - if (!SetFileTime(hTo, &timeCreation, &timeLastAccess, &timeLastWrite)) { - return false; - } + return SetFileTime(hTo, &timeCreation, &timeLastAccess, &timeLastWrite) != 0; #else struct stat fromStat; if (stat(fromFile, &fromStat) < 0) { @@ -1778,11 +1776,8 @@ bool cmSystemTools::CopyFileTime(const char* fromFile, const char* toFile) struct utimbuf buf; buf.actime = fromStat.st_atime; buf.modtime = fromStat.st_mtime; - if (utime(toFile, &buf) < 0) { - return false; - } + return utime(toFile, &buf) >= 0; #endif - return true; } cmSystemToolsFileTime* cmSystemTools::FileTimeNew() @@ -1828,16 +1823,11 @@ bool cmSystemTools::FileTimeSet(const char* fname, cmSystemToolsFileTime* t) if (!h) { return false; } - if (!SetFileTime(h, &t->timeCreation, &t->timeLastAccess, - &t->timeLastWrite)) { - return false; - } + return SetFileTime(h, &t->timeCreation, &t->timeLastAccess, + &t->timeLastWrite) != 0; #else - if (utime(fname, &t->timeBuf) < 0) { - return false; - } + return utime(fname, &t->timeBuf) >= 0; #endif - return true; } #ifdef _WIN32 diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d5274cd..d964f00 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -59,28 +59,41 @@ public: std::vector<cmListFileBacktrace> LinkImplementationPropertyBacktraces; }; -cmTarget::cmTarget() +cmTarget::cmTarget(std::string const& name, cmState::TargetType type, + Visibility vis, cmMakefile* mf) { + assert(mf || type == cmState::GLOBAL_TARGET); + this->Name = name; + this->TargetTypeValue = type; this->Makefile = CM_NULLPTR; this->HaveInstallRule = false; this->DLLPlatform = false; this->IsAndroid = false; - this->IsImportedTarget = false; - this->ImportedGloballyVisible = false; + this->IsImportedTarget = + (vis == VisibilityImported || vis == VisibilityImportedGlobally); + this->ImportedGloballyVisible = vis == VisibilityImportedGlobally; this->BuildInterfaceIncludesAppended = false; -} -void cmTarget::SetType(cmState::TargetType type, const std::string& name) -{ - this->Name = name; // only add dependency information for library targets - this->TargetTypeValue = type; if (this->TargetTypeValue >= cmState::STATIC_LIBRARY && this->TargetTypeValue <= cmState::MODULE_LIBRARY) { this->RecordDependencies = true; } else { this->RecordDependencies = false; } + + if (mf) { + this->SetMakefile(mf); + } +} + +cmTarget cmTarget::CopyForDirectory(cmMakefile* mf) const +{ + assert(this->GetType() == cmState::GLOBAL_TARGET); + assert(this->GetMakefile() == CM_NULLPTR); + cmTarget result(*this); + result.SetMakefile(mf); + return result; } void cmTarget::SetMakefile(cmMakefile* mf) @@ -1062,12 +1075,6 @@ void cmTarget::CheckProperty(const std::string& prop, } } -void cmTarget::MarkAsImported(bool global) -{ - this->IsImportedTarget = true; - this->ImportedGloballyVisible = global; -} - bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const { if (this->IsImported()) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index fc30166..ebc92f3 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -63,7 +63,16 @@ private: class cmTarget { public: - cmTarget(); + enum Visibility + { + VisibilityNormal, + VisibilityImported, + VisibilityImportedGlobally + }; + + cmTarget(std::string const& name, cmState::TargetType type, Visibility vis, + cmMakefile* mf); + enum CustomCommandType { PRE_BUILD, @@ -76,18 +85,13 @@ public: */ cmState::TargetType GetType() const { return this->TargetTypeValue; } - /** - * Set the target type - */ - void SetType(cmState::TargetType f, const std::string& name); - - void MarkAsImported(bool global = false); - ///! Set/Get the name of the target const std::string& GetName() const { return this->Name; } - ///! Set the cmMakefile that owns this target - void SetMakefile(cmMakefile* mf); + /** Get a copy of this target adapted for the given directory. */ + cmTarget CopyForDirectory(cmMakefile* mf) const; + + /** Get the cmMakefile that owns this target. */ cmMakefile* GetMakefile() const { return this->Makefile; } #define DECLARE_TARGET_POLICY(POLICY) \ @@ -279,6 +283,8 @@ public: }; private: + void SetMakefile(cmMakefile* mf); + bool HandleLocationPropertyPolicy(cmMakefile* context) const; const char* GetSuffixVariableInternal(bool implib) const; diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx index 61b74db..a94212c 100644 --- a/Source/cmTimestamp.cxx +++ b/Source/cmTimestamp.cxx @@ -123,6 +123,8 @@ std::string cmTimestamp::AddTimestampComponent(char flag, formatString += flag; switch (flag) { + case 'a': + case 'b': case 'd': case 'H': case 'I': diff --git a/Source/cmVS14CLFlagTable.h b/Source/cmVS14CLFlagTable.h index 5812e79..c48db68 100644 --- a/Source/cmVS14CLFlagTable.h +++ b/Source/cmVS14CLFlagTable.h @@ -60,6 +60,9 @@ static cmVS7FlagTable cmVS14CLFlagTable[] = { { "BufferSecurityCheck", "GS-", "Disable Security Check", "false", 0 }, { "BufferSecurityCheck", "GS", "Enable Security Check", "true", 0 }, + { "ControlFlowGuard", "guard:cf", "Yes", "Guard", 0 }, + { "ControlFlowGuard", "", "No", "false", 0 }, + { "EnableEnhancedInstructionSet", "arch:SSE", "Streaming SIMD Extensions", "StreamingSIMDExtensions", 0 }, { "EnableEnhancedInstructionSet", "arch:SSE2", "Streaming SIMD Extensions 2", @@ -76,6 +79,10 @@ static cmVS7FlagTable cmVS14CLFlagTable[] = { { "FloatingPointModel", "fp:strict", "Strict", "Strict", 0 }, { "FloatingPointModel", "fp:fast", "Fast", "Fast", 0 }, + { "LanguageStandard", "std:c++14", "ISO C++14 Standard", "stdcpp14", 0 }, + { "LanguageStandard", "std:c++latest", "ISO C++ Latest Draft Standard", + "stdcpplatest", 0 }, + { "PrecompiledHeader", "Yc", "Create", "Create", cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue }, { "PrecompiledHeader", "Yu", "Use", "Use", @@ -164,6 +171,9 @@ static cmVS7FlagTable cmVS14CLFlagTable[] = { { "TreatWChar_tAsBuiltInType", "Zc:wchar_t", "", "true", 0 }, { "ForceConformanceInForLoopScope", "Zc:forScope-", "", "false", 0 }, { "ForceConformanceInForLoopScope", "Zc:forScope", "", "true", 0 }, + { "RemoveUnreferencedCodeData", "Zc:inline", "", "true", 0 }, + { "EnforceTypeConversionRules", "Zc:rvalueCast-", "", "false", 0 }, + { "EnforceTypeConversionRules", "Zc:rvalueCast", "", "true", 0 }, { "RuntimeTypeInfo", "GR-", "", "false", 0 }, { "RuntimeTypeInfo", "GR", "", "true", 0 }, { "OpenMPSupport", "openmp-", "", "false", 0 }, @@ -215,6 +225,8 @@ static cmVS7FlagTable cmVS14CLFlagTable[] = { "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable }, // String Properties + { "WarningVersion", "Wv:", "Warning Version", "", + cmVS7FlagTable::UserValue }, // Skip [TrackerLogDirectory] - no command line Switch. { "PreprocessOutputPath", "Fi", "Preprocess Output Path", "", cmVS7FlagTable::UserValue }, diff --git a/Source/cmVS14LinkFlagTable.h b/Source/cmVS14LinkFlagTable.h index 6e56422..596f880 100644 --- a/Source/cmVS14LinkFlagTable.h +++ b/Source/cmVS14LinkFlagTable.h @@ -35,6 +35,12 @@ static cmVS7FlagTable cmVS14LinkFlagTable[] = { { "UACExecutionLevel", "level='requireAdministrator'", "requireAdministrator", "RequireAdministrator", 0 }, + { "GenerateDebugInformation", "DEBUG:FASTLINK", + "Optimize for faster linking", "DebugFastLink", + cmVS7FlagTable::CaseInsensitive }, + { "GenerateDebugInformation", "DEBUG", "Optimize for debugging", "Debug", + cmVS7FlagTable::CaseInsensitive }, + { "SubSystem", "", "Not Set", "NotSet", 0 }, { "SubSystem", "SUBSYSTEM:CONSOLE", "Console", "Console", 0 }, { "SubSystem", "SUBSYSTEM:WINDOWS", "Windows", "Windows", 0 }, @@ -54,6 +60,8 @@ static cmVS7FlagTable cmVS14LinkFlagTable[] = { { "Driver", "DRIVER:WDM", "WDM", "WDM", 0 }, { "LinkTimeCodeGeneration", "", "Default", "Default", 0 }, + { "LinkTimeCodeGeneration", "LTCG:incremental", + "Use Fast Link Time Code Generation", "UseFastLinkTimeCodeGeneration", 0 }, { "LinkTimeCodeGeneration", "LTCG", "Use Link Time Code Generation", "UseLinkTimeCodeGeneration", 0 }, { "LinkTimeCodeGeneration", "LTCG:PGInstrument", @@ -121,6 +129,9 @@ static cmVS7FlagTable cmVS14LinkFlagTable[] = { { "CLRSupportLastError", "CLRSupportLastError:SYSTEMDLL", "System Dlls Only", "SystemDlls", 0 }, + { "LinkControlFlowGuard", "guard:cf", "Enable Security Check with Guard", + "Guard", 0 }, + // Bool Properties { "LinkIncremental", "INCREMENTAL:NO", "", "false", 0 }, { "LinkIncremental", "INCREMENTAL", "", "true", 0 }, @@ -138,10 +149,6 @@ static cmVS7FlagTable cmVS14LinkFlagTable[] = { { "UACUIAccess", "uiAccess='false'", "", "false", 0 }, { "UACUIAccess", "uiAccess='true'", "", "true", 0 }, { "ManifestEmbed", "manifest:embed", "", "true", 0 }, - { "GenerateDebugInformation", "DEBUG:FASTLINK", "", "DebugFastLink", - cmVS7FlagTable::CaseInsensitive }, - { "GenerateDebugInformation", "DEBUG", "", "Debug", - cmVS7FlagTable::CaseInsensitive }, { "MapExports", "MAPINFO:EXPORTS", "", "true", 0 }, { "AssemblyDebug", "ASSEMBLYDEBUG:DISABLE", "", "false", 0 }, { "AssemblyDebug", "ASSEMBLYDEBUG", "", "true", 0 }, @@ -195,6 +202,8 @@ static cmVS7FlagTable cmVS14LinkFlagTable[] = { { "AdditionalLibraryDirectories", "LIBPATH:", "Additional Library Directories", "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable }, + { "Natvis", "NATVIS:", "Natvis files", "", + cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable }, // Skip [AdditionalDependencies] - no command line Switch. { "IgnoreSpecificDefaultLibraries", "NODEFAULTLIB:", "Ignore Specific Default Libraries", "", diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 3b31d7b..9badda6 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -96,6 +96,7 @@ void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault() case cmGlobalVisualStudioGenerator::VS11: case cmGlobalVisualStudioGenerator::VS12: case cmGlobalVisualStudioGenerator::VS14: + case cmGlobalVisualStudioGenerator::VS15: // by default VS puts <ExceptionHandling></ExceptionHandling> empty // for a project, to make our projects look the same put a new line // and space over for the closing </ExceptionHandling> as the default diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 25f9e3a..18a7894 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -35,7 +35,7 @@ #if defined(CMAKE_BUILD_WITH_CMAKE) #include "cmGraphVizWriter.h" #include "cmVariableWatch.h" -#include <cm_jsoncpp_value.h> + #include <cm_jsoncpp_writer.h> #endif @@ -66,6 +66,7 @@ #include "cmGlobalVisualStudio11Generator.h" #include "cmGlobalVisualStudio12Generator.h" #include "cmGlobalVisualStudio14Generator.h" +#include "cmGlobalVisualStudio15Generator.h" #include "cmGlobalVisualStudio71Generator.h" #include "cmGlobalVisualStudio8Generator.h" #include "cmGlobalVisualStudio9Generator.h" @@ -232,10 +233,9 @@ cmake::~cmake() delete this->FileComparison; } -std::string cmake::ReportCapabilities() const -{ - std::string result; #if defined(CMAKE_BUILD_WITH_CMAKE) +Json::Value cmake::ReportCapabilitiesJson() const +{ Json::Value obj = Json::objectValue; // Version information: Json::Value version = Json::objectValue; @@ -286,8 +286,16 @@ std::string cmake::ReportCapabilities() const #else obj["serverMode"] = false; #endif + return obj; +} +#endif + +std::string cmake::ReportCapabilities() const +{ + std::string result; +#if defined(CMAKE_BUILD_WITH_CMAKE) Json::FastWriter writer; - result = writer.write(obj); + result = writer.write(this->ReportCapabilitiesJson()); #else result = "Not supported"; #endif @@ -1038,6 +1046,28 @@ const char* cmake::GetHomeOutputDirectory() const return this->State->GetBinaryDirectory(); } +std::string cmake::FindCacheFile(const std::string& binaryDir) +{ + std::string cachePath = binaryDir; + cmSystemTools::ConvertToUnixSlashes(cachePath); + std::string cacheFile = cachePath; + cacheFile += "/CMakeCache.txt"; + if (!cmSystemTools::FileExists(cacheFile.c_str())) { + // search in parent directories for cache + std::string cmakeFiles = cachePath; + cmakeFiles += "/CMakeFiles"; + if (cmSystemTools::FileExists(cmakeFiles.c_str())) { + std::string cachePathFound = + cmSystemTools::FileExistsInParentDirectories("CMakeCache.txt", + cachePath.c_str(), "/"); + if (!cachePathFound.empty()) { + cachePath = cmSystemTools::GetFilenamePath(cachePathFound); + } + } + } + return cachePath; +} + void cmake::SetGlobalGenerator(cmGlobalGenerator* gg) { if (!gg) { @@ -1317,6 +1347,7 @@ int cmake::ActualConfigure() { "11.0", "Visual Studio 11 2012" }, { "12.0", "Visual Studio 12 2013" }, { "14.0", "Visual Studio 14 2015" }, + { "15.0", "Visual Studio 15" }, { 0, 0 } }; for (int i = 0; version[i].MSVersion != 0; i++) { @@ -1634,6 +1665,7 @@ void cmake::AddDefaultGenerators() { #if defined(_WIN32) && !defined(__CYGWIN__) #if !defined(CMAKE_BOOT_MINGW) + this->Generators.push_back(cmGlobalVisualStudio15Generator::NewFactory()); this->Generators.push_back(cmGlobalVisualStudio14Generator::NewFactory()); this->Generators.push_back(cmGlobalVisualStudio12Generator::NewFactory()); this->Generators.push_back(cmGlobalVisualStudio11Generator::NewFactory()); @@ -2334,24 +2366,8 @@ int cmake::Build(const std::string& dir, const std::string& target, std::cerr << "Error: " << dir << " is not a directory\n"; return 1; } - std::string cachePath = dir; - cmSystemTools::ConvertToUnixSlashes(cachePath); - std::string cacheFile = cachePath; - cacheFile += "/CMakeCache.txt"; - if (!cmSystemTools::FileExists(cacheFile.c_str())) { - // search in parent directories for cache - std::string cmakeFiles = cachePath; - cmakeFiles += "/CMakeFiles"; - if (cmSystemTools::FileExists(cmakeFiles.c_str())) { - std::string cachePathFound = - cmSystemTools::FileExistsInParentDirectories("CMakeCache.txt", - cachePath.c_str(), "/"); - if (!cachePathFound.empty()) { - cachePath = cmSystemTools::GetFilenamePath(cachePathFound); - } - } - } + std::string cachePath = FindCacheFile(dir); if (!this->LoadCache(cachePath)) { std::cerr << "Error: could not load cache\n"; return 1; diff --git a/Source/cmake.h b/Source/cmake.h index 9dc429d..6095a59 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -24,6 +24,10 @@ #include <string> #include <vector> +#if defined(CMAKE_BUILD_WITH_CMAKE) +#include "cm_jsoncpp_value.h" +#endif + class cmExternalMakefileProjectGeneratorFactory; class cmFileTimeComparison; class cmGlobalGenerator; @@ -118,6 +122,9 @@ public: /// Destructor ~cmake(); +#if defined(CMAKE_BUILD_WITH_CMAKE) + Json::Value ReportCapabilitiesJson() const; +#endif std::string ReportCapabilities() const; static const char* GetCMakeFilesDirectory() { return "/CMakeFiles"; } @@ -186,6 +193,9 @@ public: return this->GlobalGenerator; } + ///! Return the full path to where the CMakeCache.txt file should be. + static std::string FindCacheFile(const std::string& binaryDir); + ///! Return the global generator assigned to this instance of cmake void SetGlobalGenerator(cmGlobalGenerator*); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index c2e1d53..900bba0 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -91,9 +91,9 @@ void CMakeCommandUsage(const char* program) << " remove_directory dir - remove a directory and its contents\n" << " rename oldname newname - rename a file or directory " "(on one volume)\n" + << " sleep <number>... - sleep for given number of seconds\n" << " tar [cxt][vf][zjJ] file.tar [file/dir1 file/dir2 ...]\n" << " - create or extract a tar or zip archive\n" - << " sleep <number>... - sleep for given number of seconds\n" << " time command [args...] - run command and return elapsed time\n" << " touch file - touch a file.\n" << " touch_nocreate file - touch a file but do not create it.\n" diff --git a/Source/cmparseMSBuildXML.py b/Source/cmparseMSBuildXML.py index 056a0db..1b38d15 100755 --- a/Source/cmparseMSBuildXML.py +++ b/Source/cmparseMSBuildXML.py @@ -15,6 +15,9 @@ # "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V140/1033/cl.xml" # "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V140/1033/lib.xml" # "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V140/1033/link.xml" +# "${PROGRAMFILES}/Microsoft Visual Studio/VS15Preview/Common7/IDE/VC/VCTargets/1033/cl.xml" +# "${PROGRAMFILES}/Microsoft Visual Studio/VS15Preview/Common7/IDE/VC/VCTargets/1033/lib.xml" +# "${PROGRAMFILES}/Microsoft Visual Studio/VS15Preview/Common7/IDE/VC/VCTargets/1033/link.xml" # # BoolProperty <Name>true|false</Name> # simple example: |