Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63814 - in trunk/tools/quickbook: detail test
From: daniel_james_at_[hidden]
Date: 2010-07-10 11:03:46


Author: danieljames
Date: 2010-07-10 11:03:45 EDT (Sat, 10 Jul 2010)
New Revision: 63814
URL: http://svn.boost.org/trac/boost/changeset/63814

Log:
Check the quickbook version is valid.
Added:
   trunk/tools/quickbook/test/fail-unknown-quickbook-1.quickbook (contents, props changed)
   trunk/tools/quickbook/test/fail-unknown-quickbook-2.quickbook (contents, props changed)
   trunk/tools/quickbook/test/fail-unknown-quickbook-3.quickbook (contents, props changed)
Text files modified:
   trunk/tools/quickbook/detail/actions.cpp | 22 ++++++++++++++++++++--
   trunk/tools/quickbook/detail/quickbook.cpp | 4 ++--
   trunk/tools/quickbook/detail/quickbook.hpp | 4 ++--
   trunk/tools/quickbook/test/Jamfile.v2 | 3 +++
   4 files changed, 27 insertions(+), 6 deletions(-)

Modified: trunk/tools/quickbook/detail/actions.cpp
==============================================================================
--- trunk/tools/quickbook/detail/actions.cpp (original)
+++ trunk/tools/quickbook/detail/actions.cpp 2010-07-10 11:03:45 EDT (Sat, 10 Jul 2010)
@@ -1541,7 +1541,7 @@
             return;
         }
 
- if (qbk_major_version == 0)
+ if (qbk_major_version == -1)
         {
             // hard code quickbook version to v1.1
             qbk_major_version = 1;
@@ -1553,7 +1553,25 @@
         }
         else
         {
- qbk_version_n = (qbk_major_version * 100) + qbk_minor_version;
+ qbk_version_n = ((unsigned) qbk_major_version * 100) +
+ (unsigned) qbk_minor_version;
+ }
+
+ if (qbk_version_n == 106)
+ {
+ detail::outwarn(actions.filename.file_string(),1)
+ << "Quickbook 1.6 is still under development and is "
+ "likely to change in the future." << std::endl;
+ }
+ else if(qbk_version_n < 100 || qbk_version_n > 106)
+ {
+ detail::outerr(actions.filename.file_string(),1)
+ << "Unknown version of quickbook: quickbook "
+ << qbk_major_version
+ << "."
+ << qbk_minor_version
+ << std::endl;
+ ++actions.error_count;
         }
 
         out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"

Modified: trunk/tools/quickbook/detail/quickbook.cpp
==============================================================================
--- trunk/tools/quickbook/detail/quickbook.cpp (original)
+++ trunk/tools/quickbook/detail/quickbook.cpp 2010-07-10 11:03:45 EDT (Sat, 10 Jul 2010)
@@ -38,8 +38,8 @@
     tm* current_time; // the current time
     tm* current_gm_time; // the current UTC time
     bool debug_mode; // for quickbook developers only
- unsigned qbk_major_version = 0;
- unsigned qbk_minor_version = 0;
+ int qbk_major_version = -1;
+ int qbk_minor_version = -1;
     unsigned qbk_version_n = 0; // qbk_major_version * 100 + qbk_minor_version
     bool ms_errors = false; // output errors/warnings as if for VS
     std::vector<std::string> include_path;

Modified: trunk/tools/quickbook/detail/quickbook.hpp
==============================================================================
--- trunk/tools/quickbook/detail/quickbook.hpp (original)
+++ trunk/tools/quickbook/detail/quickbook.hpp 2010-07-10 11:03:45 EDT (Sat, 10 Jul 2010)
@@ -14,8 +14,8 @@
 
 namespace quickbook
 {
- extern unsigned qbk_major_version;
- extern unsigned qbk_minor_version;
+ extern int qbk_major_version;
+ extern int qbk_minor_version;
     extern unsigned qbk_version_n; // qbk_major_version * 100 + qbk_minor_version
 
     struct quickbook_range {

Modified: trunk/tools/quickbook/test/Jamfile.v2
==============================================================================
--- trunk/tools/quickbook/test/Jamfile.v2 (original)
+++ trunk/tools/quickbook/test/Jamfile.v2 2010-07-10 11:03:45 EDT (Sat, 10 Jul 2010)
@@ -65,6 +65,9 @@
     [ quickbook-fail-test fail-template-section-1 ]
     [ quickbook-fail-test fail-template-section-2 ]
     [ quickbook-fail-test fail-template-section-3 ]
+ [ quickbook-fail-test fail-unknown-quickbook-1 ]
+ [ quickbook-fail-test fail-unknown-quickbook-2 ]
+ [ quickbook-fail-test fail-unknown-quickbook-3 ]
     [ quickbook-test utf-8 ]
     [ quickbook-test utf-8-bom ]
     [ quickbook-test unicode-escape ]

Added: trunk/tools/quickbook/test/fail-unknown-quickbook-1.quickbook
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/test/fail-unknown-quickbook-1.quickbook 2010-07-10 11:03:45 EDT (Sat, 10 Jul 2010)
@@ -0,0 +1,5 @@
+[article Future version of quickbook
+ [quickbook 1.7]
+]
+
+This should fail...
\ No newline at end of file

Added: trunk/tools/quickbook/test/fail-unknown-quickbook-2.quickbook
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/test/fail-unknown-quickbook-2.quickbook 2010-07-10 11:03:45 EDT (Sat, 10 Jul 2010)
@@ -0,0 +1,5 @@
+[article Far future version of quickbook
+ [quickbook 2.0]
+]
+
+This should fail...
\ No newline at end of file

Added: trunk/tools/quickbook/test/fail-unknown-quickbook-3.quickbook
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/test/fail-unknown-quickbook-3.quickbook 2010-07-10 11:03:45 EDT (Sat, 10 Jul 2010)
@@ -0,0 +1,5 @@
+[article Non-existant version of quickbook
+ [quickbook 0.1]
+]
+
+This should fail...
\ No newline at end of file


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk