summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/file.rst5
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/release/dev/cpack-ifw-updates.rst6
-rw-r--r--Help/release/dev/ninja-output-path-prefix.rst6
-rw-r--r--Help/variable/CMAKE_NINJA_OUTPUT_PATH_PREFIX.rst27
-rw-r--r--Modules/CPackIFW.cmake85
-rw-r--r--Modules/Compiler/GHS-C.cmake1
-rw-r--r--Modules/Compiler/GHS-CXX.cmake1
-rw-r--r--Modules/ExternalProject.cmake3
-rw-r--r--Modules/Platform/AIX.cmake4
-rw-r--r--Modules/Platform/HP-UX.cmake4
-rw-r--r--Source/.gitattributes3
-rw-r--r--Source/CMakeLists.txt1
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx62
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.h9
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx78
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.h13
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.cxx341
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.h105
-rw-r--r--Source/cmAlgorithms.h15
-rw-r--r--Source/cmFileCommand.cxx1
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx20
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx88
-rw-r--r--Source/cmGlobalNinjaGenerator.h11
-rw-r--r--Source/cmListFileLexer.c2020
-rw-r--r--Source/cmListFileLexer.in.l273
-rw-r--r--Source/cmLocalNinjaGenerator.cxx12
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx3
-rw-r--r--Source/cmNinjaTargetGenerator.cxx20
-rw-r--r--Source/cmNinjaUtilityTargetGenerator.cxx2
-rw-r--r--Tests/ExternalProjectUpdate/CMakeLists.txt12
-rw-r--r--Tests/GhsMultiDuplicateSourceFilenames/CMakeLists.txt7
-rw-r--r--Tests/GhsMultiDuplicateSourceFilenames/main.c4
-rw-r--r--Tests/GhsMultiDuplicateSourceFilenames/subfolder_test.c5
-rw-r--r--Tests/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c5
-rw-r--r--Tests/RunCMake/Ninja/CheckNoPrefixSubDir.cmake7
-rw-r--r--Tests/RunCMake/Ninja/CheckNoPrefixSubDirScript.cmake8
-rw-r--r--Tests/RunCMake/Ninja/CheckOutput.cmake23
-rw-r--r--Tests/RunCMake/Ninja/CustomCommandWorkingDirectory.cmake13
-rw-r--r--Tests/RunCMake/Ninja/Executable.cmake5
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake165
-rw-r--r--Tests/RunCMake/Ninja/SharedLib.cmake8
-rw-r--r--Tests/RunCMake/Ninja/StaticLib.cmake9
-rw-r--r--Tests/RunCMake/Ninja/SubDirPrefix.cmake8
-rw-r--r--Tests/RunCMake/Ninja/SubDirPrefix/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/Ninja/SubDirPrefix/greeting.c9
-rw-r--r--Tests/RunCMake/Ninja/SubDirPrefix/greeting.h4
-rw-r--r--Tests/RunCMake/Ninja/TwoLibs.cmake17
-rw-r--r--Tests/RunCMake/Ninja/greeting.c9
-rw-r--r--Tests/RunCMake/Ninja/greeting.h4
-rw-r--r--Tests/RunCMake/Ninja/greeting2.c6
-rw-r--r--Tests/RunCMake/Ninja/greeting2.h1
-rw-r--r--Tests/RunCMake/Ninja/hello.c7
-rw-r--r--Tests/RunCMake/Ninja/hello_sub_greeting.c7
-rw-r--r--Tests/RunCMake/Ninja/hello_with_greeting.c7
-rw-r--r--Tests/RunCMake/Ninja/hello_with_two_greetings.c9
-rw-r--r--Tests/RunCMake/file/GLOB.cmake3
-rw-r--r--Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake3
-rw-r--r--Tests/RunCMake/file/GLOB_RECURSE.cmake3
60 files changed, 2284 insertions, 1308 deletions
diff --git a/Help/command/file.rst b/Help/command/file.rst
index 96ac6c7..256d16d 100644
--- a/Help/command/file.rst
+++ b/Help/command/file.rst
@@ -103,8 +103,9 @@ Generate a list of files that match the ``<globbing-expressions>`` and
store it into the ``<variable>``. Globbing expressions are similar to
regular expressions, but much simpler. If ``RELATIVE`` flag is
specified, the results will be returned as relative paths to the given
-path. No specific order of results is defined. If order is important then
-sort the list explicitly (e.g. using the :command:`list(SORT)` command).
+path. No specific order of results is defined other than that it is
+deterministic. If order is important then sort the list explicitly
+(e.g. using the :command:`list(SORT)` command).
By default ``GLOB`` lists directories - directories are omited in result if
``LIST_DIRECTORIES`` is set to false.
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 181fbbc..ec741ae 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -281,6 +281,7 @@ Variables that Control the Build
/variable/CMAKE_MAP_IMPORTED_CONFIG_CONFIG
/variable/CMAKE_MODULE_LINKER_FLAGS_CONFIG
/variable/CMAKE_MODULE_LINKER_FLAGS
+ /variable/CMAKE_NINJA_OUTPUT_PATH_PREFIX
/variable/CMAKE_NO_BUILTIN_CHRPATH
/variable/CMAKE_NO_SYSTEM_FROM_IMPORTED
/variable/CMAKE_OSX_ARCHITECTURES
diff --git a/Help/release/dev/cpack-ifw-updates.rst b/Help/release/dev/cpack-ifw-updates.rst
new file mode 100644
index 0000000..868f46c
--- /dev/null
+++ b/Help/release/dev/cpack-ifw-updates.rst
@@ -0,0 +1,6 @@
+cpack-ifw-updates
+-----------------
+
+* The :module:`CPackIFW` module gained a new
+ :command:`cpack_ifw_update_repository` command to update a QtIFW-specific
+ repository from a remote repository.
diff --git a/Help/release/dev/ninja-output-path-prefix.rst b/Help/release/dev/ninja-output-path-prefix.rst
new file mode 100644
index 0000000..47a9660
--- /dev/null
+++ b/Help/release/dev/ninja-output-path-prefix.rst
@@ -0,0 +1,6 @@
+ninja-output-path-prefix
+------------------------
+
+* The :generator:`Ninja` generator learned to read a new
+ :variable:`CMAKE_NINJA_OUTPUT_PATH_PREFIX` variable to configure
+ the generated ``build.ninja`` file for use as a ``subninja``.
diff --git a/Help/variable/CMAKE_NINJA_OUTPUT_PATH_PREFIX.rst b/Help/variable/CMAKE_NINJA_OUTPUT_PATH_PREFIX.rst
new file mode 100644
index 0000000..64091aa
--- /dev/null
+++ b/Help/variable/CMAKE_NINJA_OUTPUT_PATH_PREFIX.rst
@@ -0,0 +1,27 @@
+CMAKE_NINJA_OUTPUT_PATH_PREFIX
+------------------------------
+
+Set output files path prefix for the :generator:`Ninja` generator.
+
+Every output files listed in the generated ``build.ninja`` will be
+prefixed by the contents of this variable (a trailing slash is
+appended if missing). This is useful when the generated ninja file is
+meant to be embedded as a ``subninja`` file into a *super* ninja
+project. For example, a ninja build file generated with a command
+like::
+
+ cd top-build-dir/sub &&
+ cmake -G Ninja -DCMAKE_NINJA_OUTPUT_PATH_PREFIX=sub/ path/to/source
+
+can be embedded in ``top-build-dir/build.ninja`` with a directive like
+this::
+
+ subninja sub/build.ninja
+
+The ``auto-regeneration`` rule in ``top-build-dir/build.ninja`` must have an
+order-only dependency on ``sub/build.ninja``.
+
+.. note::
+ When ``CMAKE_NINJA_OUTPUT_PATH_PREFIX`` is set, the project generated
+ by CMake cannot be used as a standalone project. No default targets
+ are specified.
diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake
index 6649933..4cfc9d2 100644
--- a/Modules/CPackIFW.cmake
+++ b/Modules/CPackIFW.cmake
@@ -134,6 +134,7 @@
#
# The default value of this variable is computed by CPack and contains
# all repositories added with command :command:`cpack_ifw_add_repository`
+# or updated with command :command:`cpack_ifw_update_repository`.
#
# .. variable:: CPACK_IFW_DOWNLOAD_ALL
#
@@ -249,7 +250,7 @@
#
# .. command:: cpack_ifw_add_repository
#
-# Add QtIFW_ specific remote repository.
+# Add QtIFW_ specific remote repository to binary installer.
#
# ::
#
@@ -272,6 +273,38 @@
#
# ``DISPLAY_NAME`` is string to display instead of the URL.
#
+#
+# --------------------------------------------------------------------------
+#
+# .. command:: cpack_ifw_update_repository
+#
+# Update QtIFW_ specific repository from remote repository.
+#
+# ::
+#
+# cpack_ifw_update_repository(<reponame>
+# [[ADD|REMOVE] URL <url>]|
+# [REPLACE OLD_URL <old_url> NEW_URL <new_url>]]
+# [USERNAME <username>]
+# [PASSWORD <password>]
+# [DISPLAY_NAME <display_name>])
+#
+# Specified will
+# This macro will also add the repository action
+# to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`
+#
+# ``URL`` is points to a list of available components.
+#
+# ``OLD_URL`` is points to a list that will replaced.
+#
+# ``NEW_URL`` is points to a list that will replace to.
+#
+# ``USERNAME`` is used as user on a protected repository.
+#
+# ``PASSWORD`` is password to use on a protected repository.
+#
+# ``DISPLAY_NAME`` is string to display instead of the URL.
+#
# Example usage
# ^^^^^^^^^^^^^
#
@@ -331,6 +364,9 @@
# Predefined Variables
# http://doc.qt.io/qtinstallerframework/scripting.html#predefined-variables
#
+# Promoting Updates
+# http://doc.qt.io/qtinstallerframework/ifw-updates.html
+#
# Download Qt Installer Framework for you platform from Qt site:
# http://download.qt.io/official_releases/qt-installer-framework
#
@@ -377,6 +413,8 @@ set(_CPACK_IFW_SUFFIXES
"QtIFW2.3.0/bin"
"QtIFW2.2.0/bin"
"QtIFW2.1.0/bin"
+ "QtIFW2.0.3/bin"
+ "QtIFW2.0.1/bin"
"QtIFW2.0.0/bin"
# First branch
"QtIFW-1.6.0/bin"
@@ -608,6 +646,51 @@ macro(cpack_ifw_add_repository reponame)
endmacro()
+# Macro for updating repository
+macro(cpack_ifw_update_repository reponame)
+
+ string(TOUPPER ${reponame} _CPACK_IFWREPO_UNAME)
+
+ set(_IFW_OPT ADD REMOVE REPLACE DISABLED)
+ set(_IFW_ARGS URL OLD_URL NEW_URL USERNAME PASSWORD DISPLAY_NAME)
+ set(_IFW_MULTI_ARGS)
+ cmake_parse_arguments(CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
+
+ set(_CPACK_IFWREPO_STR "\n# Configuration for IFW repository \"${reponame}\" update\n")
+
+ foreach(_IFW_ARG_NAME ${_IFW_OPT})
+ cpack_append_option_set_command(
+ CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
+ _CPACK_IFWREPO_STR)
+ endforeach()
+
+ foreach(_IFW_ARG_NAME ${_IFW_ARGS})
+ cpack_append_string_variable_set_command(
+ CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
+ _CPACK_IFWREPO_STR)
+ endforeach()
+
+ foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
+ cpack_append_variable_set_command(
+ CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
+ _CPACK_IFWREPO_STR)
+ endforeach()
+
+ if(CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_ADD
+ OR CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_REMOVE
+ OR CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_REPLACE)
+ list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})
+ set(_CPACK_IFWREPO_STR "${_CPACK_IFWREPO_STR}list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})\n")
+ else()
+ set(_CPACK_IFWREPO_STR)
+ endif()
+
+ if(CPack_CMake_INCLUDED AND _CPACK_IFWREPO_STR)
+ file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWREPO_STR}")
+ endif()
+
+endmacro()
+
# Resolve package control script
_cpack_ifw_resolve_script(CPACK_IFW_PACKAGE_CONTROL_SCRIPT)
diff --git a/Modules/Compiler/GHS-C.cmake b/Modules/Compiler/GHS-C.cmake
index 50532ce..3072715 100644
--- a/Modules/Compiler/GHS-C.cmake
+++ b/Modules/Compiler/GHS-C.cmake
@@ -1,6 +1,7 @@
include(Compiler/GHS)
set(CMAKE_C_VERBOSE_FLAG "-v")
+set(CMAKE_C_OUTPUT_EXTENSION ".o")
set(CMAKE_C_FLAGS_INIT "")
set(CMAKE_C_FLAGS_DEBUG_INIT "-Odebug -g")
diff --git a/Modules/Compiler/GHS-CXX.cmake b/Modules/Compiler/GHS-CXX.cmake
index 2cffa0d..a51591b 100644
--- a/Modules/Compiler/GHS-CXX.cmake
+++ b/Modules/Compiler/GHS-CXX.cmake
@@ -1,6 +1,7 @@
include(Compiler/GHS)
set(CMAKE_CXX_VERBOSE_FLAG "-v")
+set(CMAKE_CXX_OUTPUT_EXTENSION ".o")
set(CMAKE_CXX_FLAGS_INIT "")
set(CMAKE_CXX_FLAGS_DEBUG_INIT "-Odebug -g")
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 7dad6e5..ec846b9 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -2030,6 +2030,9 @@ function(_ep_add_update_command name)
if(cmd_set)
set(work_dir ${source_dir})
+ if(NOT "x${cmd}" STREQUAL "x")
+ set(always 1)
+ endif()
elseif(cvs_repository)
if(NOT CVS_EXECUTABLE)
message(FATAL_ERROR "error: could not find cvs for update of ${name}")
diff --git a/Modules/Platform/AIX.cmake b/Modules/Platform/AIX.cmake
index 58c6483..551a995 100644
--- a/Modules/Platform/AIX.cmake
+++ b/Modules/Platform/AIX.cmake
@@ -8,7 +8,9 @@ set(CMAKE_DL_LIBS "-lld")
# -Wl,-blibpath:/usr/lib:/lib whether RPATH support is on or not.
# When our own RPATH is to be added it may be inserted before the
# "always" paths.
-set(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib /lib)
+if(NOT DEFINED CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH)
+ set(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib /lib)
+endif()
# Files named "libfoo.a" may actually be shared libraries.
set_property(GLOBAL PROPERTY TARGET_ARCHIVES_MAY_BE_SHARED_LIBS 1)
diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake
index 88932ad..9572a7e 100644
--- a/Modules/Platform/HP-UX.cmake
+++ b/Modules/Platform/HP-UX.cmake
@@ -1,4 +1,6 @@
-set(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib)
+if(NOT DEFINED CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH)
+ set(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib)
+endif()
if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "ia64")
set(CMAKE_SHARED_LIBRARY_SUFFIX ".sl") # .so
diff --git a/Source/.gitattributes b/Source/.gitattributes
index cf4dabd..bd25ea8 100644
--- a/Source/.gitattributes
+++ b/Source/.gitattributes
@@ -1,2 +1,5 @@
# Preserve upstream indentation style.
cm_sha2.* whitespace=indent-with-non-tab
+
+# Preserve indentation style in generated code.
+cmListFileLexer.c whitespace=-tab-in-indent,-indent-with-non-tab
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 467b692..3223831 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -662,6 +662,7 @@ set(CPACK_SRCS
CPack/cmCPackNSISGenerator.cxx
CPack/IFW/cmCPackIFWPackage.cxx
CPack/IFW/cmCPackIFWInstaller.cxx
+ CPack/IFW/cmCPackIFWRepository.cxx
CPack/IFW/cmCPackIFWGenerator.cxx
CPack/cmCPackSTGZGenerator.cxx
CPack/cmCPackTGZGenerator.cxx
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 1eadf3f..2a85a2f 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 5)
-set(CMake_VERSION_PATCH 20160517)
+set(CMake_VERSION_PATCH 20160520)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index 2c25f43..c1ff526 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -12,9 +12,6 @@
#include "cmCPackIFWGenerator.h"
-#include "cmCPackIFWInstaller.h"
-#include "cmCPackIFWPackage.h"
-
#include <CPack/cmCPackComponentGroup.h>
#include <CPack/cmCPackLog.h>
@@ -72,7 +69,7 @@ int cmCPackIFWGenerator::PackageFiles()
ifwTmpFile += "/IFWOutput.log";
// Run repogen
- if (!Installer.Repositories.empty()) {
+ if (!Installer.RemoteRepositories.empty()) {
std::string ifwCmd = RepoGen;
if (IsVersionLess("2.0.0")) {
@@ -117,6 +114,14 @@ int cmCPackIFWGenerator::PackageFiles()
<< std::endl);
return 0;
}
+
+ if (!Repository.RepositoryUpdate.empty() &&
+ !Repository.PatchUpdatesXml()) {
+ cmCPackLogger(cmCPackLog::LOG_WARNING, "Problem patch IFW \"Updates\" "
+ << "file: " << this->toplevel + "/repository/Updates.xml"
+ << std::endl);
+ }
+
cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- repository: "
<< this->toplevel << "/repository generated" << std::endl);
}
@@ -137,7 +142,7 @@ int cmCPackIFWGenerator::PackageFiles()
if (OnlineOnly) {
ifwCmd += " --online-only";
} else if (!DownloadedPackages.empty() &&
- !Installer.Repositories.empty()) {
+ !Installer.RemoteRepositories.empty()) {
ifwCmd += " -e ";
std::set<cmCPackIFWPackage*>::iterator it = DownloadedPackages.begin();
ifwCmd += (*it)->Name;
@@ -272,6 +277,24 @@ int cmCPackIFWGenerator::InitializeInternal()
Installer.Generator = this;
Installer.ConfigureFromOptions();
+ // Repository
+ Repository.Generator = this;
+ Repository.Name = "Unspecified";
+ if (const char* site = this->GetOption("CPACK_DOWNLOAD_SITE")) {
+ Repository.Url = site;
+ Installer.RemoteRepositories.push_back(&Repository);
+ }
+
+ // Repositories
+ if (const char* RepoAllStr = this->GetOption("CPACK_IFW_REPOSITORIES_ALL")) {
+ std::vector<std::string> RepoAllVector;
+ cmSystemTools::ExpandListArgument(RepoAllStr, RepoAllVector);
+ for (std::vector<std::string>::iterator rit = RepoAllVector.begin();
+ rit != RepoAllVector.end(); ++rit) {
+ GetRepository(*rit);
+ }
+ }
+
if (const char* ifwDownloadAll = this->GetOption("CPACK_IFW_DOWNLOAD_ALL")) {
OnlineOnly = cmSystemTools::IsOn(ifwDownloadAll);
} else if (const char* cpackDownloadAll =
@@ -281,7 +304,7 @@ int cmCPackIFWGenerator::InitializeInternal()
OnlineOnly = false;
}
- if (!Installer.Repositories.empty() && RepoGen.empty()) {
+ if (!Installer.RemoteRepositories.empty() && RepoGen.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot find QtIFW repository generator \"repogen\": "
"likely it is not installed, or not in your PATH"
@@ -507,6 +530,33 @@ cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage(
return pit != ComponentPackages.end() ? pit->second : 0;
}
+cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
+ const std::string& repositoryName)
+{
+ RepositoriesMap::iterator rit = Repositories.find(repositoryName);
+ if (rit != Repositories.end())
+ return &(rit->second);
+
+ cmCPackIFWRepository* repository = &Repositories[repositoryName];
+ repository->Name = repositoryName;
+ repository->Generator = this;
+ if (repository->ConfigureFromOptions()) {
+ if (repository->Update == cmCPackIFWRepository::None) {
+ Installer.RemoteRepositories.push_back(repository);
+ } else {
+ Repository.RepositoryUpdate.push_back(repository);
+ }
+ } else {
+ Repositories.erase(repositoryName);
+ repository = 0;
+ cmCPackLogger(cmCPackLog::LOG_WARNING, "Invalid repository \""
+ << repositoryName << "\""
+ << " configuration. Repository will be skipped."
+ << std::endl);
+ }
+ return repository;
+}
+
void cmCPackIFWGenerator::WriteGeneratedByToStrim(cmXMLWriter& xout)
{
std::stringstream comment;
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h
index d8cc562..2b35749 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.h
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.h
@@ -17,6 +17,7 @@
#include "cmCPackIFWInstaller.h"
#include "cmCPackIFWPackage.h"
+#include "cmCPackIFWRepository.h"
class cmXMLWriter;
@@ -31,6 +32,7 @@ public:
cmCPackTypeMacro(cmCPackIFWGenerator, cmCPackGenerator);
typedef std::map<std::string, cmCPackIFWPackage> PackagesMap;
+ typedef std::map<std::string, cmCPackIFWRepository> RepositoriesMap;
typedef std::map<std::string, cmCPackComponent> ComponentsMap;
typedef std::map<std::string, cmCPackComponentGroup> ComponentGoupsMap;
typedef std::map<std::string, cmCPackIFWPackage::DependenceStruct>
@@ -122,6 +124,8 @@ protected:
cmCPackIFWPackage* GetGroupPackage(cmCPackComponentGroup* group) const;
cmCPackIFWPackage* GetComponentPackage(cmCPackComponent* component) const;
+ cmCPackIFWRepository* GetRepository(const std::string& repositoryName);
+
void WriteGeneratedByToStrim(cmXMLWriter& xout);
protected:
@@ -129,11 +133,16 @@ protected:
friend class cmCPackIFWPackage;
friend class cmCPackIFWInstaller;
+ friend class cmCPackIFWRepository;
// Installer
cmCPackIFWInstaller Installer;
+ // Repository
+ cmCPackIFWRepository Repository;
// Collection of packages
PackagesMap Packages;
+ // Collection of repositories
+ RepositoriesMap Repositories;
// Collection of binary packages
std::set<cmCPackIFWPackage*> BinaryPackages;
// Collection of downloaded packages
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index b9a9861..dfc509b 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -159,57 +159,6 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
AdminTargetDir = option;
}
- // Repositories
- Repositories.clear();
- RepositoryStruct Repo;
- if (const char* site = this->GetOption("CPACK_DOWNLOAD_SITE")) {
- Repo.Url = site;
- Repositories.push_back(Repo);
- }
- if (const char* RepoAllStr = this->GetOption("CPACK_IFW_REPOSITORIES_ALL")) {
- std::vector<std::string> RepoAllVector;
- cmSystemTools::ExpandListArgument(RepoAllStr, RepoAllVector);
- for (std::vector<std::string>::iterator rit = RepoAllVector.begin();
- rit != RepoAllVector.end(); ++rit) {
- std::string prefix =
- "CPACK_IFW_REPOSITORY_" + cmsys::SystemTools::UpperCase(*rit) + "_";
- // Url
- if (const char* url = GetOption(prefix + "URL")) {
- Repo.Url = url;
- } else {
- Repo.Url = "";
- }
- // Enabled
- if (IsOn(prefix + "DISABLED")) {
- Repo.Enabled = "0";
- } else {
- Repo.Enabled = "";
- }
- // Username
- if (const char* username = GetOption(prefix + "USERNAME")) {
- Repo.Username = username;
- } else {
- Repo.Username = "";
- }
- // Password
- if (const char* password = GetOption(prefix + "PASSWORD")) {
- Repo.Password = password;
- } else {
- Repo.Password = "";
- }
- // DisplayName
- if (const char* displayName = GetOption(prefix + "DISPLAY_NAME")) {
- Repo.DisplayName = displayName;
- } else {
- Repo.DisplayName = "";
- }
-
- if (!Repo.Url.empty()) {
- Repositories.push_back(Repo);
- }
- }
- }
-
// Maintenance tool
if (const char* optIFW_MAINTENANCE_TOOL =
this->GetOption("CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME")) {
@@ -320,30 +269,11 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
}
// Remote repositories
- if (!Repositories.empty()) {
+ if (!RemoteRepositories.empty()) {
xout.StartElement("RemoteRepositories");
- for (std::vector<RepositoryStruct>::iterator rit = Repositories.begin();
- rit != Repositories.end(); ++rit) {
- xout.StartElement("Repository");
- // Url
- xout.Element("Url", rit->Url);
- // Enabled
- if (!rit->Enabled.empty()) {
- xout.Element("Enabled", rit->Enabled);
- }
- // Username
- if (!rit->Username.empty()) {
- xout.Element("Username", rit->Username);
- }
- // Password
- if (!rit->Password.empty()) {
- xout.Element("Password", rit->Password);
- }
- // DisplayName
- if (!rit->DisplayName.empty()) {
- xout.Element("DisplayName", rit->DisplayName);
- }
- xout.EndElement();
+ for (RepositoriesVector::iterator rit = RemoteRepositories.begin();
+ rit != RemoteRepositories.end(); ++rit) {
+ (*rit)->WriteRepositoryConfig(xout);
}
xout.EndElement();
}
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h
index 84a789e..3170116 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.h
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.h
@@ -17,6 +17,7 @@
class cmCPackIFWPackage;
class cmCPackIFWGenerator;
+class cmCPackIFWRepository;
class cmXMLWriter;
/** \class cmCPackIFWInstaller
@@ -28,15 +29,7 @@ public:
// Types
typedef std::map<std::string, cmCPackIFWPackage*> PackagesMap;
-
- struct RepositoryStruct
- {
- std::string Url;
- std::string Enabled;
- std::string Username;
- std::string Password;
- std::string DisplayName;
- };
+ typedef std::vector<cmCPackIFWRepository*> RepositoriesVector;
public:
// Constructor
@@ -115,7 +108,7 @@ public:
cmCPackIFWGenerator* Generator;
PackagesMap Packages;
- std::vector<RepositoryStruct> Repositories;
+ RepositoriesVector RemoteRepositories;
std::string Directory;
protected:
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx
new file mode 100644
index 0000000..b149f81
--- /dev/null
+++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx
@@ -0,0 +1,341 @@
+/*============================================================================
+ 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 "cmCPackIFWRepository.h"
+
+#include "cmCPackIFWGenerator.h"
+
+#include <CPack/cmCPackLog.h>
+
+#include <cmGeneratedFileStream.h>
+#include <cmXMLParser.h>
+#include <cmXMLWriter.h>
+
+#ifdef cmCPackLogger
+#undef cmCPackLogger
+#endif
+#define cmCPackLogger(logType, msg) \
+ do { \
+ std::ostringstream cmCPackLog_msg; \
+ cmCPackLog_msg << msg; \
+ if (Generator) { \
+ Generator->Logger->Log(logType, __FILE__, __LINE__, \
+ cmCPackLog_msg.str().c_str()); \
+ } \
+ } while (0)
+
+cmCPackIFWRepository::cmCPackIFWRepository()
+ : Update(None)
+ , Generator(0)
+{
+}
+
+bool cmCPackIFWRepository::IsValid() const
+{
+ bool valid = true;
+
+ switch (Update) {
+ case None:
+ valid = Url.empty() ? false : true;
+ break;
+ case Add:
+ valid = Url.empty() ? false : true;
+ break;
+ case Remove:
+ valid = Url.empty() ? false : true;
+ break;
+ case Replace:
+ valid = (OldUrl.empty() || NewUrl.empty()) ? false : true;
+ break;
+ }
+
+ return valid;
+}
+
+const char* cmCPackIFWRepository::GetOption(const std::string& op) const
+{
+ return Generator ? Generator->GetOption(op) : 0;
+}
+
+bool cmCPackIFWRepository::IsOn(const std::string& op) const
+{
+ return Generator ? Generator->IsOn(op) : false;
+}
+
+bool cmCPackIFWRepository::IsVersionLess(const char* version)
+{
+ return Generator ? Generator->IsVersionLess(version) : false;
+}
+
+bool cmCPackIFWRepository::IsVersionGreater(const char* version)
+{
+ return Generator ? Generator->IsVersionGreater(version) : false;
+}
+
+bool cmCPackIFWRepository::IsVersionEqual(const char* version)
+{
+ return Generator ? Generator->IsVersionEqual(version) : false;
+}
+
+bool cmCPackIFWRepository::ConfigureFromOptions()
+{
+ // Name;
+ if (Name.empty())
+ return false;
+
+ std::string prefix =
+ "CPACK_IFW_REPOSITORY_" + cmsys::SystemTools::UpperCase(Name) + "_";
+
+ // Update
+ if (IsOn(prefix + "ADD")) {
+ Update = Add;
+ } else if (IsOn(prefix + "REMOVE")) {
+ Update = Remove;
+ } else if (IsOn(prefix + "REPLACE")) {
+ Update = Replace;
+ } else {
+ Update = None;
+ }
+
+ // Url
+ if (const char* url = GetOption(prefix + "URL")) {
+ Url = url;
+ } else {
+ Url = "";
+ }
+
+ // Old url
+ if (const char* oldUrl = GetOption(prefix + "OLD_URL")) {
+ OldUrl = oldUrl;
+ } else {
+ OldUrl = "";
+ }
+
+ // New url
+ if (const char* newUrl = GetOption(prefix + "NEW_URL")) {
+ NewUrl = newUrl;
+ } else {
+ NewUrl = "";
+ }
+
+ // Enabled
+ if (IsOn(prefix + "DISABLED")) {
+ Enabled = "0";
+ } else {
+ Enabled = "";
+ }
+
+ // Username
+ if (const char* username = GetOption(prefix + "USERNAME")) {
+ Username = username;
+ } else {
+ Username = "";
+ }
+
+ // Password
+ if (const char* password = GetOption(prefix + "PASSWORD")) {
+ Password = password;
+ } else {
+ Password = "";
+ }
+
+ // DisplayName
+ if (const char* displayName = GetOption(prefix + "DISPLAY_NAME")) {
+ DisplayName = displayName;
+ } else {
+ DisplayName = "";
+ }
+
+ return IsValid();
+}
+
+/** \class cmCPackeIFWUpdatesPatcher
+ * \brief Helper class that parses and patch Updates.xml file (QtIFW)
+ */
+class cmCPackeIFWUpdatesPatcher : public cmXMLParser
+{
+public:
+ cmCPackeIFWUpdatesPatcher(cmCPackIFWRepository* r, cmXMLWriter& x)
+ : repository(r)
+ , xout(x)
+ , patched(false)
+ {
+ }
+
+ cmCPackIFWRepository* repository;
+ cmXMLWriter& xout;
+ bool patched;
+
+protected:
+ virtual void StartElement(const std::string& name, const char** atts)
+ {
+ xout.StartElement(name);
+ StartFragment(atts);
+ }
+
+ void StartFragment(const char** atts)
+ {
+ for (size_t i = 0; atts[i]; i += 2) {
+ const char* key = atts[i];
+ const char* value = atts[i + 1];
+ xout.Attribute(key, value);
+ }
+ }
+
+ virtual void EndElement(const std::string& name)
+ {
+ if (name == "Updates" && !patched) {
+ repository->WriteRepositoryUpdates(xout);
+ patched = true;
+ }
+ xout.EndElement();
+ if (patched)
+ return;
+ if (name == "Checksum") {
+ repository->WriteRepositoryUpdates(xout);
+ patched = true;
+ }
+ }
+
+ virtual void CharacterDataHandler(const char* data, int length)
+ {
+ std::string content(data, data + length);
+ if (content == "" || content == " " || content == " " || content == "\n")
+ return;
+ xout.Content(content);
+ }
+};
+
+bool cmCPackIFWRepository::PatchUpdatesXml()
+{
+ // Lazy directory initialization
+ if (Directory.empty() && Generator) {
+ Directory = Generator->toplevel;
+ }
+
+ // Filenames
+ std::string updatesXml = Directory + "/repository/Updates.xml";
+ std::string updatesPatchXml = Directory + "/repository/UpdatesPatch.xml";
+
+ // Output stream
+ cmGeneratedFileStream fout(updatesPatchXml.data());
+ cmXMLWriter xout(fout);
+
+ xout.StartDocument();
+
+ WriteGeneratedByToStrim(xout);
+
+ // Patch
+ {
+ cmCPackeIFWUpdatesPatcher patcher(this, xout);
+ patcher.ParseFile(updatesXml.data());
+ }
+
+ xout.EndDocument();
+
+ fout.Close();
+
+ if (!cmSystemTools::RenameFile(updatesPatchXml.data(), updatesXml.data())) {
+ return false;
+ }
+
+ return true;
+}
+
+void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout)
+{
+ xout.StartElement("Repository");
+
+ // Url
+ xout.Element("Url", Url);
+ // Enabled
+ if (!Enabled.empty()) {
+ xout.Element("Enabled", Enabled);
+ }
+ // Username
+ if (!Username.empty()) {
+ xout.Element("Username", Username);
+ }
+ // Password
+ if (!Password.empty()) {
+ xout.Element("Password", Password);
+ }
+ // DisplayName
+ if (!DisplayName.empty()) {
+ xout.Element("DisplayName", DisplayName);
+ }
+
+ xout.EndElement();
+}
+
+void cmCPackIFWRepository::WriteRepositoryUpdate(cmXMLWriter& xout)
+{
+ xout.StartElement("Repository");
+
+ switch (Update) {
+ case None:
+ break;
+ case Add:
+ xout.Attribute("action", "add");
+ break;
+ case Remove:
+ xout.Attribute("action", "remove");
+ break;
+ case Replace:
+ xout.Attribute("action", "replace");
+ break;
+ }
+
+ // Url
+ if (Update == Add || Update == Remove) {
+ xout.Attribute("url", Url);
+ } else if (Update == Replace) {
+ xout.Attribute("oldurl", OldUrl);
+ xout.Attribute("newurl", NewUrl);
+ }
+ // Enabled
+ if (!Enabled.empty()) {
+ xout.Attribute("enabled", Enabled);
+ }
+ // Username
+ if (!Username.empty()) {
+ xout.Attribute("username", Username);
+ }
+ // Password
+ if (!Password.empty()) {
+ xout.Attribute("password", Password);
+ }
+ // DisplayName
+ if (!DisplayName.empty()) {
+ xout.Attribute("displayname", DisplayName);
+ }
+
+ xout.EndElement();
+}
+
+void cmCPackIFWRepository::WriteRepositoryUpdates(cmXMLWriter& xout)
+{
+ if (!RepositoryUpdate.empty()) {
+ xout.StartElement("RepositoryUpdate");
+ for (RepositoriesVector::iterator rit = RepositoryUpdate.begin();
+ rit != RepositoryUpdate.end(); ++rit) {
+ (*rit)->WriteRepositoryUpdate(xout);
+ }
+ xout.EndElement();
+ }
+}
+
+void cmCPackIFWRepository::WriteGeneratedByToStrim(cmXMLWriter& xout)
+{
+ if (Generator)
+ Generator->WriteGeneratedByToStrim(xout);
+}
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.h b/Source/CPack/IFW/cmCPackIFWRepository.h
new file mode 100644
index 0000000..5ffb775
--- /dev/null
+++ b/Source/CPack/IFW/cmCPackIFWRepository.h
@@ -0,0 +1,105 @@
+/*============================================================================
+ 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 cmCPackIFWRepository_h
+#define cmCPackIFWRepository_h
+
+#include <cmStandardIncludes.h>
+
+class cmCPackIFWGenerator;
+class cmXMLWriter;
+
+/** \class cmCPackIFWRepository
+ * \brief A remote repository to be created CPack IFW generator
+ */
+class cmCPackIFWRepository
+{
+public:
+ // Types
+
+ enum Action
+ {
+ None,
+ Add,
+ Remove,
+ Replace
+ };
+
+ typedef std::vector<cmCPackIFWRepository*> RepositoriesVector;
+
+public:
+ // Constructor
+
+ /**
+ * Construct repository
+ */
+ cmCPackIFWRepository();
+
+public:
+ // Configuration
+
+ /// Internal repository name
+ std::string Name;
+
+ /// Optional update action
+ Action Update;
+
+ /// Is points to a list of available components
+ std::string Url;
+
+ /// Is points to a list that will replaced
+ std::string OldUrl;
+
+ /// Is points to a list that will replace to
+ std::string NewUrl;
+
+ /// With "0" disabling this repository
+ std::string Enabled;
+
+ /// Is used as user on a protected repository
+ std::string Username;
+
+ /// Is password to use on a protected repository
+ std::string Password;
+
+ /// Is optional string to display instead of the URL
+ std::string DisplayName;
+
+public:
+ // Internal implementation
+
+ bool IsValid() const;
+
+ const char* GetOption(const std::string& op) const;
+ bool IsOn(const std::string& op) const;
+
+ bool IsVersionLess(const char* version);
+ bool IsVersionGreater(const char* version);
+ bool IsVersionEqual(const char* version);
+
+ bool ConfigureFromOptions();
+
+ bool PatchUpdatesXml();
+
+ void WriteRepositoryConfig(cmXMLWriter& xout);
+ void WriteRepositoryUpdate(cmXMLWriter& xout);
+ void WriteRepositoryUpdates(cmXMLWriter& xout);
+
+ cmCPackIFWGenerator* Generator;
+ RepositoriesVector RepositoryUpdate;
+ std::string Directory;
+
+protected:
+ void WriteGeneratedByToStrim(cmXMLWriter& xout);
+};
+
+#endif // cmCPackIFWRepository_h
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index 76acaca..ee803c8 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -379,4 +379,19 @@ std::reverse_iterator<Iter> cmMakeReverseIterator(Iter it)
return std::reverse_iterator<Iter>(it);
}
+inline bool cmHasSuffix(const std::string& str, const std::string& suffix)
+{
+ if (str.size() < suffix.size()) {
+ return false;
+ }
+ return str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0;
+}
+
+inline void cmStripSuffixIfExists(std::string& str, const std::string& suffix)
+{
+ if (cmHasSuffix(str, suffix)) {
+ str.resize(str.size() - suffix.size());
+ }
+}
+
#endif
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 5363a99..4e72f36 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -823,6 +823,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
std::vector<std::string>::size_type cc;
std::vector<std::string>& files = g.GetFiles();
+ std::sort(files.begin(), files.end());
for (cc = 0; cc < files.size(); cc++) {
if (!first) {
output += ";";
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 325a86e..5e13d4c 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -18,7 +18,6 @@
#include "cmSourceFile.h"
#include "cmTarget.h"
#include <assert.h>
-#include <cmAlgorithms.h>
std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic");
@@ -466,20 +465,14 @@ cmGhsMultiTargetGenerator::GetObjectNames(
for (std::vector<cmSourceFile*>::const_iterator sf =
duplicateSources.begin();
sf != duplicateSources.end(); ++sf) {
- static std::string::size_type const MAX_FULL_PATH_LENGTH = 247;
std::string const longestObjectDirectory(
cmGhsMultiTargetGenerator::ComputeLongestObjectDirectory(
localGhsMultiGenerator, generatorTarget, *sf));
- std::string fullFilename = (*sf)->GetFullPath();
- bool const ObjPathFound = cmLocalGeneratorCheckObjectName(
- fullFilename, longestObjectDirectory.size(), MAX_FULL_PATH_LENGTH);
- if (!ObjPathFound) {
- cmSystemTools::Error("Object path \"", fullFilename.c_str(),
- "\" too long", "");
- }
- cmsys::SystemTools::ReplaceString(fullFilename, ":/", "_");
- cmsys::SystemTools::ReplaceString(fullFilename, "/", "_");
- objectNamesCorrected[*sf] = fullFilename;
+ std::string objFilenameName =
+ localGhsMultiGenerator->GetObjectFileNameWithoutTarget(
+ **sf, longestObjectDirectory);
+ cmsys::SystemTools::ReplaceString(objFilenameName, "/", "_");
+ objectNamesCorrected[*sf] = objFilenameName;
}
return objectNamesCorrected;
@@ -517,8 +510,7 @@ void cmGhsMultiTargetGenerator::WriteSources(
this->WriteObjectLangOverride(this->FolderBuildStreams[sgPath], (*si));
if (objectNames.end() != objectNames.find(*si)) {
*this->FolderBuildStreams[sgPath]
- << " -o \"" << objectNames.find(*si)->second << ".o\""
- << std::endl;
+ << " -o \"" << objectNames.find(*si)->second << "\"" << std::endl;
}
this->WriteObjectDir(this->FolderBuildStreams[sgPath],
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 012ef90..d65b463 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -488,6 +488,10 @@ void cmGlobalNinjaGenerator::Generate()
this->OpenBuildFileStream();
this->OpenRulesFileStream();
+ this->InitOutputPathPrefix();
+ this->TargetAll = this->NinjaOutputPath("all");
+ this->CMakeCacheFile = this->NinjaOutputPath("CMakeCache.txt");
+
this->PolicyCMP0058 =
this->LocalGenerators[0]->GetMakefile()->GetPolicyStatus(
cmPolicies::CMP0058);
@@ -714,11 +718,29 @@ void cmGlobalNinjaGenerator::CloseRulesFileStream()
}
}
+static void EnsureTrailingSlash(std::string& path)
+{
+ if (path.empty()) {
+ return;
+ }
+ std::string::value_type last = path[path.size() - 1];
+#ifdef _WIN32
+ if (last != '\\') {
+ path += '\\';
+ }
+#else
+ if (last != '/') {
+ path += '/';
+ }
+#endif
+}
+
std::string cmGlobalNinjaGenerator::ConvertToNinjaPath(const std::string& path)
{
cmLocalNinjaGenerator* ng =
static_cast<cmLocalNinjaGenerator*>(this->LocalGenerators[0]);
std::string convPath = ng->Convert(path, cmOutputConverter::HOME_OUTPUT);
+ convPath = this->NinjaOutputPath(convPath);
#ifdef _WIN32
cmSystemTools::ReplaceString(convPath, "/", "\\");
#endif
@@ -731,6 +753,7 @@ std::string cmGlobalNinjaGenerator::ConvertToNinjaFolderRule(
cmLocalNinjaGenerator* ng =
static_cast<cmLocalNinjaGenerator*>(this->LocalGenerators[0]);
std::string convPath = ng->Convert(path + "/all", cmOutputConverter::HOME);
+ convPath = this->NinjaOutputPath(convPath);
#ifdef _WIN32
cmSystemTools::ReplaceString(convPath, "/", "\\");
#endif
@@ -836,22 +859,17 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs(
}
case cmState::OBJECT_LIBRARY:
case cmState::UTILITY: {
- std::string path = this->ConvertToNinjaPath(
- target->GetLocalGenerator()->GetCurrentBinaryDirectory());
- if (path.empty() || path == ".")
- outputs.push_back(target->GetName());
- else {
- path += "/";
- path += target->GetName();
- outputs.push_back(path);
- }
+ std::string path =
+ target->GetLocalGenerator()->GetCurrentBinaryDirectory() +
+ std::string("/") + target->GetName();
+ outputs.push_back(this->ConvertToNinjaPath(path));
break;
}
case cmState::GLOBAL_TARGET:
// Always use the target in HOME instead of an unused duplicate in a
// subdirectory.
- outputs.push_back(target->GetName());
+ outputs.push_back(this->NinjaOutputPath(target->GetName()));
break;
default:
@@ -885,6 +903,7 @@ void cmGlobalNinjaGenerator::AppendTargetDepends(
void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias,
cmGeneratorTarget* target)
{
+ std::string buildAlias = this->NinjaOutputPath(alias);
cmNinjaDeps outputs;
this->AppendTargetOutputs(target, outputs);
// Mark the target's outputs as ambiguous to ensure that no other target uses
@@ -895,7 +914,7 @@ void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias,
// Insert the alias into the map. If the alias was already present in the
// map and referred to another target, mark it as ambiguous.
std::pair<TargetAliasMap::iterator, bool> newAlias =
- TargetAliases.insert(std::make_pair(alias, target));
+ TargetAliases.insert(std::make_pair(buildAlias, target));
if (newAlias.second && newAlias.first->second != target)
newAlias.first->second = 0;
}
@@ -1043,7 +1062,7 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
}
}
}
- knownDependencies.insert("CMakeCache.txt");
+ knownDependencies.insert(this->CMakeCacheFile);
for (TargetAliasMap::const_iterator i = this->TargetAliases.begin();
i != this->TargetAliases.end(); ++i) {
@@ -1064,7 +1083,7 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
// should all match now.
std::vector<std::string> unknownExplicitDepends;
- this->CombinedCustomCommandExplicitDependencies.erase("all");
+ this->CombinedCustomCommandExplicitDependencies.erase(this->TargetAll);
std::set_difference(this->CombinedCustomCommandExplicitDependencies.begin(),
this->CombinedCustomCommandExplicitDependencies.end(),
@@ -1130,13 +1149,15 @@ void cmGlobalNinjaGenerator::WriteBuiltinTargets(std::ostream& os)
void cmGlobalNinjaGenerator::WriteTargetAll(std::ostream& os)
{
cmNinjaDeps outputs;
- outputs.push_back("all");
+ outputs.push_back(this->TargetAll);
this->WritePhonyBuild(os, "The main all target.", outputs,
this->AllDependencies);
- cmGlobalNinjaGenerator::WriteDefault(os, outputs,
- "Make the all target the default.");
+ if (!this->HasOutputPathPrefix()) {
+ cmGlobalNinjaGenerator::WriteDefault(os, outputs,
+ "Make the all target the default.");
+ }
}
void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
@@ -1171,7 +1192,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
implicitDeps.push_back(this->ConvertToNinjaPath(*fi));
}
}
- implicitDeps.push_back("CMakeCache.txt");
+ implicitDeps.push_back(this->CMakeCacheFile);
std::sort(implicitDeps.begin(), implicitDeps.end());
implicitDeps.erase(std::unique(implicitDeps.begin(), implicitDeps.end()),
@@ -1184,9 +1205,10 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
variables["pool"] = "console";
}
+ std::string const ninjaBuildFile = this->NinjaOutputPath(NINJA_BUILD_FILE);
this->WriteBuild(os, "Re-run CMake if any of its inputs changed.",
"RERUN_CMAKE",
- /*outputs=*/cmNinjaDeps(1, NINJA_BUILD_FILE),
+ /*outputs=*/cmNinjaDeps(1, ninjaBuildFile),
/*explicitDeps=*/cmNinjaDeps(), implicitDeps,
/*orderOnlyDeps=*/cmNinjaDeps(), variables);
@@ -1223,7 +1245,7 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
/*restat=*/"",
/*generator=*/false);
WriteBuild(os, "Clean all the built files.", "CLEAN",
- /*outputs=*/cmNinjaDeps(1, "clean"),
+ /*outputs=*/cmNinjaDeps(1, this->NinjaOutputPath("clean")),
/*explicitDeps=*/cmNinjaDeps(),
/*implicitDeps=*/cmNinjaDeps(),
/*orderOnlyDeps=*/cmNinjaDeps(),
@@ -1242,9 +1264,35 @@ void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os)
/*restat=*/"",
/*generator=*/false);
WriteBuild(os, "Print all primary targets available.", "HELP",
- /*outputs=*/cmNinjaDeps(1, "help"),
+ /*outputs=*/cmNinjaDeps(1, this->NinjaOutputPath("help")),
/*explicitDeps=*/cmNinjaDeps(),
/*implicitDeps=*/cmNinjaDeps(),
/*orderOnlyDeps=*/cmNinjaDeps(),
/*variables=*/cmNinjaVars());
}
+
+void cmGlobalNinjaGenerator::InitOutputPathPrefix()
+{
+ this->OutputPathPrefix =
+ this->LocalGenerators[0]->GetMakefile()->GetSafeDefinition(
+ "CMAKE_NINJA_OUTPUT_PATH_PREFIX");
+ EnsureTrailingSlash(this->OutputPathPrefix);
+}
+
+std::string cmGlobalNinjaGenerator::NinjaOutputPath(std::string const& path)
+{
+ if (!this->HasOutputPathPrefix() || cmSystemTools::FileIsFullPath(path)) {
+ return path;
+ }
+ return this->OutputPathPrefix + path;
+}
+
+void cmGlobalNinjaGenerator::StripNinjaOutputPathPrefixAsSuffix(
+ std::string& path)
+{
+ if (path.empty()) {
+ return;
+ }
+ EnsureTrailingSlash(path);
+ cmStripSuffixIfExists(path, this->OutputPathPrefix);
+}
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 881104f..6d9bfe8 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -314,6 +314,10 @@ public:
static std::string RequiredNinjaVersionForConsolePool() { return "1.5"; }
bool SupportsConsolePool() const;
+ std::string NinjaOutputPath(std::string const& path);
+ bool HasOutputPathPrefix() const { return !this->OutputPathPrefix.empty(); }
+ void StripNinjaOutputPathPrefixAsSuffix(std::string& path);
+
protected:
virtual void Generate();
@@ -397,6 +401,13 @@ private:
std::string NinjaCommand;
std::string NinjaVersion;
+
+private:
+ void InitOutputPathPrefix();
+
+ std::string OutputPathPrefix;
+ std::string TargetAll;
+ std::string CMakeCacheFile;
};
#endif // ! cmGlobalNinjaGenerator_h
diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c
index af4fc3d..bc1666e 100644
--- a/Source/cmListFileLexer.c
+++ b/Source/cmListFileLexer.c
@@ -8,8 +8,8 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
+#define YY_FLEX_MINOR_VERSION 6
+#define YY_FLEX_SUBMINOR_VERSION 0
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@@ -93,15 +93,15 @@ typedef unsigned int flex_uint32_t;
/* The "const" storage-class-modifier is valid. */
#define YY_USE_CONST
-#else /* ! __cplusplus */
+#else /* ! __cplusplus */
/* C99 requires __STDC__ to be defined as 1. */
#if defined (__STDC__)
#define YY_USE_CONST
-#endif /* defined (__STDC__) */
-#endif /* ! __cplusplus */
+#endif /* defined (__STDC__) */
+#endif /* ! __cplusplus */
#ifdef YY_USE_CONST
#define yyconst const
@@ -179,6 +179,11 @@ typedef void* yyscan_t;
typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
@@ -197,89 +202,93 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
if ( yytext[yyl] == '\n' )\
--yylineno;\
}while(0)
+ #define YY_LINENO_REWIND_TO(dst) \
+ do {\
+ const char *p;\
+ for ( p = yy_cp-1; p >= (dst); --p)\
+ if ( *p == '\n' )\
+ --yylineno;\
+ }while(0)
/* 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 )
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
+#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.
- */
- 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;
+ {
+ 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.
+ */
+ 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 cmListFileLexer_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 cmListFileLexer_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
@@ -313,7 +322,7 @@ static void cmListFileLexer_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan
YY_BUFFER_STATE cmListFileLexer_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
YY_BUFFER_STATE cmListFileLexer_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
-YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
+YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
void *cmListFileLexer_yyalloc (yy_size_t ,yyscan_t yyscanner );
void *cmListFileLexer_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
@@ -322,30 +331,30 @@ void cmListFileLexer_yyfree (void * ,yyscan_t yyscanner );
#define yy_new_buffer cmListFileLexer_yy_create_buffer
#define yy_set_interactive(is_interactive) \
- { \
- if ( ! YY_CURRENT_BUFFER ){ \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){ \
cmListFileLexer_yyensure_buffer_stack (yyscanner); \
- YY_CURRENT_BUFFER_LVALUE = \
+ YY_CURRENT_BUFFER_LVALUE = \
cmListFileLexer_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 ){\
cmListFileLexer_yyensure_buffer_stack (yyscanner); \
- YY_CURRENT_BUFFER_LVALUE = \
+ YY_CURRENT_BUFFER_LVALUE = \
cmListFileLexer_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 cmListFileLexer_yywrap(n) 1
+#define cmListFileLexer_yywrap(yyscanner) (/*CONSTCOND*/1)
#define YY_SKIP_YYWRAP
typedef unsigned char YY_CHAR;
@@ -357,27 +366,30 @@ 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 );
+#if defined(__GNUC__) && __GNUC__ >= 3
+__attribute__((__noreturn__))
+#endif
static void 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;
+ 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 24
#define YY_END_OF_BUFFER 25
/* 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;
- };
+ {
+ flex_int32_t yy_verify;
+ flex_int32_t yy_nxt;
+ };
static yyconst flex_int16_t yy_accept[77] =
{ 0,
0, 0, 0, 0, 0, 0, 0, 0, 4, 4,
@@ -390,7 +402,7 @@ static yyconst flex_int16_t yy_accept[77] =
0, 0, 0, 0, 0, 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,
@@ -422,13 +434,13 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[16] =
+static yyconst YY_CHAR yy_meta[16] =
{ 0,
1, 1, 2, 3, 4, 3, 1, 3, 5, 6,
1, 6, 1, 1, 7
} ;
-static yyconst flex_int16_t yy_base[95] =
+static yyconst flex_uint16_t yy_base[95] =
{ 0,
0, 0, 13, 25, 14, 16, 17, 18, 90, 88,
88, 39, 20, 237, 237, 74, 78, 237, 237, 13,
@@ -458,7 +470,7 @@ static yyconst flex_int16_t yy_def[95] =
} ;
-static yyconst flex_int16_t yy_nxt[253] =
+static yyconst flex_uint16_t yy_nxt[253] =
{ 0,
12, 13, 14, 13, 15, 16, 17, 18, 19, 12,
12, 20, 21, 22, 12, 24, 28, 25, 28, 28,
@@ -552,19 +564,16 @@ static yyconst flex_int32_t yy_rule_can_match_eol[25] =
This file must be translated to C and modified to build everywhere.
-Run flex like this:
+Run flex >= 2.6 like this:
flex --prefix=cmListFileLexer_yy -ocmListFileLexer.c cmListFileLexer.in.l
Modify cmListFileLexer.c:
- - remove TABs
- - remove use of the 'register' storage class specifier
- - remove the yyunput function
- - add a statement "(void)yyscanner;" to the top of these methods:
- yy_fatal_error, cmListFileLexer_yyalloc, cmListFileLexer_yyrealloc, cmListFileLexer_yyfree
+ - remove trailing whitespace: sed -i 's/\s*$//' cmListFileLexer.c
+ - remove blank lines at end of file
- remove statement "yyscanner = NULL;" from cmListFileLexer_yylex_destroy
- remove all YY_BREAK lines occurring right after return statements
- - remove the isatty forward declaration
+ - remove unnecessary cast to (int) in yy_get_next_buffer
*/
@@ -583,7 +592,7 @@ Modify cmListFileLexer.c:
struct cmListFileLexer_s
{
cmListFileLexer_Token token;
- int bracket;
+ yy_size_t bracket;
int comment;
int line;
int column;
@@ -649,7 +658,7 @@ struct yyguts_t
YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
char yy_hold_char;
int yy_n_chars;
- int yyleng_r;
+ yy_size_t yyleng_r;
char *yy_c_buf_p;
int yy_init;
int yy_start;
@@ -690,23 +699,23 @@ void cmListFileLexer_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner
FILE *cmListFileLexer_yyget_in (yyscan_t yyscanner );
-void cmListFileLexer_yyset_in (FILE * in_str ,yyscan_t yyscanner );
+void cmListFileLexer_yyset_in (FILE * _in_str ,yyscan_t yyscanner );
FILE *cmListFileLexer_yyget_out (yyscan_t yyscanner );
-void cmListFileLexer_yyset_out (FILE * out_str ,yyscan_t yyscanner );
+void cmListFileLexer_yyset_out (FILE * _out_str ,yyscan_t yyscanner );
-int cmListFileLexer_yyget_leng (yyscan_t yyscanner );
+yy_size_t cmListFileLexer_yyget_leng (yyscan_t yyscanner );
char *cmListFileLexer_yyget_text (yyscan_t yyscanner );
int cmListFileLexer_yyget_lineno (yyscan_t yyscanner );
-void cmListFileLexer_yyset_lineno (int line_number ,yyscan_t yyscanner );
+void cmListFileLexer_yyset_lineno (int _line_number ,yyscan_t yyscanner );
int cmListFileLexer_yyget_column (yyscan_t yyscanner );
-void cmListFileLexer_yyset_column (int column_no ,yyscan_t yyscanner );
+void cmListFileLexer_yyset_column (int _column_no ,yyscan_t yyscanner );
/* Macros after this point can all be overridden by user definitions in
* section 1.
@@ -720,6 +729,12 @@ extern int cmListFileLexer_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
@@ -761,33 +776,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 = 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
@@ -832,123 +847,124 @@ extern int cmListFileLexer_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 \
- YY_USER_ACTION
+ 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;
-#line 91 "cmListFileLexer.in.l"
+ if ( !yyg->yy_init )
+ {
+ yyg->yy_init = 1;
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
-#line 865 "cmListFileLexer.c"
+ if ( ! yyg->yy_start )
+ yyg->yy_start = 1; /* first start state */
- if ( !yyg->yy_init )
- {
- yyg->yy_init = 1;
+ if ( ! yyin )
+ yyin = stdin;
-#ifdef YY_USER_INIT
- YY_USER_INIT;
-#endif
+ if ( ! yyout )
+ yyout = stdout;
- if ( ! yyg->yy_start )
- yyg->yy_start = 1; /* first start state */
+ if ( ! YY_CURRENT_BUFFER ) {
+ cmListFileLexer_yyensure_buffer_stack (yyscanner);
+ YY_CURRENT_BUFFER_LVALUE =
+ cmListFileLexer_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+ }
- if ( ! yyin )
- yyin = stdin;
+ cmListFileLexer_yy_load_buffer_state(yyscanner );
+ }
- if ( ! yyout )
- yyout = stdout;
+ {
+#line 88 "cmListFileLexer.in.l"
- if ( ! YY_CURRENT_BUFFER ) {
- cmListFileLexer_yyensure_buffer_stack (yyscanner);
- YY_CURRENT_BUFFER_LVALUE =
- cmListFileLexer_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
- }
- cmListFileLexer_yy_load_buffer_state(yyscanner );
- }
+#line 896 "cmListFileLexer.c"
- while ( 1 ) /* 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 = yyg->yy_start;
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 >= 77 )
- 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] != 237 );
+ 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 >= 77 )
+ 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] != 237 );
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;
-
- if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
- {
- int yyl;
- for ( yyl = 0; yyl < yyleng; ++yyl )
- if ( yytext[yyl] == '\n' )
+ 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;
+
+ if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
+ {
+ yy_size_t yyl;
+ for ( yyl = 0; yyl < yyleng; ++yyl )
+ if ( yytext[yyl] == '\n' )
do{ yylineno++;
yycolumn=0;
}while(0)
;
- }
+ }
-do_action: /* This label is used only to access EOF actions. */
+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;
+ 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:
/* rule 1 can match eol */
YY_RULE_SETUP
-#line 93 "cmListFileLexer.in.l"
+#line 90 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_Newline;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -960,51 +976,45 @@ YY_RULE_SETUP
case 2:
/* rule 2 can match eol */
YY_RULE_SETUP
-#line 102 "cmListFileLexer.in.l"
+#line 99 "cmListFileLexer.in.l"
{
const char* bracket = yytext;
lexer->comment = yytext[0] == '#';
- if(lexer->comment)
- {
+ if (lexer->comment) {
lexer->token.type = cmListFileLexer_Token_CommentBracket;
bracket += 1;
- }
- else
- {
+ } else {
lexer->token.type = cmListFileLexer_Token_ArgumentBracket;
- }
+ }
cmListFileLexerSetToken(lexer, "", 0);
- lexer->bracket = (int)(strchr(bracket+1, '[') - bracket);
- if(yytext[yyleng-1] == '\n')
- {
+ lexer->bracket = strchr(bracket+1, '[') - bracket;
+ if (yytext[yyleng-1] == '\n') {
++lexer->line;
lexer->column = 1;
- }
- else
- {
+ } else {
lexer->column += yyleng;
- }
+ }
BEGIN(BRACKET);
}
- YY_BREAK
+ YY_BREAK
case 3:
YY_RULE_SETUP
-#line 128 "cmListFileLexer.in.l"
+#line 119 "cmListFileLexer.in.l"
{
lexer->column += yyleng;
BEGIN(COMMENT);
}
- YY_BREAK
+ YY_BREAK
case 4:
YY_RULE_SETUP
-#line 133 "cmListFileLexer.in.l"
+#line 124 "cmListFileLexer.in.l"
{
lexer->column += yyleng;
}
- YY_BREAK
+ YY_BREAK
case 5:
YY_RULE_SETUP
-#line 137 "cmListFileLexer.in.l"
+#line 128 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ParenLeft;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1013,7 +1023,7 @@ YY_RULE_SETUP
}
case 6:
YY_RULE_SETUP
-#line 144 "cmListFileLexer.in.l"
+#line 135 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ParenRight;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1022,7 +1032,7 @@ YY_RULE_SETUP
}
case 7:
YY_RULE_SETUP
-#line 151 "cmListFileLexer.in.l"
+#line 142 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_Identifier;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1031,20 +1041,19 @@ YY_RULE_SETUP
}
case 8:
YY_RULE_SETUP
-#line 158 "cmListFileLexer.in.l"
+#line 149 "cmListFileLexer.in.l"
{
/* Handle ]]====]=======]*/
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
- if(yyleng == lexer->bracket)
- {
+ if (yyleng == lexer->bracket) {
BEGIN(BRACKETEND);
- }
+ }
}
- YY_BREAK
+ YY_BREAK
case 9:
YY_RULE_SETUP
-#line 168 "cmListFileLexer.in.l"
+#line 158 "cmListFileLexer.in.l"
{
lexer->column += yyleng;
/* Erase the partial bracket from the token. */
@@ -1055,35 +1064,35 @@ YY_RULE_SETUP
}
case 10:
YY_RULE_SETUP
-#line 177 "cmListFileLexer.in.l"
+#line 167 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
}
- YY_BREAK
+ YY_BREAK
case 11:
/* rule 11 can match eol */
YY_RULE_SETUP
-#line 182 "cmListFileLexer.in.l"
+#line 172 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
++lexer->line;
lexer->column = 1;
BEGIN(BRACKET);
}
- YY_BREAK
+ YY_BREAK
case 12:
YY_RULE_SETUP
-#line 189 "cmListFileLexer.in.l"
+#line 179 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
BEGIN(BRACKET);
}
- YY_BREAK
+ YY_BREAK
case YY_STATE_EOF(BRACKET):
case YY_STATE_EOF(BRACKETEND):
-#line 195 "cmListFileLexer.in.l"
+#line 185 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_BadBracket;
BEGIN(INITIAL);
@@ -1091,7 +1100,7 @@ case YY_STATE_EOF(BRACKETEND):
}
case 13:
YY_RULE_SETUP
-#line 201 "cmListFileLexer.in.l"
+#line 191 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1100,7 +1109,7 @@ YY_RULE_SETUP
}
case 14:
YY_RULE_SETUP
-#line 208 "cmListFileLexer.in.l"
+#line 198 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1109,7 +1118,7 @@ YY_RULE_SETUP
}
case 15:
YY_RULE_SETUP
-#line 215 "cmListFileLexer.in.l"
+#line 205 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1118,45 +1127,45 @@ YY_RULE_SETUP
}
case 16:
YY_RULE_SETUP
-#line 222 "cmListFileLexer.in.l"
+#line 212 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ArgumentQuoted;
cmListFileLexerSetToken(lexer, "", 0);
lexer->column += yyleng;
BEGIN(STRING);
}
- YY_BREAK
+ YY_BREAK
case 17:
YY_RULE_SETUP
-#line 229 "cmListFileLexer.in.l"
+#line 219 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
}
- YY_BREAK
+ YY_BREAK
case 18:
/* rule 18 can match eol */
YY_RULE_SETUP
-#line 234 "cmListFileLexer.in.l"
+#line 224 "cmListFileLexer.in.l"
{
/* Continuation: text is not part of string */
++lexer->line;
lexer->column = 1;
}
- YY_BREAK
+ YY_BREAK
case 19:
/* rule 19 can match eol */
YY_RULE_SETUP
-#line 240 "cmListFileLexer.in.l"
+#line 230 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
++lexer->line;
lexer->column = 1;
}
- YY_BREAK
+ YY_BREAK
case 20:
YY_RULE_SETUP
-#line 246 "cmListFileLexer.in.l"
+#line 236 "cmListFileLexer.in.l"
{
lexer->column += yyleng;
BEGIN(INITIAL);
@@ -1164,14 +1173,14 @@ YY_RULE_SETUP
}
case 21:
YY_RULE_SETUP
-#line 252 "cmListFileLexer.in.l"
+#line 242 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
}
- YY_BREAK
+ YY_BREAK
case YY_STATE_EOF(STRING):
-#line 257 "cmListFileLexer.in.l"
+#line 247 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_BadString;
BEGIN(INITIAL);
@@ -1179,7 +1188,7 @@ case YY_STATE_EOF(STRING):
}
case 22:
YY_RULE_SETUP
-#line 263 "cmListFileLexer.in.l"
+#line 253 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_Space;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1188,7 +1197,7 @@ YY_RULE_SETUP
}
case 23:
YY_RULE_SETUP
-#line 270 "cmListFileLexer.in.l"
+#line 260 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_BadCharacter;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1197,7 +1206,7 @@ YY_RULE_SETUP
}
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(COMMENT):
-#line 277 "cmListFileLexer.in.l"
+#line 267 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_None;
cmListFileLexerSetToken(lexer, 0, 0);
@@ -1205,339 +1214,387 @@ case YY_STATE_EOF(COMMENT):
}
case 24:
YY_RULE_SETUP
-#line 283 "cmListFileLexer.in.l"
+#line 273 "cmListFileLexer.in.l"
ECHO;
- YY_BREAK
-#line 1238 "cmListFileLexer.c"
-
- 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
- * cmListFileLexer_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 ( cmListFileLexer_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 */
+ YY_BREAK
+#line 1235 "cmListFileLexer.c"
+
+ 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
+ * cmListFileLexer_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 ( cmListFileLexer_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 cmListFileLexer_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
- {
- 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;
-
- 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. */
- cmListFileLexer_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, (size_t) 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;
- cmListFileLexer_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 *) cmListFileLexer_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()" );
- }
+ 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
+ {
+ 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. */
+ cmListFileLexer_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;
+ cmListFileLexer_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 ((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 *) cmListFileLexer_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->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];
+ 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 = yyg->yy_start;
- 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 >= 77 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- }
+ 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 >= 77 )
+ 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;
+ 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 >= 77 )
- 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 == 76);
-
- 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 >= 77 )
+ 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 == 76);
+
+ (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;
+ 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;
+
+ 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];
+
+ 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;
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
+ }
+
+ *--yy_cp = (char) c;
+
+ if ( c == '\n' ){
+ --yylineno;
+ }
+
+ 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)
@@ -1546,79 +1603,79 @@ 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 */
- 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. */
- cmListFileLexer_yyrestart(yyin ,yyscanner);
-
- /*FALLTHROUGH*/
-
- case EOB_ACT_END_OF_FILE:
- {
- if ( cmListFileLexer_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 */
+ 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. */
+ cmListFileLexer_yyrestart(yyin ,yyscanner);
+
+ /*FALLTHROUGH*/
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( cmListFileLexer_yywrap(yyscanner ) )
+ return EOF;
+
+ 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;
- if ( c == '\n' )
+ if ( c == '\n' )
do{ yylineno++;
yycolumn=0;
}while(0)
;
- 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.
@@ -1629,14 +1686,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 ){
cmListFileLexer_yyensure_buffer_stack (yyscanner);
- YY_CURRENT_BUFFER_LVALUE =
+ YY_CURRENT_BUFFER_LVALUE =
cmListFileLexer_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
- }
+ }
- cmListFileLexer_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
- cmListFileLexer_yy_load_buffer_state(yyscanner );
+ cmListFileLexer_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
+ cmListFileLexer_yy_load_buffer_state(yyscanner );
}
/** Switch to a different input buffer.
@@ -1647,41 +1704,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
- * cmListFileLexer_yypop_buffer_state();
- * cmListFileLexer_yypush_buffer_state(new_buffer);
+ /* TODO. We should be able to replace this entire function body
+ * with
+ * cmListFileLexer_yypop_buffer_state();
+ * cmListFileLexer_yypush_buffer_state(new_buffer);
*/
- cmListFileLexer_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;
- cmListFileLexer_yy_load_buffer_state(yyscanner );
-
- /* We don't actually know whether we did this switch during
- * EOF (cmListFileLexer_yywrap()) processing, but the only time this flag
- * is looked at is after cmListFileLexer_yywrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yyg->yy_did_buffer_switch_on_eof = 1;
+ cmListFileLexer_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;
+ cmListFileLexer_yy_load_buffer_state(yyscanner );
+
+ /* We don't actually know whether we did this switch during
+ * EOF (cmListFileLexer_yywrap()) processing, but the only time this flag
+ * is looked at is after cmListFileLexer_yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ yyg->yy_did_buffer_switch_on_eof = 1;
}
static void cmListFileLexer_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.
@@ -1692,26 +1749,26 @@ static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner)
*/
YY_BUFFER_STATE cmListFileLexer_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
{
- YY_BUFFER_STATE b;
+ YY_BUFFER_STATE b;
- b = (YY_BUFFER_STATE) cmListFileLexer_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_create_buffer()" );
+ b = (YY_BUFFER_STATE) cmListFileLexer_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_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 *) cmListFileLexer_yyalloc(b->yy_buf_size + 2 ,yyscanner );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_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 *) cmListFileLexer_yyalloc(b->yy_buf_size + 2 ,yyscanner );
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_create_buffer()" );
- b->yy_is_our_buffer = 1;
+ b->yy_is_our_buffer = 1;
- cmListFileLexer_yy_init_buffer(b,file ,yyscanner);
+ cmListFileLexer_yy_init_buffer(b,file ,yyscanner);
- return b;
+ return b;
}
/** Destroy the buffer.
@@ -1722,16 +1779,16 @@ static void cmListFileLexer_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 )
- cmListFileLexer_yyfree((void *) b->yy_ch_buf ,yyscanner );
+ if ( b->yy_is_our_buffer )
+ cmListFileLexer_yyfree((void *) b->yy_ch_buf ,yyscanner );
- cmListFileLexer_yyfree((void *) b ,yyscanner );
+ cmListFileLexer_yyfree((void *) b ,yyscanner );
}
/* Initializes or reinitializes a buffer.
@@ -1741,13 +1798,13 @@ static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner)
static void cmListFileLexer_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;
- cmListFileLexer_yy_flush_buffer(b ,yyscanner);
+ cmListFileLexer_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 cmListFileLexer_yy_init_buffer was _probably_
* called from cmListFileLexer_yyrestart() or through yy_get_next_buffer.
@@ -1760,7 +1817,7 @@ static void cmListFileLexer_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.
@@ -1770,25 +1827,25 @@ static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner)
void cmListFileLexer_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 )
- cmListFileLexer_yy_load_buffer_state(yyscanner );
+ if ( b == YY_CURRENT_BUFFER )
+ cmListFileLexer_yy_load_buffer_state(yyscanner );
}
/** Pushes the new state onto the stack. The new state becomes
@@ -1800,28 +1857,28 @@ static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner)
void cmListFileLexer_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if (new_buffer == NULL)
- return;
+ if (new_buffer == NULL)
+ return;
- cmListFileLexer_yyensure_buffer_stack(yyscanner);
+ cmListFileLexer_yyensure_buffer_stack(yyscanner);
- /* This block is copied from cmListFileLexer_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;
- }
+ /* This block is copied from cmListFileLexer_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;
+ /* 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 cmListFileLexer_yy_switch_to_buffer. */
- cmListFileLexer_yy_load_buffer_state(yyscanner );
- yyg->yy_did_buffer_switch_on_eof = 1;
+ /* copied from cmListFileLexer_yy_switch_to_buffer. */
+ cmListFileLexer_yy_load_buffer_state(yyscanner );
+ yyg->yy_did_buffer_switch_on_eof = 1;
}
/** Removes and deletes the top of the stack, if present.
@@ -1831,18 +1888,18 @@ void cmListFileLexer_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t
void cmListFileLexer_yypop_buffer_state (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if (!YY_CURRENT_BUFFER)
- return;
+ if (!YY_CURRENT_BUFFER)
+ return;
- cmListFileLexer_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
- YY_CURRENT_BUFFER_LVALUE = NULL;
- if (yyg->yy_buffer_stack_top > 0)
- --yyg->yy_buffer_stack_top;
+ cmListFileLexer_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) {
- cmListFileLexer_yy_load_buffer_state(yyscanner );
- yyg->yy_did_buffer_switch_on_eof = 1;
- }
+ if (YY_CURRENT_BUFFER) {
+ cmListFileLexer_yy_load_buffer_state(yyscanner );
+ yyg->yy_did_buffer_switch_on_eof = 1;
+ }
}
/* Allocates the stack if it does not exist.
@@ -1850,46 +1907,46 @@ void cmListFileLexer_yypop_buffer_state (yyscan_t yyscanner)
*/
static void cmListFileLexer_yyensure_buffer_stack (yyscan_t yyscanner)
{
- int num_to_alloc;
+ yy_size_t 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**)cmListFileLexer_yyalloc
- (num_to_alloc * sizeof(struct yy_buffer_state*)
- , yyscanner);
- if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_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;
- }
+ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
+ yyg->yy_buffer_stack = (struct yy_buffer_state**)cmListFileLexer_yyalloc
+ (num_to_alloc * sizeof(struct yy_buffer_state*)
+ , yyscanner);
+ if ( ! yyg->yy_buffer_stack )
+ YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yyensure_buffer_stack()" );
- if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
+ memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
- /* Increase the buffer to prepare for a possible push. */
- int grow_size = 8 /* arbitrary grow size */;
+ yyg->yy_buffer_stack_max = num_to_alloc;
+ yyg->yy_buffer_stack_top = 0;
+ return;
+ }
- num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
- yyg->yy_buffer_stack = (struct yy_buffer_state**)cmListFileLexer_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 cmListFileLexer_yyensure_buffer_stack()" );
+ if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
- /* 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;
- }
+ /* 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**)cmListFileLexer_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 cmListFileLexer_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.
@@ -1900,31 +1957,31 @@ static void cmListFileLexer_yyensure_buffer_stack (yyscan_t yyscanner)
*/
YY_BUFFER_STATE cmListFileLexer_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
{
- YY_BUFFER_STATE 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 0;
+ 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) cmListFileLexer_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_scan_buffer()" );
+ b = (YY_BUFFER_STATE) cmListFileLexer_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_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;
+ 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;
- cmListFileLexer_yy_switch_to_buffer(b ,yyscanner );
+ cmListFileLexer_yy_switch_to_buffer(b ,yyscanner );
- return b;
+ return b;
}
/** Setup the input buffer state to scan a string. The next call to cmListFileLexer_yylex() will
@@ -1938,7 +1995,7 @@ YY_BUFFER_STATE cmListFileLexer_yy_scan_buffer (char * base, yy_size_t size ,
YY_BUFFER_STATE cmListFileLexer_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
{
- return cmListFileLexer_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
+ return cmListFileLexer_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
}
/** Setup the input buffer state to scan the given bytes. The next call to cmListFileLexer_yylex() will
@@ -1948,34 +2005,34 @@ YY_BUFFER_STATE cmListFileLexer_yy_scan_string (yyconst char * yystr , yyscan_t
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
*/
-YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
+YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner)
{
- YY_BUFFER_STATE b;
- char *buf;
- yy_size_t n;
- int 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 *) cmListFileLexer_yyalloc(n ,yyscanner );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_scan_bytes()" );
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = _yybytes_len + 2;
+ buf = (char *) cmListFileLexer_yyalloc(n ,yyscanner );
+ if ( ! buf )
+ YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_scan_bytes()" );
- for ( i = 0; i < _yybytes_len; ++i )
- buf[i] = yybytes[i];
+ for ( i = 0; i < _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 = cmListFileLexer_yy_scan_buffer(buf,n ,yyscanner);
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in cmListFileLexer_yy_scan_bytes()" );
+ b = cmListFileLexer_yy_scan_buffer(buf,n ,yyscanner);
+ if ( ! b )
+ YY_FATAL_ERROR( "bad buffer in cmListFileLexer_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
@@ -1984,27 +2041,28 @@ YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes (yyconst char * yybytes, int _yy
static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
{
- (void)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. */
@@ -2064,7 +2122,7 @@ FILE *cmListFileLexer_yyget_out (yyscan_t yyscanner)
/** Get the length of the current token.
* @param yyscanner The scanner object.
*/
-int cmListFileLexer_yyget_leng (yyscan_t yyscanner)
+yy_size_t cmListFileLexer_yyget_leng (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
return yyleng;
@@ -2091,51 +2149,51 @@ void cmListFileLexer_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscann
}
/** Set the current line number.
- * @param line_number
+ * @param _line_number line number
* @param yyscanner The scanner object.
*/
-void cmListFileLexer_yyset_lineno (int line_number , yyscan_t yyscanner)
+void cmListFileLexer_yyset_lineno (int _line_number , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
/* lineno is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "cmListFileLexer_yyset_lineno called with no buffer" , yyscanner);
+ YY_FATAL_ERROR( "cmListFileLexer_yyset_lineno called with no buffer" );
- yylineno = line_number;
+ yylineno = _line_number;
}
/** Set the current column.
- * @param line_number
+ * @param _column_no column number
* @param yyscanner The scanner object.
*/
-void cmListFileLexer_yyset_column (int column_no , yyscan_t yyscanner)
+void cmListFileLexer_yyset_column (int _column_no , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
/* column is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "cmListFileLexer_yyset_column called with no buffer" , yyscanner);
+ YY_FATAL_ERROR( "cmListFileLexer_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 cmListFileLexer_yy_switch_to_buffer
*/
-void cmListFileLexer_yyset_in (FILE * in_str , yyscan_t yyscanner)
+void cmListFileLexer_yyset_in (FILE * _in_str , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyin = in_str ;
+ yyin = _in_str ;
}
-void cmListFileLexer_yyset_out (FILE * out_str , yyscan_t yyscanner)
+void cmListFileLexer_yyset_out (FILE * _out_str , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyout = out_str ;
+ yyout = _out_str ;
}
int cmListFileLexer_yyget_debug (yyscan_t yyscanner)
@@ -2144,10 +2202,10 @@ int cmListFileLexer_yyget_debug (yyscan_t yyscanner)
return yy_flex_debug;
}
-void cmListFileLexer_yyset_debug (int bdebug , yyscan_t yyscanner)
+void cmListFileLexer_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 */
@@ -2255,15 +2313,15 @@ int cmListFileLexer_yylex_destroy (yyscan_t yyscanner)
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
/* Pop the buffer stack, destroying each element. */
- while(YY_CURRENT_BUFFER){
- cmListFileLexer_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
- YY_CURRENT_BUFFER_LVALUE = NULL;
- cmListFileLexer_yypop_buffer_state(yyscanner);
- }
+ while(YY_CURRENT_BUFFER){
+ cmListFileLexer_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ cmListFileLexer_yypop_buffer_state(yyscanner);
+ }
- /* Destroy the stack itself. */
- cmListFileLexer_yyfree(yyg->yy_buffer_stack ,yyscanner);
- yyg->yy_buffer_stack = NULL;
+ /* Destroy the stack itself. */
+ cmListFileLexer_yyfree(yyg->yy_buffer_stack ,yyscanner);
+ yyg->yy_buffer_stack = NULL;
/* Destroy the start condition stack. */
cmListFileLexer_yyfree(yyg->yy_start_stack ,yyscanner );
@@ -2285,51 +2343,58 @@ int cmListFileLexer_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 *cmListFileLexer_yyalloc (yy_size_t size , yyscan_t yyscanner)
{
- (void)yyscanner;
- return (void *) malloc( size );
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ (void)yyg;
+ return (void *) malloc( size );
}
void *cmListFileLexer_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.
- */
- (void)yyscanner;
- 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 (void *) realloc( (char *) ptr, size );
}
void cmListFileLexer_yyfree (void * ptr , yyscan_t yyscanner)
{
- (void)yyscanner;
- free( (char *) ptr ); /* see cmListFileLexer_yyrealloc() for (char *) cast */
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ (void)yyg;
+ free( (char *) ptr ); /* see cmListFileLexer_yyrealloc() for (char *) cast */
}
#define YYTABLES_NAME "yytables"
-#line 282 "cmListFileLexer.in.l"
+#line 273 "cmListFileLexer.in.l"
@@ -2342,30 +2407,25 @@ static void cmListFileLexerSetToken(cmListFileLexer* lexer, const char* text,
lexer->token.column = lexer->column;
/* Use the same buffer if possible. */
- if(lexer->token.text)
- {
- if(text && length < lexer->size)
- {
+ if (lexer->token.text) {
+ if (text && length < lexer->size) {
strcpy(lexer->token.text, text);
lexer->token.length = length;
return;
- }
+ }
free(lexer->token.text);
lexer->token.text = 0;
lexer->size = 0;
- }
+ }
/* Need to extend the buffer. */
- if(text)
- {
+ if (text) {
lexer->token.text = strdup(text);
lexer->token.length = length;
- lexer->size = length+1;
- }
- else
- {
+ lexer->size = length + 1;
+ } else {
lexer->token.length = 0;
- }
+ }
}
/*--------------------------------------------------------------------------*/
@@ -2377,22 +2437,20 @@ static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text,
/* If the appended text will fit in the buffer, do not reallocate. */
newSize = lexer->token.length + length + 1;
- if(lexer->token.text && newSize <= lexer->size)
- {
- strcpy(lexer->token.text+lexer->token.length, text);
+ if (lexer->token.text && newSize <= lexer->size) {
+ strcpy(lexer->token.text + lexer->token.length, text);
lexer->token.length += length;
return;
- }
+ }
/* We need to extend the buffer. */
temp = malloc(newSize);
- if(lexer->token.text)
- {
+ if (lexer->token.text) {
memcpy(temp, lexer->token.text, lexer->token.length);
free(lexer->token.text);
- }
- memcpy(temp+lexer->token.length, text, length);
- temp[lexer->token.length+length] = 0;
+ }
+ memcpy(temp + lexer->token.length, text, length);
+ temp[lexer->token.length + length] = 0;
lexer->token.text = temp;
lexer->token.length += length;
lexer->size = newSize;
@@ -2402,96 +2460,84 @@ static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text,
static int cmListFileLexerInput(cmListFileLexer* lexer, char* buffer,
size_t bufferSize)
{
- if(lexer)
- {
- if(lexer->file)
- {
+ if (lexer) {
+ if (lexer->file) {
/* Convert CRLF -> LF explicitly. The C FILE "t"ext mode
does not convert newlines on all platforms. Move any
trailing CR to the start of the buffer for the next read. */
size_t cr = lexer->cr;
size_t n;
buffer[0] = '\r';
- n = fread(buffer+cr, 1, bufferSize-cr, lexer->file);
- if(n)
- {
+ n = fread(buffer + cr, 1, bufferSize - cr, lexer->file);
+ if (n) {
char* o = buffer;
const char* i = buffer;
const char* e;
n += cr;
- cr = (buffer[n-1] == '\r')? 1:0;
+ cr = (buffer[n - 1] == '\r') ? 1 : 0;
e = buffer + n - cr;
- while(i != e)
- {
- if(i[0] == '\r' && i[1] == '\n')
- {
+ while (i != e) {
+ if (i[0] == '\r' && i[1] == '\n') {
++i;
- }
- *o++ = *i++;
}
- n = o - buffer;
+ *o++ = *i++;
}
- else
- {
+ n = o - buffer;
+ } else {
n = cr;
cr = 0;
- }
+ }
lexer->cr = cr;
return n;
- }
- else if(lexer->string_left)
- {
+ } else if (lexer->string_left) {
int length = lexer->string_left;
- if((int)bufferSize < length) { length = (int)bufferSize; }
+ if ((int)bufferSize < length) {
+ length = (int)bufferSize;
+ }
memcpy(buffer, lexer->string_position, length);
lexer->string_position += length;
lexer->string_left -= length;
return length;
- }
}
+ }
return 0;
}
/*--------------------------------------------------------------------------*/
static void cmListFileLexerInit(cmListFileLexer* lexer)
{
- if(lexer->file || lexer->string_buffer)
- {
+ if (lexer->file || lexer->string_buffer) {
cmListFileLexer_yylex_init(&lexer->scanner);
cmListFileLexer_yyset_extra(lexer, lexer->scanner);
- }
+ }
}
/*--------------------------------------------------------------------------*/
static void cmListFileLexerDestroy(cmListFileLexer* lexer)
{
cmListFileLexerSetToken(lexer, 0, 0);
- if(lexer->file || lexer->string_buffer)
- {
+ if (lexer->file || lexer->string_buffer) {
cmListFileLexer_yylex_destroy(lexer->scanner);
- if(lexer->file)
- {
+ if (lexer->file) {
fclose(lexer->file);
lexer->file = 0;
- }
- if(lexer->string_buffer)
- {
+ }
+ if (lexer->string_buffer) {
free(lexer->string_buffer);
lexer->string_buffer = 0;
lexer->string_left = 0;
lexer->string_position = 0;
- }
}
+ }
}
/*--------------------------------------------------------------------------*/
cmListFileLexer* cmListFileLexer_New()
{
cmListFileLexer* lexer = (cmListFileLexer*)malloc(sizeof(cmListFileLexer));
- if(!lexer)
- {
+ if (!lexer) {
return 0;
- }
+ }
memset(lexer, 0, sizeof(*lexer));
lexer->line = 1;
lexer->column = 1;
@@ -2509,39 +2555,28 @@ void cmListFileLexer_Delete(cmListFileLexer* lexer)
static cmListFileLexer_BOM cmListFileLexer_ReadBOM(FILE* f)
{
unsigned char b[2];
- if(fread(b, 1, 2, f) == 2)
- {
- if(b[0] == 0xEF && b[1] == 0xBB)
- {
- if(fread(b, 1, 1, f) == 1 && b[0] == 0xBF)
- {
+ if (fread(b, 1, 2, f) == 2) {
+ if (b[0] == 0xEF && b[1] == 0xBB) {
+ if (fread(b, 1, 1, f) == 1 && b[0] == 0xBF) {
return cmListFileLexer_BOM_UTF8;
- }
}
- else if(b[0] == 0xFE && b[1] == 0xFF)
- {
+ } else if (b[0] == 0xFE && b[1] == 0xFF) {
/* UTF-16 BE */
return cmListFileLexer_BOM_UTF16BE;
- }
- else if(b[0] == 0 && b[1] == 0)
- {
- if(fread(b, 1, 2, f) == 2 && b[0] == 0xFE && b[1] == 0xFF)
- {
+ } else if (b[0] == 0 && b[1] == 0) {
+ if (fread(b, 1, 2, f) == 2 && b[0] == 0xFE && b[1] == 0xFF) {
return cmListFileLexer_BOM_UTF32BE;
- }
}
- else if(b[0] == 0xFF && b[1] == 0xFE)
- {
+ } else if (b[0] == 0xFF && b[1] == 0xFE) {
fpos_t p;
fgetpos(f, &p);
- if(fread(b, 1, 2, f) == 2 && b[0] == 0 && b[1] == 0)
- {
+ if (fread(b, 1, 2, f) == 2 && b[0] == 0 && b[1] == 0) {
return cmListFileLexer_BOM_UTF32LE;
- }
+ }
fsetpos(f, &p);
return cmListFileLexer_BOM_UTF16LE;
- }
}
+ }
rewind(f);
return cmListFileLexer_BOM_None;
}
@@ -2552,8 +2587,7 @@ int cmListFileLexer_SetFileName(cmListFileLexer* lexer, const char* name,
{
int result = 1;
cmListFileLexerDestroy(lexer);
- if(name)
- {
+ if (name) {
#ifdef _WIN32
wchar_t* wname = cmsysEncoding_DupToWide(name);
lexer->file = _wfopen(wname, L"rb");
@@ -2561,18 +2595,14 @@ int cmListFileLexer_SetFileName(cmListFileLexer* lexer, const char* name,
#else
lexer->file = fopen(name, "rb");
#endif
- if(lexer->file)
- {
- if(bom)
- {
+ if (lexer->file) {
+ if (bom) {
*bom = cmListFileLexer_ReadBOM(lexer->file);
- }
}
- else
- {
+ } else {
result = 0;
- }
}
+ }
cmListFileLexerInit(lexer);
return result;
}
@@ -2582,21 +2612,17 @@ int cmListFileLexer_SetString(cmListFileLexer* lexer, const char* text)
{
int result = 1;
cmListFileLexerDestroy(lexer);
- if(text)
- {
+ if (text) {
int length = (int)strlen(text);
- lexer->string_buffer = (char*)malloc(length+1);
- if(lexer->string_buffer)
- {
+ lexer->string_buffer = (char*)malloc(length + 1);
+ if (lexer->string_buffer) {
strcpy(lexer->string_buffer, text);
lexer->string_position = lexer->string_buffer;
lexer->string_left = length;
- }
- else
- {
+ } else {
result = 0;
- }
}
+ }
cmListFileLexerInit(lexer);
return result;
}
@@ -2604,45 +2630,35 @@ int cmListFileLexer_SetString(cmListFileLexer* lexer, const char* text)
/*--------------------------------------------------------------------------*/
cmListFileLexer_Token* cmListFileLexer_Scan(cmListFileLexer* lexer)
{
- if(!lexer->file)
- {
+ if (!lexer->file) {
return 0;
- }
- if(cmListFileLexer_yylex(lexer->scanner, lexer))
- {
+ }
+ if (cmListFileLexer_yylex(lexer->scanner, lexer)) {
return &lexer->token;
- }
- else
- {
+ } else {
cmListFileLexer_SetFileName(lexer, 0, 0);
return 0;
- }
+ }
}
/*--------------------------------------------------------------------------*/
long cmListFileLexer_GetCurrentLine(cmListFileLexer* lexer)
{
- if(lexer->file)
- {
+ if (lexer->file) {
return lexer->line;
- }
- else
- {
+ } else {
return 0;
- }
+ }
}
/*--------------------------------------------------------------------------*/
long cmListFileLexer_GetCurrentColumn(cmListFileLexer* lexer)
{
- if(lexer->file)
- {
+ if (lexer->file) {
return lexer->column;
- }
- else
- {
+ } else {
return 0;
- }
+ }
}
/*--------------------------------------------------------------------------*/
@@ -2650,21 +2666,33 @@ const char* cmListFileLexer_GetTypeAsString(cmListFileLexer* lexer,
cmListFileLexer_Type type)
{
(void)lexer;
- switch(type)
- {
- case cmListFileLexer_Token_None: return "nothing";
- case cmListFileLexer_Token_Space: return "space";
- case cmListFileLexer_Token_Newline: return "newline";
- case cmListFileLexer_Token_Identifier: return "identifier";
- case cmListFileLexer_Token_ParenLeft: return "left paren";
- case cmListFileLexer_Token_ParenRight: return "right paren";
- case cmListFileLexer_Token_ArgumentUnquoted: return "unquoted argument";
- case cmListFileLexer_Token_ArgumentQuoted: return "quoted argument";
- case cmListFileLexer_Token_ArgumentBracket: return "bracket argument";
- case cmListFileLexer_Token_CommentBracket: return "bracket comment";
- case cmListFileLexer_Token_BadCharacter: return "bad character";
- case cmListFileLexer_Token_BadBracket: return "unterminated bracket";
- case cmListFileLexer_Token_BadString: return "unterminated string";
- }
+ switch (type) {
+ case cmListFileLexer_Token_None:
+ return "nothing";
+ case cmListFileLexer_Token_Space:
+ return "space";
+ case cmListFileLexer_Token_Newline:
+ return "newline";
+ case cmListFileLexer_Token_Identifier:
+ return "identifier";
+ case cmListFileLexer_Token_ParenLeft:
+ return "left paren";
+ case cmListFileLexer_Token_ParenRight:
+ return "right paren";
+ case cmListFileLexer_Token_ArgumentUnquoted:
+ return "unquoted argument";
+ case cmListFileLexer_Token_ArgumentQuoted:
+ return "quoted argument";
+ case cmListFileLexer_Token_ArgumentBracket:
+ return "bracket argument";
+ case cmListFileLexer_Token_CommentBracket:
+ return "bracket comment";
+ case cmListFileLexer_Token_BadCharacter:
+ return "bad character";
+ case cmListFileLexer_Token_BadBracket:
+ return "unterminated bracket";
+ case cmListFileLexer_Token_BadString:
+ return "unterminated string";
+ }
return "unknown token";
}
diff --git a/Source/cmListFileLexer.in.l b/Source/cmListFileLexer.in.l
index a520c72..6d44814 100644
--- a/Source/cmListFileLexer.in.l
+++ b/Source/cmListFileLexer.in.l
@@ -14,19 +14,16 @@
This file must be translated to C and modified to build everywhere.
-Run flex like this:
+Run flex >= 2.6 like this:
flex --prefix=cmListFileLexer_yy -ocmListFileLexer.c cmListFileLexer.in.l
Modify cmListFileLexer.c:
- - remove TABs
- - remove use of the 'register' storage class specifier
- - remove the yyunput function
- - add a statement "(void)yyscanner;" to the top of these methods:
- yy_fatal_error, cmListFileLexer_yyalloc, cmListFileLexer_yyrealloc, cmListFileLexer_yyfree
+ - remove trailing whitespace: sed -i 's/\s*$//' cmListFileLexer.c
+ - remove blank lines at end of file
- remove statement "yyscanner = NULL;" from cmListFileLexer_yylex_destroy
- remove all YY_BREAK lines occurring right after return statements
- - remove the isatty forward declaration
+ - remove unnecessary cast to (int) in yy_get_next_buffer
*/
@@ -45,7 +42,7 @@ Modify cmListFileLexer.c:
struct cmListFileLexer_s
{
cmListFileLexer_Token token;
- int bracket;
+ yy_size_t bracket;
int comment;
int line;
int column;
@@ -102,26 +99,20 @@ LEGACY {MAKEVAR}|{UNQUOTED}|\"({MAKEVAR}|{UNQUOTED}|[ \t[=])*\"
#?\[=*\[\n? {
const char* bracket = yytext;
lexer->comment = yytext[0] == '#';
- if(lexer->comment)
- {
+ if (lexer->comment) {
lexer->token.type = cmListFileLexer_Token_CommentBracket;
bracket += 1;
- }
- else
- {
+ } else {
lexer->token.type = cmListFileLexer_Token_ArgumentBracket;
- }
+ }
cmListFileLexerSetToken(lexer, "", 0);
- lexer->bracket = (int)(strchr(bracket+1, '[') - bracket);
- if(yytext[yyleng-1] == '\n')
- {
+ lexer->bracket = strchr(bracket+1, '[') - bracket;
+ if (yytext[yyleng-1] == '\n') {
++lexer->line;
lexer->column = 1;
- }
- else
- {
+ } else {
lexer->column += yyleng;
- }
+ }
BEGIN(BRACKET);
}
@@ -159,10 +150,9 @@ LEGACY {MAKEVAR}|{UNQUOTED}|\"({MAKEVAR}|{UNQUOTED}|[ \t[=])*\"
/* Handle ]]====]=======]*/
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
- if(yyleng == lexer->bracket)
- {
+ if (yyleng == lexer->bracket) {
BEGIN(BRACKETEND);
- }
+ }
}
<BRACKETEND>\] {
@@ -291,30 +281,25 @@ static void cmListFileLexerSetToken(cmListFileLexer* lexer, const char* text,
lexer->token.column = lexer->column;
/* Use the same buffer if possible. */
- if(lexer->token.text)
- {
- if(text && length < lexer->size)
- {
+ if (lexer->token.text) {
+ if (text && length < lexer->size) {
strcpy(lexer->token.text, text);
lexer->token.length = length;
return;
- }
+ }
free(lexer->token.text);
lexer->token.text = 0;
lexer->size = 0;
- }
+ }
/* Need to extend the buffer. */
- if(text)
- {
+ if (text) {
lexer->token.text = strdup(text);
lexer->token.length = length;
- lexer->size = length+1;
- }
- else
- {
+ lexer->size = length + 1;
+ } else {
lexer->token.length = 0;
- }
+ }
}
/*--------------------------------------------------------------------------*/
@@ -326,22 +311,20 @@ static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text,
/* If the appended text will fit in the buffer, do not reallocate. */
newSize = lexer->token.length + length + 1;
- if(lexer->token.text && newSize <= lexer->size)
- {
- strcpy(lexer->token.text+lexer->token.length, text);
+ if (lexer->token.text && newSize <= lexer->size) {
+ strcpy(lexer->token.text + lexer->token.length, text);
lexer->token.length += length;
return;
- }
+ }
/* We need to extend the buffer. */
temp = malloc(newSize);
- if(lexer->token.text)
- {
+ if (lexer->token.text) {
memcpy(temp, lexer->token.text, lexer->token.length);
free(lexer->token.text);
- }
- memcpy(temp+lexer->token.length, text, length);
- temp[lexer->token.length+length] = 0;
+ }
+ memcpy(temp + lexer->token.length, text, length);
+ temp[lexer->token.length + length] = 0;
lexer->token.text = temp;
lexer->token.length += length;
lexer->size = newSize;
@@ -351,96 +334,84 @@ static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text,
static int cmListFileLexerInput(cmListFileLexer* lexer, char* buffer,
size_t bufferSize)
{
- if(lexer)
- {
- if(lexer->file)
- {
+ if (lexer) {
+ if (lexer->file) {
/* Convert CRLF -> LF explicitly. The C FILE "t"ext mode
does not convert newlines on all platforms. Move any
trailing CR to the start of the buffer for the next read. */
size_t cr = lexer->cr;
size_t n;
buffer[0] = '\r';
- n = fread(buffer+cr, 1, bufferSize-cr, lexer->file);
- if(n)
- {
+ n = fread(buffer + cr, 1, bufferSize - cr, lexer->file);
+ if (n) {
char* o = buffer;
const char* i = buffer;
const char* e;
n += cr;
- cr = (buffer[n-1] == '\r')? 1:0;
+ cr = (buffer[n - 1] == '\r') ? 1 : 0;
e = buffer + n - cr;
- while(i != e)
- {
- if(i[0] == '\r' && i[1] == '\n')
- {
+ while (i != e) {
+ if (i[0] == '\r' && i[1] == '\n') {
++i;
- }
- *o++ = *i++;
}
- n = o - buffer;
+ *o++ = *i++;
}
- else
- {
+ n = o - buffer;
+ } else {
n = cr;
cr = 0;
- }
+ }
lexer->cr = cr;
return n;
- }
- else if(lexer->string_left)
- {
+ } else if (lexer->string_left) {
int length = lexer->string_left;
- if((int)bufferSize < length) { length = (int)bufferSize; }
+ if ((int)bufferSize < length) {
+ length = (int)bufferSize;
+ }
memcpy(buffer, lexer->string_position, length);
lexer->string_position += length;
lexer->string_left -= length;
return length;
- }
}
+ }
return 0;
}
/*--------------------------------------------------------------------------*/
static void cmListFileLexerInit(cmListFileLexer* lexer)
{
- if(lexer->file || lexer->string_buffer)
- {
+ if (lexer->file || lexer->string_buffer) {
cmListFileLexer_yylex_init(&lexer->scanner);
cmListFileLexer_yyset_extra(lexer, lexer->scanner);
- }
+ }
}
/*--------------------------------------------------------------------------*/
static void cmListFileLexerDestroy(cmListFileLexer* lexer)
{
cmListFileLexerSetToken(lexer, 0, 0);
- if(lexer->file || lexer->string_buffer)
- {
+ if (lexer->file || lexer->string_buffer) {
cmListFileLexer_yylex_destroy(lexer->scanner);
- if(lexer->file)
- {
+ if (lexer->file) {
fclose(lexer->file);
lexer->file = 0;
- }
- if(lexer->string_buffer)
- {
+ }
+ if (lexer->string_buffer) {
free(lexer->string_buffer);
lexer->string_buffer = 0;
lexer->string_left = 0;
lexer->string_position = 0;
- }
}
+ }
}
/*--------------------------------------------------------------------------*/
cmListFileLexer* cmListFileLexer_New()
{
cmListFileLexer* lexer = (cmListFileLexer*)malloc(sizeof(cmListFileLexer));
- if(!lexer)
- {
+ if (!lexer) {
return 0;
- }
+ }
memset(lexer, 0, sizeof(*lexer));
lexer->line = 1;
lexer->column = 1;
@@ -458,39 +429,28 @@ void cmListFileLexer_Delete(cmListFileLexer* lexer)
static cmListFileLexer_BOM cmListFileLexer_ReadBOM(FILE* f)
{
unsigned char b[2];
- if(fread(b, 1, 2, f) == 2)
- {
- if(b[0] == 0xEF && b[1] == 0xBB)
- {
- if(fread(b, 1, 1, f) == 1 && b[0] == 0xBF)
- {
+ if (fread(b, 1, 2, f) == 2) {
+ if (b[0] == 0xEF && b[1] == 0xBB) {
+ if (fread(b, 1, 1, f) == 1 && b[0] == 0xBF) {
return cmListFileLexer_BOM_UTF8;
- }
}
- else if(b[0] == 0xFE && b[1] == 0xFF)
- {
+ } else if (b[0] == 0xFE && b[1] == 0xFF) {
/* UTF-16 BE */
return cmListFileLexer_BOM_UTF16BE;
- }
- else if(b[0] == 0 && b[1] == 0)
- {
- if(fread(b, 1, 2, f) == 2 && b[0] == 0xFE && b[1] == 0xFF)
- {
+ } else if (b[0] == 0 && b[1] == 0) {
+ if (fread(b, 1, 2, f) == 2 && b[0] == 0xFE && b[1] == 0xFF) {
return cmListFileLexer_BOM_UTF32BE;
- }
}
- else if(b[0] == 0xFF && b[1] == 0xFE)
- {
+ } else if (b[0] == 0xFF && b[1] == 0xFE) {
fpos_t p;
fgetpos(f, &p);
- if(fread(b, 1, 2, f) == 2 && b[0] == 0 && b[1] == 0)
- {
+ if (fread(b, 1, 2, f) == 2 && b[0] == 0 && b[1] == 0) {
return cmListFileLexer_BOM_UTF32LE;
- }
+ }
fsetpos(f, &p);
return cmListFileLexer_BOM_UTF16LE;
- }
}
+ }
rewind(f);
return cmListFileLexer_BOM_None;
}
@@ -501,8 +461,7 @@ int cmListFileLexer_SetFileName(cmListFileLexer* lexer, const char* name,
{
int result = 1;
cmListFileLexerDestroy(lexer);
- if(name)
- {
+ if (name) {
#ifdef _WIN32
wchar_t* wname = cmsysEncoding_DupToWide(name);
lexer->file = _wfopen(wname, L"rb");
@@ -510,18 +469,14 @@ int cmListFileLexer_SetFileName(cmListFileLexer* lexer, const char* name,
#else
lexer->file = fopen(name, "rb");
#endif
- if(lexer->file)
- {
- if(bom)
- {
+ if (lexer->file) {
+ if (bom) {
*bom = cmListFileLexer_ReadBOM(lexer->file);
- }
}
- else
- {
+ } else {
result = 0;
- }
}
+ }
cmListFileLexerInit(lexer);
return result;
}
@@ -531,21 +486,17 @@ int cmListFileLexer_SetString(cmListFileLexer* lexer, const char* text)
{
int result = 1;
cmListFileLexerDestroy(lexer);
- if(text)
- {
+ if (text) {
int length = (int)strlen(text);
- lexer->string_buffer = (char*)malloc(length+1);
- if(lexer->string_buffer)
- {
+ lexer->string_buffer = (char*)malloc(length + 1);
+ if (lexer->string_buffer) {
strcpy(lexer->string_buffer, text);
lexer->string_position = lexer->string_buffer;
lexer->string_left = length;
- }
- else
- {
+ } else {
result = 0;
- }
}
+ }
cmListFileLexerInit(lexer);
return result;
}
@@ -553,45 +504,35 @@ int cmListFileLexer_SetString(cmListFileLexer* lexer, const char* text)
/*--------------------------------------------------------------------------*/
cmListFileLexer_Token* cmListFileLexer_Scan(cmListFileLexer* lexer)
{
- if(!lexer->file)
- {
+ if (!lexer->file) {
return 0;
- }
- if(cmListFileLexer_yylex(lexer->scanner, lexer))
- {
+ }
+ if (cmListFileLexer_yylex(lexer->scanner, lexer)) {
return &lexer->token;
- }
- else
- {
+ } else {
cmListFileLexer_SetFileName(lexer, 0, 0);
return 0;
- }
+ }
}
/*--------------------------------------------------------------------------*/
long cmListFileLexer_GetCurrentLine(cmListFileLexer* lexer)
{
- if(lexer->file)
- {
+ if (lexer->file) {
return lexer->line;
- }
- else
- {
+ } else {
return 0;
- }
+ }
}
/*--------------------------------------------------------------------------*/
long cmListFileLexer_GetCurrentColumn(cmListFileLexer* lexer)
{
- if(lexer->file)
- {
+ if (lexer->file) {
return lexer->column;
- }
- else
- {
+ } else {
return 0;
- }
+ }
}
/*--------------------------------------------------------------------------*/
@@ -599,21 +540,33 @@ const char* cmListFileLexer_GetTypeAsString(cmListFileLexer* lexer,
cmListFileLexer_Type type)
{
(void)lexer;
- switch(type)
- {
- case cmListFileLexer_Token_None: return "nothing";
- case cmListFileLexer_Token_Space: return "space";
- case cmListFileLexer_Token_Newline: return "newline";
- case cmListFileLexer_Token_Identifier: return "identifier";
- case cmListFileLexer_Token_ParenLeft: return "left paren";
- case cmListFileLexer_Token_ParenRight: return "right paren";
- case cmListFileLexer_Token_ArgumentUnquoted: return "unquoted argument";
- case cmListFileLexer_Token_ArgumentQuoted: return "quoted argument";
- case cmListFileLexer_Token_ArgumentBracket: return "bracket argument";
- case cmListFileLexer_Token_CommentBracket: return "bracket comment";
- case cmListFileLexer_Token_BadCharacter: return "bad character";
- case cmListFileLexer_Token_BadBracket: return "unterminated bracket";
- case cmListFileLexer_Token_BadString: return "unterminated string";
- }
+ switch (type) {
+ case cmListFileLexer_Token_None:
+ return "nothing";
+ case cmListFileLexer_Token_Space:
+ return "space";
+ case cmListFileLexer_Token_Newline:
+ return "newline";
+ case cmListFileLexer_Token_Identifier:
+ return "identifier";
+ case cmListFileLexer_Token_ParenLeft:
+ return "left paren";
+ case cmListFileLexer_Token_ParenRight:
+ return "right paren";
+ case cmListFileLexer_Token_ArgumentUnquoted:
+ return "unquoted argument";
+ case cmListFileLexer_Token_ArgumentQuoted:
+ return "quoted argument";
+ case cmListFileLexer_Token_ArgumentBracket:
+ return "bracket argument";
+ case cmListFileLexer_Token_CommentBracket:
+ return "bracket comment";
+ case cmListFileLexer_Token_BadCharacter:
+ return "bad character";
+ case cmListFileLexer_Token_BadBracket:
+ return "unterminated bracket";
+ case cmListFileLexer_Token_BadString:
+ return "unterminated string";
+ }
return "unknown token";
}
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 671d8a0..c7e1a90f8 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -123,7 +123,8 @@ cmGlobalNinjaGenerator* cmLocalNinjaGenerator::GetGlobalNinjaGenerator()
std::string cmLocalNinjaGenerator::ConvertToLinkReference(
std::string const& lib, OutputFormat format)
{
- return this->Convert(lib, HOME_OUTPUT, format);
+ std::string path = this->GetGlobalNinjaGenerator()->ConvertToNinjaPath(lib);
+ return this->ConvertToOutputFormat(path, format);
}
std::string cmLocalNinjaGenerator::ConvertToIncludeReference(
@@ -224,8 +225,13 @@ void cmLocalNinjaGenerator::WriteNinjaFilesInclusion(std::ostream& os)
cmGlobalNinjaGenerator::WriteDivider(os);
os << "# Include auxiliary files.\n"
<< "\n";
- cmGlobalNinjaGenerator::WriteInclude(
- os, cmGlobalNinjaGenerator::NINJA_RULES_FILE, "Include rules file.");
+ cmGlobalNinjaGenerator* ng = this->GetGlobalNinjaGenerator();
+ std::string const ninjaRulesFile =
+ ng->NinjaOutputPath(cmGlobalNinjaGenerator::NINJA_RULES_FILE);
+ std::string const rulesFilePath =
+ ng->EncodeIdent(ng->EncodePath(ninjaRulesFile), os);
+ cmGlobalNinjaGenerator::WriteInclude(os, rulesFilePath,
+ "Include rules file.");
os << "\n";
}
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 831d44b..8d7a892 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -652,7 +652,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
cmNinjaDeps(1, targetOutputReal), emptyDeps, emptyDeps, symlinkVars);
} else {
cmNinjaDeps symlinks;
- const std::string soName = this->GetTargetFilePath(this->TargetNameSO);
+ std::string const soName =
+ this->ConvertToNinjaPath(this->GetTargetFilePath(this->TargetNameSO));
// If one link has to be created.
if (targetOutputReal == soName || targetOutput == soName) {
symlinkVars["SONAME"] = soName;
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index c214c8a..4d58242 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -521,8 +521,10 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
std::string const language = source->GetLanguage();
std::string const sourceFileName =
language == "RC" ? source->GetFullPath() : this->GetSourceFilePath(source);
- std::string const objectDir = this->GeneratorTarget->GetSupportDirectory();
- std::string const objectFileName = this->GetObjectFilePath(source);
+ std::string const objectDir =
+ this->ConvertToNinjaPath(this->GeneratorTarget->GetSupportDirectory());
+ std::string const objectFileName =
+ this->ConvertToNinjaPath(this->GetObjectFilePath(source));
std::string const objectFileDir =
cmSystemTools::GetFilenamePath(objectFileName);
@@ -582,9 +584,9 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
EnsureParentDirectoryExists(objectFileName);
vars["OBJECT_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat(
- ConvertToNinjaPath(objectDir), cmLocalGenerator::SHELL);
+ objectDir, cmLocalGenerator::SHELL);
vars["OBJECT_FILE_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat(
- ConvertToNinjaPath(objectFileDir), cmLocalGenerator::SHELL);
+ objectFileDir, cmLocalGenerator::SHELL);
this->addPoolNinjaVariable("JOB_POOL_COMPILE", this->GetGeneratorTarget(),
vars);
@@ -667,10 +669,12 @@ void cmNinjaTargetGenerator::EnsureDirectoryExists(
if (cmSystemTools::FileIsFullPath(path.c_str())) {
cmSystemTools::MakeDirectory(path.c_str());
} else {
- const std::string fullPath = std::string(this->GetGlobalGenerator()
- ->GetCMakeInstance()
- ->GetHomeOutputDirectory()) +
- "/" + path;
+ cmGlobalNinjaGenerator* gg = this->GetGlobalGenerator();
+ std::string fullPath =
+ std::string(gg->GetCMakeInstance()->GetHomeOutputDirectory());
+ // Also ensures their is a trailing slash.
+ gg->StripNinjaOutputPathPrefixAsSuffix(fullPath);
+ fullPath += path;
cmSystemTools::MakeDirectory(fullPath.c_str());
}
}
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx
index b0b1147..d07341c 100644
--- a/Source/cmNinjaUtilityTargetGenerator.cxx
+++ b/Source/cmNinjaUtilityTargetGenerator.cxx
@@ -33,6 +33,8 @@ void cmNinjaUtilityTargetGenerator::Generate()
{
std::string utilCommandName = cmake::GetCMakeFilesDirectoryPostSlash();
utilCommandName += this->GetTargetName() + ".util";
+ utilCommandName =
+ this->GetGlobalGenerator()->NinjaOutputPath(utilCommandName);
std::vector<std::string> commands;
cmNinjaDeps deps, outputs, util_outputs(1, utilCommandName);
diff --git a/Tests/ExternalProjectUpdate/CMakeLists.txt b/Tests/ExternalProjectUpdate/CMakeLists.txt
index fbb3388..dbf26c8 100644
--- a/Tests/ExternalProjectUpdate/CMakeLists.txt
+++ b/Tests/ExternalProjectUpdate/CMakeLists.txt
@@ -21,6 +21,18 @@ set_property(DIRECTORY PROPERTY EP_BASE ${base})
set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test)
set_property(DIRECTORY PROPERTY EP_INDEPENDENT_STEP_TARGETS update)
+ExternalProject_Add(TestUpdateCommand
+ SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
+ UPDATE_COMMAND ${CMAKE_COMMAND} -E echo update
+ UPDATE_DISCONNECTED 1
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ INDEPENDENT_STEP_TARGETS update
+ )
+add_custom_target(TestUpdateCommandDriver ALL)
+add_dependencies(TestUpdateCommandDriver TestUpdateCommand-update)
+
set(do_git_tests 0)
if(GIT_EXECUTABLE)
diff --git a/Tests/GhsMultiDuplicateSourceFilenames/CMakeLists.txt b/Tests/GhsMultiDuplicateSourceFilenames/CMakeLists.txt
index ffdb582..82a014b 100644
--- a/Tests/GhsMultiDuplicateSourceFilenames/CMakeLists.txt
+++ b/Tests/GhsMultiDuplicateSourceFilenames/CMakeLists.txt
@@ -1,7 +1,12 @@
cmake_minimum_required(VERSION 3.5)
project(demo C)
-add_library(libdemo test.c subfolder/test.c)
+add_library(libdemo
+ test.c
+ subfolder_test.c
+ subfolder_test_0.c
+ "subfolder/test.c"
+)
add_executable(demo main.c)
target_link_libraries(demo libdemo)
diff --git a/Tests/GhsMultiDuplicateSourceFilenames/main.c b/Tests/GhsMultiDuplicateSourceFilenames/main.c
index 301a32e..d5b7914 100644
--- a/Tests/GhsMultiDuplicateSourceFilenames/main.c
+++ b/Tests/GhsMultiDuplicateSourceFilenames/main.c
@@ -1,9 +1,13 @@
int test_a(void);
int test_b(void);
+int test_c(void);
+int test_d(void);
int main(int argc, char* argv[])
{
test_a();
test_b();
+ test_c();
+ test_d();
return 0;
}
diff --git a/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test.c b/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test.c
new file mode 100644
index 0000000..c552e6a
--- /dev/null
+++ b/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test.c
@@ -0,0 +1,5 @@
+
+int test_c()
+{
+ return 1;
+}
diff --git a/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c b/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c
new file mode 100644
index 0000000..170b33d
--- /dev/null
+++ b/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c
@@ -0,0 +1,5 @@
+
+int test_d()
+{
+ return 1;
+}
diff --git a/Tests/RunCMake/Ninja/CheckNoPrefixSubDir.cmake b/Tests/RunCMake/Ninja/CheckNoPrefixSubDir.cmake
new file mode 100644
index 0000000..b845f2f
--- /dev/null
+++ b/Tests/RunCMake/Ninja/CheckNoPrefixSubDir.cmake
@@ -0,0 +1,7 @@
+add_custom_target(check_no_prefix_sub_dir ALL
+ COMMAND "${CMAKE_COMMAND}"
+ "-DNINJA_OUTPUT_PATH_PREFIX=${CMAKE_NINJA_OUTPUT_PATH_PREFIX}"
+ "-DCUR_BIN_DIR=${CMAKE_CURRENT_BINARY_DIR}"
+ -P "${CMAKE_CURRENT_SOURCE_DIR}/CheckNoPrefixSubDirScript.cmake"
+ VERBATIM
+ )
diff --git a/Tests/RunCMake/Ninja/CheckNoPrefixSubDirScript.cmake b/Tests/RunCMake/Ninja/CheckNoPrefixSubDirScript.cmake
new file mode 100644
index 0000000..5a03fcb
--- /dev/null
+++ b/Tests/RunCMake/Ninja/CheckNoPrefixSubDirScript.cmake
@@ -0,0 +1,8 @@
+# Check that the prefix sub-directory is not repeated.
+
+if(EXISTS "${CUR_BIN_DIR}/${NINJA_OUTPUT_PATH_PREFIX}")
+ message(FATAL_ERROR
+ "no sub directory named after the CMAKE_NINJA_OUTPUT_PATH_PREFIX "
+ "should be in the binary directory."
+ )
+endif()
diff --git a/Tests/RunCMake/Ninja/CheckOutput.cmake b/Tests/RunCMake/Ninja/CheckOutput.cmake
new file mode 100644
index 0000000..ddb35a7
--- /dev/null
+++ b/Tests/RunCMake/Ninja/CheckOutput.cmake
@@ -0,0 +1,23 @@
+# Add rules to check the generated executable works.
+
+set(hello_output "${CMAKE_CURRENT_BINARY_DIR}/hello.output")
+add_custom_command(
+ OUTPUT "${hello_output}"
+ COMMAND "$<TARGET_FILE:hello>" > "${hello_output}"
+ DEPENDS hello
+ VERBATIM
+ )
+
+if(NOT DEFINED HELLO_OUTPUT_STRING)
+ set(HELLO_OUTPUT_STRING "Hello world!\n")
+endif()
+
+set(hello_output_ref "${CMAKE_CURRENT_BINARY_DIR}/hello.output.ref")
+file(WRITE "${hello_output_ref}" "${HELLO_OUTPUT_STRING}")
+
+add_custom_target(check_output ALL
+ COMMAND "${CMAKE_COMMAND}" -E compare_files
+ "${hello_output}" "${hello_output_ref}"
+ DEPENDS "${hello_output}" "${hello_output_ref}"
+ VERBATIM
+ )
diff --git a/Tests/RunCMake/Ninja/CustomCommandWorkingDirectory.cmake b/Tests/RunCMake/Ninja/CustomCommandWorkingDirectory.cmake
new file mode 100644
index 0000000..8e01c8c
--- /dev/null
+++ b/Tests/RunCMake/Ninja/CustomCommandWorkingDirectory.cmake
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 3.5)
+project(hello NONE)
+
+add_custom_command(
+ OUTPUT hello.copy.c
+ COMMAND "${CMAKE_COMMAND}" -E copy
+ "${CMAKE_CURRENT_SOURCE_DIR}/hello.c"
+ hello.copy.c
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ )
+add_custom_target(copy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/hello.copy.c")
+
+include(CheckNoPrefixSubDir.cmake)
diff --git a/Tests/RunCMake/Ninja/Executable.cmake b/Tests/RunCMake/Ninja/Executable.cmake
new file mode 100644
index 0000000..4e17d68
--- /dev/null
+++ b/Tests/RunCMake/Ninja/Executable.cmake
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.5)
+project(hello C)
+add_executable(hello hello.c)
+include(CheckOutput.cmake)
+include(CheckNoPrefixSubDir.cmake)
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 4e06888..c73f852 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -1,5 +1,20 @@
include(RunCMake)
+# Detect ninja version so we know what tests can be supported.
+execute_process(
+ COMMAND "${RunCMake_MAKE_PROGRAM}" --version
+ OUTPUT_VARIABLE ninja_out
+ ERROR_VARIABLE ninja_out
+ RESULT_VARIABLE ninja_res
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+if(ninja_res EQUAL 0 AND "x${ninja_out}" MATCHES "^x[0-9]+\\.[0-9]+")
+ set(ninja_version "${ninja_out}")
+ message(STATUS "ninja version: ${ninja_version}")
+else()
+ message(FATAL_ERROR "'ninja --version' reported:\n${ninja_out}")
+endif()
+
function(run_CMP0058 case)
# Use a single build tree for a few tests without cleaning.
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0058-${case}-build)
@@ -32,3 +47,153 @@ function(run_SubDir)
run_cmake_command(SubDir-build ${CMAKE_COMMAND} --build . --target ${SubDir_all})
endfunction()
run_SubDir()
+
+function(run_ninja dir)
+ execute_process(
+ COMMAND "${RunCMake_MAKE_PROGRAM}"
+ WORKING_DIRECTORY "${dir}"
+ OUTPUT_VARIABLE ninja_stdout
+ ERROR_VARIABLE ninja_stderr
+ RESULT_VARIABLE ninja_result
+ )
+ if(NOT ninja_result EQUAL 0)
+ message(STATUS "
+============ beginning of ninja's stdout ============
+${ninja_stdout}
+=============== end of ninja's stdout ===============
+")
+ message(STATUS "
+============ beginning of ninja's stderr ============
+${ninja_stderr}
+=============== end of ninja's stderr ===============
+")
+ message(FATAL_ERROR
+ "top ninja build failed exited with status ${ninja_result}")
+ endif()
+endfunction(run_ninja)
+
+function(sleep delay)
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E sleep ${delay}
+ RESULT_VARIABLE result
+ )
+ if(NOT result EQUAL 0)
+ message(FATAL_ERROR "failed to sleep for ${delay} second.")
+ endif()
+endfunction(sleep)
+
+function(touch path)
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E touch ${path}
+ RESULT_VARIABLE result
+ )
+ if(NOT result EQUAL 0)
+ message(FATAL_ERROR "failed to touch main ${path} file.")
+ endif()
+endfunction(touch)
+
+macro(ninja_escape_path path out)
+ string(REPLACE "\$ " "\$\$" "${out}" "${path}")
+ string(REPLACE " " "\$ " "${out}" "${${out}}")
+ string(REPLACE ":" "\$:" "${out}" "${${out}}")
+endmacro(ninja_escape_path)
+
+macro(shell_escape string out)
+ string(REPLACE "\"" "\\\"" "${out}" "${string}")
+endmacro(shell_escape)
+
+function(run_sub_cmake test ninja_output_path_prefix)
+ set(top_build_dir "${RunCMake_BINARY_DIR}/${test}-build/")
+ file(REMOVE_RECURSE "${top_build_dir}")
+ file(MAKE_DIRECTORY "${top_build_dir}")
+
+ ninja_escape_path("${ninja_output_path_prefix}"
+ escaped_ninja_output_path_prefix)
+
+ # Generate top build ninja file.
+ set(top_build_ninja "${top_build_dir}/build.ninja")
+ shell_escape("${top_build_ninja}" escaped_top_build_ninja)
+ set(build_ninja_dep "${top_build_dir}/build_ninja_dep")
+ ninja_escape_path("${build_ninja_dep}" escaped_build_ninja_dep)
+ shell_escape("${CMAKE_COMMAND}" escaped_CMAKE_COMMAND)
+ file(WRITE "${build_ninja_dep}" "fake dependency of top build.ninja file\n")
+ if(WIN32)
+ set(cmd_prefix "cmd.exe /C \"")
+ set(cmd_suffix "\"")
+ else()
+ set(cmd_prefix "")
+ set(cmd_suffix "")
+ endif()
+ file(WRITE "${top_build_ninja}" "\
+subninja ${escaped_ninja_output_path_prefix}/build.ninja
+default ${escaped_ninja_output_path_prefix}/all
+
+# Sleep for 1 second before to regenerate to make sure the timestamp of
+# the top build.ninja will be strictly greater than the timestamp of the
+# sub/build.ninja file. We assume the system as 1 sec timestamp resolution.
+rule RERUN
+ command = ${cmd_prefix}\"${escaped_CMAKE_COMMAND}\" -E sleep 1 && \"${escaped_CMAKE_COMMAND}\" -E touch \"${escaped_top_build_ninja}\"${cmd_suffix}
+ description = Testing regeneration
+ generator = 1
+
+build build.ninja: RERUN ${escaped_build_ninja_dep} || ${escaped_ninja_output_path_prefix}/build.ninja
+ pool = console
+")
+
+ # Run sub cmake project.
+ set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_OUTPUT_PATH_PREFIX=${ninja_output_path_prefix}")
+ set(RunCMake_TEST_BINARY_DIR "${top_build_dir}/${ninja_output_path_prefix}")
+ run_cmake(${test})
+
+ # Check there is no 'default' statement in Ninja file generated by CMake.
+ set(sub_build_ninja "${RunCMake_TEST_BINARY_DIR}/build.ninja")
+ file(READ "${sub_build_ninja}" sub_build_ninja_file)
+ if(sub_build_ninja_file MATCHES "\ndefault [^\n][^\n]*all\n")
+ message(FATAL_ERROR
+ "unexpected 'default' statement found in '${sub_build_ninja}'")
+ endif()
+
+ # Run ninja from the top build directory.
+ run_ninja("${top_build_dir}")
+
+ # Test regeneration rules run in order.
+ set(main_cmakelists "${RunCMake_SOURCE_DIR}/CMakeLists.txt")
+ sleep(1) # Assume the system as 1 sec timestamp resolution.
+ touch("${main_cmakelists}")
+ touch("${build_ninja_dep}")
+ run_ninja("${top_build_dir}")
+ file(TIMESTAMP "${main_cmakelists}" mtime_main_cmakelists UTC)
+ file(TIMESTAMP "${sub_build_ninja}" mtime_sub_build_ninja UTC)
+ file(TIMESTAMP "${top_build_ninja}" mtime_top_build_ninja UTC)
+
+ # Check sub build.ninja is regenerated.
+ if(mtime_main_cmakelists STRGREATER mtime_sub_build_ninja)
+ message(FATAL_ERROR
+ "sub build.ninja not regenerated:
+ CMakeLists.txt = ${mtime_main_cmakelists}
+ sub/build.ninja = ${mtime_sub_build_ninja}")
+ endif()
+
+ # Check top build.ninja is regenerated after sub build.ninja.
+ if(NOT mtime_top_build_ninja STRGREATER mtime_sub_build_ninja)
+ message(FATAL_ERROR
+ "top build.ninja not regenerated strictly after sub build.ninja:
+ sub/build.ninja = ${mtime_sub_build_ninja}
+ build.ninja = ${mtime_top_build_ninja}")
+ endif()
+
+endfunction(run_sub_cmake)
+
+if("${ninja_version}" VERSION_LESS 1.6)
+ message(WARNING "Ninja is too old; skipping rest of test.")
+ return()
+endif()
+
+foreach(ninja_output_path_prefix "sub space" "sub")
+ run_sub_cmake(Executable "${ninja_output_path_prefix}")
+ run_sub_cmake(StaticLib "${ninja_output_path_prefix}")
+ run_sub_cmake(SharedLib "${ninja_output_path_prefix}")
+ run_sub_cmake(TwoLibs "${ninja_output_path_prefix}")
+ run_sub_cmake(SubDirPrefix "${ninja_output_path_prefix}")
+ run_sub_cmake(CustomCommandWorkingDirectory "${ninja_output_path_prefix}")
+endforeach(ninja_output_path_prefix)
diff --git a/Tests/RunCMake/Ninja/SharedLib.cmake b/Tests/RunCMake/Ninja/SharedLib.cmake
new file mode 100644
index 0000000..1a78390
--- /dev/null
+++ b/Tests/RunCMake/Ninja/SharedLib.cmake
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.5)
+project(hello C)
+add_library(greeting SHARED greeting.c)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+add_executable(hello hello_with_greeting.c)
+target_link_libraries(hello greeting)
+include(CheckOutput.cmake)
+include(CheckNoPrefixSubDir.cmake)
diff --git a/Tests/RunCMake/Ninja/StaticLib.cmake b/Tests/RunCMake/Ninja/StaticLib.cmake
new file mode 100644
index 0000000..0f815ae
--- /dev/null
+++ b/Tests/RunCMake/Ninja/StaticLib.cmake
@@ -0,0 +1,9 @@
+cmake_minimum_required(VERSION 3.5)
+project(hello C)
+add_definitions(-DGREETING_STATIC)
+add_library(greeting STATIC greeting.c)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+add_executable(hello hello_with_greeting.c)
+target_link_libraries(hello greeting)
+include(CheckOutput.cmake)
+include(CheckNoPrefixSubDir.cmake)
diff --git a/Tests/RunCMake/Ninja/SubDirPrefix.cmake b/Tests/RunCMake/Ninja/SubDirPrefix.cmake
new file mode 100644
index 0000000..30ad1e6
--- /dev/null
+++ b/Tests/RunCMake/Ninja/SubDirPrefix.cmake
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.5)
+project(hello C)
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
+add_subdirectory(SubDirPrefix)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+add_executable(hello hello_sub_greeting.c)
+target_link_libraries(hello greeting)
+include(CheckOutput.cmake)
diff --git a/Tests/RunCMake/Ninja/SubDirPrefix/CMakeLists.txt b/Tests/RunCMake/Ninja/SubDirPrefix/CMakeLists.txt
new file mode 100644
index 0000000..575597d
--- /dev/null
+++ b/Tests/RunCMake/Ninja/SubDirPrefix/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(greeting SHARED greeting.c)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/Tests/RunCMake/Ninja/SubDirPrefix/greeting.c b/Tests/RunCMake/Ninja/SubDirPrefix/greeting.c
new file mode 100644
index 0000000..ba3e55b
--- /dev/null
+++ b/Tests/RunCMake/Ninja/SubDirPrefix/greeting.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+#if defined(_WIN32) && !defined(GREETING_STATIC)
+__declspec(dllexport)
+#endif
+ void greeting(void)
+{
+ printf("Hello world!\n");
+}
diff --git a/Tests/RunCMake/Ninja/SubDirPrefix/greeting.h b/Tests/RunCMake/Ninja/SubDirPrefix/greeting.h
new file mode 100644
index 0000000..ee4053e
--- /dev/null
+++ b/Tests/RunCMake/Ninja/SubDirPrefix/greeting.h
@@ -0,0 +1,4 @@
+#if defined(_WIN32) && !defined(GREETING_STATIC)
+__declspec(dllimport)
+#endif
+ void greeting(void);
diff --git a/Tests/RunCMake/Ninja/TwoLibs.cmake b/Tests/RunCMake/Ninja/TwoLibs.cmake
new file mode 100644
index 0000000..666452f
--- /dev/null
+++ b/Tests/RunCMake/Ninja/TwoLibs.cmake
@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 3.5)
+project(hello C)
+
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib-static")
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
+
+add_library(greeting SHARED greeting.c)
+add_library(greeting2 STATIC greeting2.c)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+add_executable(hello hello_with_two_greetings.c)
+target_link_libraries(hello greeting greeting2)
+
+set(HELLO_OUTPUT_STRING "Hello world!\nHello world 2!\n")
+include(CheckOutput.cmake)
+
+include(CheckNoPrefixSubDir.cmake)
diff --git a/Tests/RunCMake/Ninja/greeting.c b/Tests/RunCMake/Ninja/greeting.c
new file mode 100644
index 0000000..ba3e55b
--- /dev/null
+++ b/Tests/RunCMake/Ninja/greeting.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+#if defined(_WIN32) && !defined(GREETING_STATIC)
+__declspec(dllexport)
+#endif
+ void greeting(void)
+{
+ printf("Hello world!\n");
+}
diff --git a/Tests/RunCMake/Ninja/greeting.h b/Tests/RunCMake/Ninja/greeting.h
new file mode 100644
index 0000000..ee4053e
--- /dev/null
+++ b/Tests/RunCMake/Ninja/greeting.h
@@ -0,0 +1,4 @@
+#if defined(_WIN32) && !defined(GREETING_STATIC)
+__declspec(dllimport)
+#endif
+ void greeting(void);
diff --git a/Tests/RunCMake/Ninja/greeting2.c b/Tests/RunCMake/Ninja/greeting2.c
new file mode 100644
index 0000000..c6ed87d
--- /dev/null
+++ b/Tests/RunCMake/Ninja/greeting2.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+void greeting2(void)
+{
+ printf("Hello world 2!\n");
+}
diff --git a/Tests/RunCMake/Ninja/greeting2.h b/Tests/RunCMake/Ninja/greeting2.h
new file mode 100644
index 0000000..c4d8f9b
--- /dev/null
+++ b/Tests/RunCMake/Ninja/greeting2.h
@@ -0,0 +1 @@
+void greeting2(void);
diff --git a/Tests/RunCMake/Ninja/hello.c b/Tests/RunCMake/Ninja/hello.c
new file mode 100644
index 0000000..aac8b4e
--- /dev/null
+++ b/Tests/RunCMake/Ninja/hello.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main(void)
+{
+ printf("Hello world!\n");
+ return 0;
+}
diff --git a/Tests/RunCMake/Ninja/hello_sub_greeting.c b/Tests/RunCMake/Ninja/hello_sub_greeting.c
new file mode 100644
index 0000000..fc4bd60
--- /dev/null
+++ b/Tests/RunCMake/Ninja/hello_sub_greeting.c
@@ -0,0 +1,7 @@
+#include <SubDirPrefix/greeting.h>
+
+int main(void)
+{
+ greeting();
+ return 0;
+}
diff --git a/Tests/RunCMake/Ninja/hello_with_greeting.c b/Tests/RunCMake/Ninja/hello_with_greeting.c
new file mode 100644
index 0000000..dbf90e3
--- /dev/null
+++ b/Tests/RunCMake/Ninja/hello_with_greeting.c
@@ -0,0 +1,7 @@
+#include <greeting.h>
+
+int main(void)
+{
+ greeting();
+ return 0;
+}
diff --git a/Tests/RunCMake/Ninja/hello_with_two_greetings.c b/Tests/RunCMake/Ninja/hello_with_two_greetings.c
new file mode 100644
index 0000000..cbbdaad
--- /dev/null
+++ b/Tests/RunCMake/Ninja/hello_with_two_greetings.c
@@ -0,0 +1,9 @@
+#include <greeting.h>
+#include <greeting2.h>
+
+int main(void)
+{
+ greeting();
+ greeting2();
+ return 0;
+}
diff --git a/Tests/RunCMake/file/GLOB.cmake b/Tests/RunCMake/file/GLOB.cmake
index 3d577e3..c524e42 100644
--- a/Tests/RunCMake/file/GLOB.cmake
+++ b/Tests/RunCMake/file/GLOB.cmake
@@ -12,17 +12,14 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir/dir 2 subdir fi
file(GLOB CONTENT_LIST "${CMAKE_CURRENT_BINARY_DIR}/test/*/*")
list(LENGTH CONTENT_LIST CONTENT_COUNT)
message("content: ${CONTENT_COUNT} ")
-list(SORT CONTENT_LIST)
message("${CONTENT_LIST}")
file(GLOB CONTENT_LIST LIST_DIRECTORIES true "${CMAKE_CURRENT_BINARY_DIR}/test/*/*")
list(LENGTH CONTENT_LIST CONTENT_COUNT)
message("content: ${CONTENT_COUNT} ")
-list(SORT CONTENT_LIST)
message("${CONTENT_LIST}")
file(GLOB CONTENT_LIST LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/test/*/*")
list(LENGTH CONTENT_LIST CONTENT_COUNT)
message("content: ${CONTENT_COUNT} ")
-list(SORT CONTENT_LIST)
message("${CONTENT_LIST}")
diff --git a/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake
index a8c6784..fb8be42 100644
--- a/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake
+++ b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake
@@ -7,17 +7,14 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_BINA
file(GLOB_RECURSE CONTENT_LIST FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*")
list(LENGTH CONTENT_LIST CONTENT_COUNT)
message("content: ${CONTENT_COUNT} ")
-list(SORT CONTENT_LIST)
message("${CONTENT_LIST}")
file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES false FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*")
list(LENGTH CONTENT_LIST CONTENT_COUNT)
message("content: ${CONTENT_COUNT} ")
-list(SORT CONTENT_LIST)
message("${CONTENT_LIST}")
file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES true FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*")
list(LENGTH CONTENT_LIST CONTENT_COUNT)
message("content: ${CONTENT_COUNT} ")
-list(SORT CONTENT_LIST)
message("${CONTENT_LIST}")
diff --git a/Tests/RunCMake/file/GLOB_RECURSE.cmake b/Tests/RunCMake/file/GLOB_RECURSE.cmake
index 6db377b..530930f 100644
--- a/Tests/RunCMake/file/GLOB_RECURSE.cmake
+++ b/Tests/RunCMake/file/GLOB_RECURSE.cmake
@@ -12,17 +12,14 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir/dir 2 subdir fi
file(GLOB_RECURSE CONTENT_LIST "${CMAKE_CURRENT_BINARY_DIR}/test/*/*")
list(LENGTH CONTENT_LIST CONTENT_COUNT)
message("content: ${CONTENT_COUNT} ")
-list(SORT CONTENT_LIST)
message("${CONTENT_LIST}")
file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/test/*/*")
list(LENGTH CONTENT_LIST CONTENT_COUNT)
message("content: ${CONTENT_COUNT} ")
-list(SORT CONTENT_LIST)
message("${CONTENT_LIST}")
file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES true "${CMAKE_CURRENT_BINARY_DIR}/test/*/*")
list(LENGTH CONTENT_LIST CONTENT_COUNT)
message("content: ${CONTENT_COUNT} ")
-list(SORT CONTENT_LIST)
message("${CONTENT_LIST}")