lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [5942] Use both custom IO facilities in parallel


From: Greg Chicares
Subject: [lmi-commits] [5942] Use both custom IO facilities in parallel
Date: Tue, 16 Sep 2014 17:07:37 +0000

Revision: 5942
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5942
Author:   chicares
Date:     2014-09-16 17:07:35 +0000 (Tue, 16 Sep 2014)
Log Message:
-----------
Use both custom IO facilities in parallel

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/emit_ledger.cpp
    lmi/trunk/illustration_view.cpp
    lmi/trunk/illustration_view.hpp
    lmi/trunk/illustrator.cpp
    lmi/trunk/mc_enum_type_enums.hpp
    lmi/trunk/mc_enum_types.cpp
    lmi/trunk/skeleton.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2014-09-16 14:18:44 UTC (rev 5941)
+++ lmi/trunk/ChangeLog 2014-09-16 17:07:35 UTC (rev 5942)
@@ -34101,3 +34101,14 @@
   objects.make
 Clone 'custom_io_0.?pp' (for further customization soon).
 
+20140916T1707Z <address@hidden> [533]
+
+  emit_ledger.cpp
+  illustration_view.cpp
+  illustration_view.hpp
+  illustrator.cpp
+  mc_enum_type_enums.hpp
+  mc_enum_types.cpp
+  skeleton.cpp
+Use both custom IO facilities in parallel.
+

Modified: lmi/trunk/emit_ledger.cpp
===================================================================
--- lmi/trunk/emit_ledger.cpp   2014-09-16 14:18:44 UTC (rev 5941)
+++ lmi/trunk/emit_ledger.cpp   2014-09-16 17:07:35 UTC (rev 5942)
@@ -30,6 +30,7 @@
 
 #include "configurable_settings.hpp"
 #include "custom_io_0.hpp"
+#include "custom_io_1.hpp"
 #include "file_command.hpp"
 #include "ledger.hpp"
 #include "ledger_text_formats.hpp"
@@ -161,6 +162,10 @@
         {
         custom_io_0_write(ledger, filepath.string());
         }
+    if(emission & mce_emit_custom_1)
+        {
+        custom_io_1_write(ledger, filepath.string());
+        }
 
   done:
     return timer.stop().elapsed_seconds();

Modified: lmi/trunk/illustration_view.cpp
===================================================================
--- lmi/trunk/illustration_view.cpp     2014-09-16 14:18:44 UTC (rev 5941)
+++ lmi/trunk/illustration_view.cpp     2014-09-16 17:07:35 UTC (rev 5942)
@@ -42,6 +42,7 @@
 #include "assert_lmi.hpp"
 #include "configurable_settings.hpp"
 #include "custom_io_0.hpp"
+#include "custom_io_1.hpp"
 #include "default_view.hpp"
 #include "edit_mvc_docview_parameters.hpp"
 #include "emit_ledger.hpp"
@@ -338,7 +339,7 @@
     return illdoc.PredominantView();
 }
 
-/// Run an illustration from "custom" input.
+/// Run an illustration from custom "0" input.
 ///
 /// The return value indicates whether to prevent displaying the GUI.
 ///
@@ -387,3 +388,33 @@
     return false;
 }
 
+/// Run an illustration from custom "1" input.
+///
+/// The return value indicates whether to prevent displaying the GUI,
+/// for parallelism with custom_io_0_run_if_file_exists(); but this
+/// function always returns 'true'.
+///
+/// Because this function prevents the GUI from being displayed, it
+/// must trap and handle its own exceptions rather than letting them
+/// escape to wx.
+
+bool custom_io_1_run_if_file_exists()
+{
+    try
+        {
+        if(custom_io_1_file_exists())
+            {
+            configurable_settings const& c = configurable_settings::instance();
+            illustrator z(mce_emit_custom_1);
+            z(c.custom_input_1_filename());
+            return true;
+            }
+        }
+    catch(...)
+        {
+        report_exception();
+        }
+
+    return true;
+}
+

Modified: lmi/trunk/illustration_view.hpp
===================================================================
--- lmi/trunk/illustration_view.hpp     2014-09-16 14:18:44 UTC (rev 5941)
+++ lmi/trunk/illustration_view.hpp     2014-09-16 17:07:35 UTC (rev 5942)
@@ -110,6 +110,7 @@
     );
 
 bool custom_io_0_run_if_file_exists(wxDocManager*);
+bool custom_io_1_run_if_file_exists();
 
 #endif // illustration_view_hpp
 

Modified: lmi/trunk/illustrator.cpp
===================================================================
--- lmi/trunk/illustrator.cpp   2014-09-16 14:18:44 UTC (rev 5941)
+++ lmi/trunk/illustrator.cpp   2014-09-16 17:07:35 UTC (rev 5942)
@@ -32,6 +32,7 @@
 #include "assert_lmi.hpp"
 #include "configurable_settings.hpp"
 #include "custom_io_0.hpp"
+#include "custom_io_1.hpp"
 #include "emit_ledger.hpp"
 #include "group_values.hpp"
 #include "handle_exceptions.hpp"
@@ -105,6 +106,33 @@
         conditionally_show_timings_on_stdout();
         return close_when_done;
         }
+    else if(".inix" == extension)
+        {
+        configurable_settings const& c = configurable_settings::instance();
+        Timer timer;
+        Input input;
+        bool emit_pdf_too = custom_io_1_read(input, file_path.string());
+        seconds_for_input_ = timer.stop().elapsed_seconds();
+        timer.restart();
+        IllusVal z(file_path.string());
+        z.run(input);
+        principal_ledger_ = z.ledger();
+        seconds_for_calculations_ = timer.stop().elapsed_seconds();
+        fs::path out_file =
+            file_path.string() == c.custom_input_1_filename()
+            ? c.custom_output_1_filename()
+            : fs::change_extension(file_path, ".test1")
+            ;
+        mcenum_emission x = emit_pdf_too ? mce_emit_pdf_file : 
mce_emit_nothing;
+        seconds_for_output_ = emit_ledger
+            (out_file
+            ,out_file
+            ,*z.ledger()
+            ,static_cast<mcenum_emission>(x | emission_)
+            );
+        conditionally_show_timings_on_stdout();
+        return true;
+        }
     else
         {
         fatal_error()

Modified: lmi/trunk/mc_enum_type_enums.hpp
===================================================================
--- lmi/trunk/mc_enum_type_enums.hpp    2014-09-16 14:18:44 UTC (rev 5941)
+++ lmi/trunk/mc_enum_type_enums.hpp    2014-09-16 17:07:35 UTC (rev 5942)
@@ -53,6 +53,7 @@
     ,mce_emit_group_roster   =  256
     ,mce_emit_text_stream    =  512
     ,mce_emit_custom_0       = 1024
+    ,mce_emit_custom_1       = 2048
     };
 
 /// Rounding styles.

Modified: lmi/trunk/mc_enum_types.cpp
===================================================================
--- lmi/trunk/mc_enum_types.cpp 2014-09-16 14:18:44 UTC (rev 5941)
+++ lmi/trunk/mc_enum_types.cpp 2014-09-16 17:07:35 UTC (rev 5942)
@@ -70,6 +70,7 @@
     ,mce_emit_group_roster
     ,mce_emit_text_stream
     ,mce_emit_custom_0
+    ,mce_emit_custom_1
     };
 extern char const*const emission_strings[] =
     {"emit_nothing"
@@ -84,9 +85,10 @@
     ,"emit_group_roster"
     ,"emit_text_stream"
     ,"emit_custom_0"
+    ,"emit_custom_1"
     };
 template<> struct mc_enum_key<mcenum_emission>
-  :public mc_enum_data<mcenum_emission, 12, emission_enums, emission_strings> 
{};
+  :public mc_enum_data<mcenum_emission, 13, emission_enums, emission_strings> 
{};
 template class mc_enum<mcenum_emission>;
 
 extern rounding_style const rounding_style_enums[] =

Modified: lmi/trunk/skeleton.cpp
===================================================================
--- lmi/trunk/skeleton.cpp      2014-09-16 14:18:44 UTC (rev 5941)
+++ lmi/trunk/skeleton.cpp      2014-09-16 17:07:35 UTC (rev 5942)
@@ -718,7 +718,10 @@
         frame_->Centre(wxBOTH);
         frame_->Maximize(true);
 
-        if(custom_io_0_run_if_file_exists(doc_manager_))
+        if
+            (  custom_io_0_run_if_file_exists(doc_manager_)
+            || custom_io_1_run_if_file_exists()
+            )
             {
             return false;
             }




reply via email to

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