lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [6079] Add a deliberately obscure option


From: Greg Chicares
Subject: [lmi-commits] [6079] Add a deliberately obscure option
Date: Mon, 15 Dec 2014 14:54:14 +0000

Revision: 6079
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6079
Author:   chicares
Date:     2014-12-15 14:54:14 +0000 (Mon, 15 Dec 2014)
Log Message:
-----------
Add a deliberately obscure option

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/authenticity.cpp
    lmi/trunk/global_settings.cpp
    lmi/trunk/global_settings.hpp
    lmi/trunk/skeleton.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2014-12-15 14:16:38 UTC (rev 6078)
+++ lmi/trunk/ChangeLog 2014-12-15 14:54:14 UTC (rev 6079)
@@ -34928,3 +34928,12 @@
 Skip distribution tests more elegantly. See:
   http://lists.nongnu.org/archive/html/lmi/2014-12/msg00076.html
 
+20141215T1454Z <address@hidden> [516]
+
+  authenticity.cpp
+  global_settings.cpp
+  global_settings.hpp
+  skeleton.cpp
+Add a deliberately obscure option. See:
+  http://lists.nongnu.org/archive/html/lmi/2014-12/msg00077.html
+

Modified: lmi/trunk/authenticity.cpp
===================================================================
--- lmi/trunk/authenticity.cpp  2014-12-15 14:16:38 UTC (rev 6078)
+++ lmi/trunk/authenticity.cpp  2014-12-15 14:54:14 UTC (rev 6079)
@@ -275,8 +275,12 @@
         return;
         }
 
+    calendar_date const
+        prospicience_date = global_settings::instance().prospicience_date();
     std::string const diagnostic_message = Authenticity::Assay
-        (calendar_date()
+        (prospicience_date == last_yyyy_date()
+            ? today()
+            : prospicience_date
         ,global_settings::instance().data_directory()
         );
     if

Modified: lmi/trunk/global_settings.cpp
===================================================================
--- lmi/trunk/global_settings.cpp       2014-12-15 14:16:38 UTC (rev 6078)
+++ lmi/trunk/global_settings.cpp       2014-12-15 14:54:14 UTC (rev 6079)
@@ -55,6 +55,7 @@
     ,custom_io_0_               (false)
     ,regression_testing_        (false)
     ,data_directory_            (fs::system_complete("."))
+    ,prospicience_date_         (last_yyyy_date())
 {}
 
 global_settings::~global_settings()
@@ -111,6 +112,11 @@
     data_directory_ = fs::system_complete(s);
 }
 
+void global_settings::set_prospicience_date(calendar_date const& d)
+{
+    prospicience_date_ = d;
+}
+
 bool global_settings::mellon() const
 {
     return mellon_;
@@ -141,3 +147,7 @@
     return data_directory_;
 }
 
+calendar_date const& global_settings::prospicience_date() const
+{
+    return prospicience_date_;
+}

Modified: lmi/trunk/global_settings.hpp
===================================================================
--- lmi/trunk/global_settings.hpp       2014-12-15 14:16:38 UTC (rev 6078)
+++ lmi/trunk/global_settings.hpp       2014-12-15 14:54:14 UTC (rev 6079)
@@ -26,6 +26,7 @@
 
 #include "config.hpp"
 
+#include "calendar_date.hpp"
 #include "obstruct_slicing.hpp"
 #include "so_attributes.hpp"
 #include "uncopyable_lmi.hpp"
@@ -80,13 +81,15 @@
     void set_custom_io_0              (bool);
     void set_regression_testing       (bool);
     void set_data_directory           (std::string const&);
+    void set_prospicience_date        (calendar_date const&);
 
-    bool               mellon                   () const;
-    bool               ash_nazg                 () const;
-    std::string const& pyx                      () const;
-    bool               custom_io_0              () const;
-    bool               regression_testing       () const;
-    fs::path const&    data_directory           () const;
+    bool                 mellon                   () const;
+    bool                 ash_nazg                 () const;
+    std::string const&   pyx                      () const;
+    bool                 custom_io_0              () const;
+    bool                 regression_testing       () const;
+    fs::path const&      data_directory           () const;
+    calendar_date const& prospicience_date        () const;
 
   private:
     global_settings();
@@ -97,6 +100,7 @@
     bool custom_io_0_;
     bool regression_testing_;
     fs::path data_directory_;
+    calendar_date prospicience_date_;
 
 #ifdef __BORLANDC__
 // COMPILER !! Borland compilers defectively [11/5] require a public dtor; see:

Modified: lmi/trunk/skeleton.cpp
===================================================================
--- lmi/trunk/skeleton.cpp      2014-12-15 14:16:38 UTC (rev 6078)
+++ lmi/trunk/skeleton.cpp      2014-12-15 14:54:14 UTC (rev 6079)
@@ -42,6 +42,7 @@
 #include "alert.hpp"
 #include "assert_lmi.hpp"
 #include "authenticity.hpp"
+#include "calendar_date.hpp"
 #include "census_document.hpp"
 #include "census_view.hpp"
 #include "configurable_settings.hpp"
@@ -90,10 +91,12 @@
 #include <wx/artprov.h>
 #include <wx/config.h>
 #include <wx/cshelp.h>
+#include <wx/datetime.h>
 #include <wx/debug.h>                   // wxIsDebuggerRunning()
 #include <wx/docmdi.h>
 #include <wx/image.h>
 #include <wx/log.h>                     // wxSafeShowMessage()
+#include <wx/math.h>                    // wxRound()
 #include <wx/menu.h>
 #include <wx/msgdlg.h>
 #include <wx/textctrl.h>
@@ -1198,15 +1201,16 @@
     // TRICKY !! Some long options are aliased to unlikely octal values.
     static Option long_options[] =
       {
-        {"ash_nazg"  ,NO_ARG   ,0 ,001 ,0 ,"ash nazg durbatul\xFBk"},
-        {"ash_naz"   ,NO_ARG   ,0 ,003 ,0 ,"fraud"},
-        {"help"      ,NO_ARG   ,0 ,'h' ,0 ,"display this help and exit"},
-        {"mellon"    ,NO_ARG   ,0 ,002 ,0 ,"pedo mellon a minno"},
-        {"mello"     ,NO_ARG   ,0 ,003 ,0 ,"fraud"},
-        {"pyx"       ,REQD_ARG ,0 ,'x' ,0 ,"for docimasy"},
-        {"data_path" ,REQD_ARG ,0 ,'d' ,0 ,"path to data files"},
-        {"print_db"  ,NO_ARG   ,0 ,'p' ,0 ,"print product databases"},
-        {0           ,NO_ARG   ,0 ,0   ,0 ,""}
+        {"ash_nazg"     ,NO_ARG   ,0 ,001 ,0 ,"ash nazg durbatul\xFBk"},
+        {"ash_naz"      ,NO_ARG   ,0 ,003 ,0 ,"fraud"},
+        {"help"         ,NO_ARG   ,0 ,'h' ,0 ,"display this help and exit"},
+        {"mellon"       ,NO_ARG   ,0 ,002 ,0 ,"pedo mellon a minno"},
+        {"mello"        ,NO_ARG   ,0 ,003 ,0 ,"fraud"},
+        {"pyx"          ,REQD_ARG ,0 ,'x' ,0 ,"for docimasy"},
+        {"data_path"    ,REQD_ARG ,0 ,'d' ,0 ,"path to data files"},
+        {"print_db"     ,NO_ARG   ,0 ,'p' ,0 ,"print product databases"},
+        {"prospicience" ,REQD_ARG ,0 ,004 ,0 ,"validation date"},
+        {0              ,NO_ARG   ,0 ,0   ,0 ,""}
       };
 
     bool show_help        = false;
@@ -1238,6 +1242,32 @@
                 }
                 break;
 
+            case 004:
+                {
+                wxString const date_string(getopt_long.optarg);
+                wxDateTime dt;
+                wxString::const_iterator date_end;
+                if(  !dt.ParseFormat(date_string, "%Y%m%d", &date_end)
+                  || date_end != date_string.end()
+                  )
+                    {
+                    warning() << "Invalid prospicience option value '"
+                              << date_string
+                              << "' (must be in YYYYMMDD format)."
+                              << std::flush
+                              ;
+                    }
+                else
+                    {
+                    // wxDateTime JDN corresponds to the noon, not the
+                    // midnight, and so requires half a day adjustment.
+                    global_settings::instance().set_prospicience_date
+                        (calendar_date(jdn_t(wxRound(dt.GetJDN() + 0.5)))
+                        );
+                    }
+                }
+                break;
+
             case 'd':
                 {
                 global_settings::instance().set_data_directory




reply via email to

[Prev in Thread] Current Thread [Next in Thread]