+ GLISP integration

+ GLISP integration

--- src/main.cpp
+++ src/main.cpp
@@ -13,6 +13,7 @@
 // #include <modules/juce_opengl/juce_opengl.h>
 // #include <modules/juce_video/juce_video.h>
 #include <base/base.hpp>
+#include <memory>

 using namespace juce;
 using namespace granite;
@@ -93,22 +94,13 @@

 class layout : public Component {
 	StretchableLayoutManager l;
-	StretchableLayoutResizerBar rb;
-	std::vector<Component *> components;
-
-public:
-	layout(Component *c1, Component *c2) : rb(&l, 1, false) {
+	std::vector<std::unique_ptr<Component>> components;
+	std::vector<Component*> lc;
+	bool horizontal;
+
+public:
+	layout(bool _horizontal) : horizontal(_horizontal){
 		setOpaque(true);
-		addAndMakeVisible(rb);
-		addAndMakeVisible(c1);
-		addAndMakeVisible(c2);
-		components.push_back(c1);
-		components.push_back(&rb);
-		components.push_back(c2);
-		components.push_back(nullptr);
-		l.setItemLayout(0, -0.1, -0.9, -0.5);
-		l.setItemLayout(1, 5, 5, 5);
-		l.setItemLayout(2, -0.1, -0.9, -0.5);
 	}

 	void paint(Graphics &g) override {
@@ -116,28 +108,201 @@
 		g.fillAll();
 	}

-	void resized() {
-        Rectangle<int> r(getLocalBounds().reduced(4));
-		l.layOutComponents(components.data(), 3, r.getX(), r.getY(), r.getWidth(), r.getHeight(), true, true);
+	void resized() override {
+		juce::Rectangle<int> r(getLocalBounds());
+		l.layOutComponents(lc.data(), lc.size(), r.getX(), r.getY(), r.getWidth(), r.getHeight(), !horizontal, true);
+	}
+
+	void addSplitter() {
+		if (lc.size() > 0) {
+			l.setItemLayout(lc.size(), 5, 5, 5);
+			components.push_back(std::make_unique<StretchableLayoutResizerBar>(&l, lc.size(), horizontal));
+			lc.push_back(components.back().get());
+			addAndMakeVisible(components.back().get());
+		}
+	}
+
+	void addComponent(Component *c, double minimum, double maximum, double preferred) {
+		l.setItemLayout(lc.size(), minimum, maximum, preferred);
+		lc.push_back(c);
+		addAndMakeVisible(c);
+	}
+};
+
+class interpreter : public Component,
+					public TextEditor::Listener {
+	base::lisp ≷
+	TextEditor te;
+
+public:
+	interpreter(base::lisp &glisp) : gl(glisp) {
+		te.setMultiLine(true);
+		te.setReturnKeyStartsNewLine(false);
+		te.setTabKeyUsedAsCharacter(false);
+		te.setReadOnly(false);
+		te.setCaretVisible(true);
+		te.addListener(this);
+		addAndMakeVisible(te);
+	}
+	~interpreter() {}
+
+	void resized() override {
+		te.setBounds(getLocalBounds());
+	}
+
+    void textEditorTextChanged(TextEditor&) override {}
+    void textEditorEscapeKeyPressed(TextEditor&) override {}
+    void textEditorFocusLost(TextEditor&) override {}
+
+    void textEditorReturnKeyPressed(TextEditor&) override {
+		// get line
+		te.moveCaretToStartOfLine(false);
+		int begin = te.getCaretPosition();
+		te.moveCaretToEndOfLine(false);
+		String t = te.getTextInRange(Range<int>(begin, te.getCaretPosition()));
+
+		// execute code and print result
+		std::string r = gl.eval(t.toStdString());
+		te.insertTextAtCaret("\n > ");
+		te.insertTextAtCaret(r);
+		te.insertTextAtCaret("\n");
+    }
+};
+
+class user_interface : public Component {
+	std::map<std::string, std::unique_ptr<Component>> components;
+	Component *mainComponent;
+	base::lisp ≷
+
+public:
+	user_interface(base::lisp &glisp) : mainComponent(nullptr), gl(glisp) {}
+	~user_interface() {}
+
+	void resized() override {
+		if (mainComponent)
+			mainComponent->setBounds(getLocalBounds());
+	}
+
+	// (set-main-component name)
+	base::cell_t set_main_component(base::cell_t c, base::cells_t &ret) {
+		const auto &name = c + 1;
+		auto cc = components.find(name->s);
+		if (cc != components.end()) {
+			mainComponent = cc->second.get();
+			addAndMakeVisible(mainComponent);
+			mainComponent->setBounds(getLocalBounds());
+		}
+		return c;
+	}
+
+	// (refresh-interface)
+	base::cell_t refresh_interface(base::cell_t c, base::cells_t &ret) {
+		if (mainComponent)
+			mainComponent->resized();
+		return c;
+	}
+
+	// (create-playlist name)
+	base::cell_t create_playlist(base::cell_t c, base::cells_t &ret) {
+		// TODO: error reporting
+		const auto &name = c + 1;
+		if (components.find(name->s) == components.end()) {
+			components.insert(std::make_pair(name->s, std::make_unique<playlist>()));
+		}
+		return c;
+	}
+
+	// (create-layout name (bool)horizontal (bool)splitter)
+	base::cell_t create_layout(base::cell_t c, base::cells_t &ret) {
+		const auto &name = c + 1;
+		const auto &horizontal = c + 2;
+		if (components.find(name->s) == components.end()) {
+			components.insert(std::make_pair(name->s, std::make_unique<layout>(horizontal->s != "nil")));
+		}
+		return c;
+		// TODO: returning quoted ID
+	}
+
+	// (create-interpreter name)
+	base::cell_t create_interpreter(base::cell_t c, base::cells_t &ret) {
+		const auto &name = c + 1;
+		if (components.find(name->s) == components.end()) {
+			components.insert(std::make_pair(name->s, std::make_unique<interpreter>(gl)));
+		}
+		return c;
+	}
+
+	// (layout-add-component layout-id component-id (float)min (float)max (float)preffered)
+	base::cell_t layout_add_component(base::cell_t c, base::cells_t &ret) {
+		// TODO: expected format: list of 5, id, id, float, float, float
+		const auto &lname = c + 1;
+		const auto &cname = c + 2;
+		auto l = components.find(lname->s);
+		auto com = components.find(cname->s);
+		if (l != components.end() && com != components.end()) {
+			const auto &minimum = c + 3;
+			const auto &maximum = c + 4;
+			const auto &preferred = c + 5;
+			layout *lay = reinterpret_cast<layout*>(l->second.get());
+			lay->addComponent(com->second.get(), (double)minimum->f, (double)maximum->f, (double)preferred->f);
+		}
+		return c;
+	}
+
+	// (layout-add-splitter layout-id)
+	base::cell_t layout_add_splitter(base::cell_t c, base::cells_t &ret) {
+		const auto &lname = c + 1;
+		auto l = components.find(lname->s);
+		if (l != components.end()) {
+			layout *lay = reinterpret_cast<layout*>(l->second.get());
+			lay->addSplitter();
+		}
+		return c;
 	}
 };

 class KiwanoApplication : public JUCEApplication {
     class MainWindow : public DocumentWindow {
-		layout l;
+		user_interface itf;
+		base::lisp gl;
         JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MainWindow)

-    public:
-        MainWindow(String name) : DocumentWindow(name, Colours::lightgrey, DocumentWindow::allButtons),
-			l(new tabs(), new tabs()) {
-			setContentOwned(&l, false);
+		public:
+		MainWindow(String name) : DocumentWindow(name, Colours::lightgrey, DocumentWindow::allButtons),
+			itf(gl) {
+			setContentOwned(&itf, false);
 			setSize(800, 600);
+			setTopLeftPosition(200, 200);
             setVisible(true);
 			setUsingNativeTitleBar(true);
 			setResizable(true, true);
+
+			// initialize GLISP
+			using namespace std::placeholders;
+			gl.init();
+			gl.addProcedure("create-playlist", std::bind(&user_interface::create_playlist, &itf, _1, _2));
+			gl.addProcedure("create-layout", std::bind(&user_interface::create_layout, &itf, _1, _2));
+			gl.addProcedure("layout-add-component", std::bind(&user_interface::layout_add_component, &itf, _1, _2));
+			gl.addProcedure("layout-add-splitter", std::bind(&user_interface::layout_add_splitter, &itf, _1, _2));
+			gl.addProcedure("set-main-component", std::bind(&user_interface::set_main_component, &itf, _1, _2));
+			gl.addProcedure("create-interpreter", std::bind(&user_interface::create_interpreter, &itf, _1, _2));
+			gl.addProcedure("refresh-interface", std::bind(&user_interface::refresh_interface, &itf, _1, _2));
+			gl.eval("(create-playlist 'p1)");
+			gl.eval("(create-playlist 'p2)");
+			gl.eval("(create-layout 'l1 t)");
+			gl.eval("(layout-add-component 'l1 'p1 -0.1 -0.9 -0.5)");
+			gl.eval("(layout-add-splitter 'l1)");
+			gl.eval("(layout-add-component 'l1 'p2 -0.1 -0.9 -0.5)");
+			gl.eval("(create-layout 'l2 nil)");
+			gl.eval("(create-interpreter 'int1)");
+			gl.eval("(layout-add-component 'l2 'int1 50.0 100.0 50.0)");
+			gl.eval("(layout-add-splitter 'l2)");
+			gl.eval("(layout-add-component 'l2 'l1 -0.1 -1.0 -0.9)");
+			gl.eval("(set-main-component 'l2)");
         }

         void closeButtonPressed() override {
+			gl.close();
             JUCEApplication::getInstance()->systemRequestedQuit();
         }
     };


Remove vestiges of sprintf method of data file output.

--- src/main.cpp
+++ src/main.cpp
@@ -90,7 +90,6 @@
 //   (to save memory, use global data point variables)
 DateTime now;
 char formatted_timestamp[] = "0000-00-00T00:00:00";
-char* data_file_entry_buffer = (char*) malloc(sizeof(char) * 50);
 char temperature_string[4][8];
 double latest_resistance[4];
 double latest_temperature[4];
@@ -253,7 +252,6 @@
         data_file.print(temperature_string[1]); data_file.print(",");
         data_file.print(temperature_string[2]); data_file.print(",");
         data_file.println(temperature_string[3]);
-        // data_file.println(data_file_entry_buffer);
         data_file.flush();
     }
 }


Help message added

Help message added

--- src/main.cpp
+++ src/main.cpp
@@ -79,7 +79,19 @@
 void ParseOptions(int argc, char* argv[])
 {
     int i=1;
+
     for(; i<argc; i++)
+    {
+        if( strcmp("--help", argv[i]) == 0 ) {
+		printf("IoT scheduler by Ilya Albrekht\n");
+		printf("  --debug           Enable debug level output\n");
+		printf("  --run <C> <N>     Turn on channel C for N minutes\n");
+		printf("  --daemon -D       Run as daemon\n");
+		exit(0);
+	}
+    }
+
+    for(i=1; i<argc; i++)
     {
         if(strcmp("--debug", argv[i]) == 0)
         {


Change testnet magic. Update magic description.

--- src/main.cpp
+++ src/main.cpp
@@ -2901,10 +2901,10 @@
 {
     if (fTestNet)
     {
-        pchMessageStart[0] = 0xfc;
-        pchMessageStart[1] = 0xc1;
-        pchMessageStart[2] = 0xb7;
-        pchMessageStart[3] = 0xdc;
+        pchMessageStart[0] = 0xfc; // 'N' + 0xb0
+        pchMessageStart[1] = 0xfe; // 'L' + 0xb0
+        pchMessageStart[2] = 0xf7; // 'G' + 0xb0
+        pchMessageStart[3] = 0x00; // 0x00
         hashGenesisBlock = uint256("0xf1fe2c7e57300c65ed0e4905ca5f74192a3e1feea209c4fcc2c60df024121a05");
     }

@@ -3244,7 +3244,7 @@
 // The message start string is designed to be unlikely to occur in normal data.
 // The characters are rarely used upper ASCII, not valid as UTF-8, and produce
 // a large 4-byte int at any alignment.
-unsigned char pchMessageStart[4] = { 0xfc, 0xfe, 0xf7, 0xe0 }; // Guldencoin: NLG to hex +0xb0 for each char and last char 0xe0
+unsigned char pchMessageStart[4] = { 0xfc, 0xfe, 0xf7, 0xe0 }; // 'N'+0xb0, 'L'+0xb0, 'G'+0xb0, 0xe0 (e for "echt", testnet has 0x00 as last byte)

 void static ProcessGetData(CNode* pfrom)


Useful free functions

Useful free functions

--- include/VisionCore/WrapGL/WrapGLCommon.hpp
+++ include/VisionCore/WrapGL/WrapGLCommon.hpp
@@ -371,6 +371,18 @@
 private:
     const GLenum flag;
 };
+
+static inline void finish()
+{
+    glFinish();
+    WRAPGL_CHECK_ERROR();
+}
+
+static inline void drawArrays(GLenum mode, GLsizei count, GLint first = 0)
+{
+    glDrawArrays(mode, first, count);
+    WRAPGL_CHECK_ERROR();
+}

 }


Removed unneeded include.

Removed unneeded include.

--- src/main.cpp
+++ src/main.cpp
@@ -10,7 +10,6 @@
 #ifdef _MSC_VER
 	#include <dbghelp.h>
 #endif  // _MSC_VER
-#include "OSSupport/StackTrace.h"

 bool cRoot::m_TerminateEventRaised = false;  // If something has told the server to stop; checked periodically in cRoot


added additional verbose info to abstract_tuner eval

--- include/autotune/tuners/abstract_tuner.hpp
+++ include/autotune/tuners/abstract_tuner.hpp
@@ -52,7 +52,17 @@
          do_measurement(false), do_write_header(true) {}

   double evaluate(bool &did_eval, Args &... args) {
-
+    if (verbose) {
+      parameter_value_set parameter_values = f.get_parameter_values();
+      for (size_t parameter_index = 0; parameter_index < parameters.size();
+               parameter_index++) {
+        auto &p = parameters[parameter_index];
+        parameter_values[p->get_name()] = p->get_value();
+      }
+      std::cout << "------ try eval ------" << std::endl;
+      //parameters.print_values();
+      print_parameter_values(parameter_values);
+    }
     if (!result_cache.contains(parameters)) {
       result_cache.insert(parameters);
     } else {


Clean up debug

Clean up debug

--- src/main.cpp
+++ src/main.cpp
@@ -3295,14 +3295,14 @@
                 if (nHeight < ancConsensus.nDifficultySwitchHeight6) {
                     #ifdef __APPLE__
                     if (!((nHeight > ancConsensus.nDifficultySwitchHeight4 && nHeight < ancConsensus.nDifficultySwitchHeight5) || difference < maxDiff)) {
-                        return state.Invalid(error("%s : incorrect Scrypt proof of work block %d", __func__,nHeight), REJECT_INVALID, "bad-diffbits");
+                        LogPrintf("%s : incorrect Scrypt proof of work block %d", __func__,nHeight);
                     }
                     #else
-                    return state.Invalid(error("%s : incorrect Scrypt proof of work block %d", __func__,nHeight), REJECT_INVALID, "bad-diffbits");
+                    LogPrintf("%s : incorrect Scrypt proof of work block %d", __func__,nHeight);
                     #endif
                 }
                 else {
-                    return state.Invalid(error("%s : incorrect Gost proof of work block %d", __func__,nHeight), REJECT_INVALID, "bad-diffbits");
+                    LogPrintf("%s : incorrect Gost proof of work block %d", __func__,nHeight);
                 }
             }


Updated libnop optional

Updated libnop optional

--- include/depthai-shared/common/optional.hpp
+++ include/depthai-shared/common/optional.hpp
@@ -54,15 +54,15 @@
     using Type = tl::optional<T>;

     static constexpr EncodingByte Prefix(const Type& value) {
-        return value ? Encoding<T>::Prefix(*value) : EncodingByte::Nil;
+        return value ? Encoding<T>::Prefix(*value) : EncodingByte::Empty;
     }

     static constexpr std::size_t Size(const Type& value) {
-        return value ? Encoding<T>::Size(*value) : BaseEncodingSize(EncodingByte::Nil);
+        return value ? Encoding<T>::Size(*value) : BaseEncodingSize(EncodingByte::Empty);
     }

     static constexpr bool Match(EncodingByte prefix) {
-        return prefix == EncodingByte::Nil || Encoding<T>::Match(prefix);
+        return prefix == EncodingByte::Empty || Encoding<T>::Match(prefix);
     }

     template <typename Writer>
@@ -76,7 +76,7 @@

     template <typename Reader>
     static constexpr Status<void> ReadPayload(EncodingByte prefix, Type* value, Reader* reader) {
-        if(prefix == EncodingByte::Nil) {
+        if(prefix == EncodingByte::Empty) {
             value->reset();
         } else {
             T temp;


输出网络层错误码输出，用以定位Windows CI内socket异常断开的问题

输出网络层错误码输出，用以定位Windows CI内socket异常断开的问题

--- test/case/atbus_node_reg_test.cpp
+++ test/case/atbus_node_reg_test.cpp
@@ -59,6 +59,10 @@
 }

 static int node_reg_test_on_error(const atbus::node &n, const atbus::endpoint *ep, const atbus::connection *conn, int status, int errcode) {
+    if (0 == errcode || UV_EOF == errcode) {
+        return 0;
+    }
+
     std::streamsize w = std::cout.width();
     CASE_MSG_INFO() << "[Log Error] node=0x" << std::setfill('0') << std::hex << std::setw(8) << n.get_id() << ", ep=0x" << std::setw(8)
                     << (NULL == ep ? 0 : ep->get_id()) << ", c=" << conn << std::setfill(' ') << std::setw(w) << std::dec


Added proper include

Added proper include

--- DihedralIsometry.cpp
+++ DihedralIsometry.cpp
@@ -7,6 +7,7 @@
 //

 #include "DihedralIsometry.h"
+#include <stdlib.h>

 int rotationMod(int rotationIndex, int mod) {
     int mult = abs(rotationIndex) / mod + 1;


Add documentation for `-verbose-errors`

Add documentation for `-verbose-errors`

--- src/main.cpp
+++ src/main.cpp
@@ -1809,6 +1809,10 @@
 		print_usage_line(1, "-warnings-as-errors");
 		print_usage_line(2, "Treats warning messages as error messages");
 		print_usage_line(0, "");
+
+		print_usage_line(1, "-verbose-errors");
+		print_usage_line(2, "Prints verbose error messages showing the code on that line and the location in that line");
+		print_usage_line(0, "");
 	}

 	if (run_or_build) {


Update to new way of passing application environment. (#3209)

--- content_handler/application_controller_impl.cc
+++ content_handler/application_controller_impl.cc
@@ -35,7 +35,7 @@
   }

   // TODO(abarth): The Dart code should end up with outgoing_services.
-  if (startup_info->outgoing_services.is_pending()) {
+  if (startup_info->outgoing_services) {
     service_provider_bindings_.AddBinding(
         this, std::move(startup_info->outgoing_services));
   }
@@ -43,10 +43,12 @@
   url_ = startup_info->url;
   runtime_holder_.reset(new RuntimeHolder());

-  // TODO(abarth): The Dart code should end up with environment_services.
-  runtime_holder_->Init(modular::ServiceProviderPtr::Create(
-                            std::move(startup_info->environment_services)),
-                        std::move(bundle));
+  // TODO(abarth): The Dart code should end up with environment.
+  modular::ServiceProviderPtr environment_services;
+  modular::ApplicationEnvironmentPtr::Create(
+      std::move(startup_info->environment))
+      ->GetServices(GetProxy(&environment_services));
+  runtime_holder_->Init(std::move(environment_services), std::move(bundle));
 }

 ApplicationControllerImpl::~ApplicationControllerImpl() = default;


Removed redundant close() call

Removed redundant close() call

--- Source/Kernel/iSCSIHBAUserClient.cpp
+++ Source/Kernel/iSCSIHBAUserClient.cpp
@@ -319,10 +319,7 @@
 {
     // Tell HBA to release any resources that aren't active (e.g.,
     // connections we started to establish but didn't activate)
-
-    // Close the provider (decrease retain count)
-    close();
-
+
 	return super::clientDied();
 }


remove duplicated include directives.

remove duplicated include directives.

--- src/main.cpp
+++ src/main.cpp
@@ -1,5 +1,3 @@
-
-#include <cstdio>

 #include "main.h"


Linker: Fix incorrect exit status.

Linker: Fix incorrect exit status.

--- tools/link/linker.cpp
+++ tools/link/linker.cpp
@@ -140,11 +140,11 @@
   });

   std::vector<uint32_t> linkingResult;
-  bool succeed = linker.Link(contents, linkingResult, options);
+  spv_result_t status = linker.Link(contents, linkingResult, options);

   if (!WriteFile<uint32_t>(outFile, "wb", linkingResult.data(),
                            linkingResult.size()))
     return 1;

-  return !succeed;
+  return status == SPV_SUCCESS ? 0 : 1;
 }


Don't allow move for "Singleton" class

Don't allow move for "Singleton" class

--- Source/ODLib/Singleton/Singleton.hpp
+++ Source/ODLib/Singleton/Singleton.hpp
@@ -72,8 +72,10 @@

     private:

-        Singleton(Singleton const&) = delete;
-        Singleton& operator=(Singleton const&) = delete;
+        Singleton(const Singleton&) = delete;
+        Singleton(Singleton&&) = delete;
+        Singleton& operator=(const Singleton&) = delete;
+        Singleton& operator=(Singleton&&) = delete;

         static T* m_instance;


SWDEV-263678 - fix rocHPCG mgpu perf drop

Change-Id: I33269fe4f6165d1ed172b19033ab9fcb92f338c3

--- rocclr/hip_memory.cpp
+++ rocclr/hip_memory.cpp
@@ -211,14 +211,30 @@
       }
     } else {
       amd::HostQueue* pQueue = &queue;
-      if (((srcMemory->getContext().devices()[0] == dstMemory->getContext().devices()[0]) ||
-          (srcMemory->getContext().devices().size() != 1)  ||
-          (dstMemory->getContext().devices().size() != 1)) &&
+      if ((srcMemory->getContext().devices()[0] == dstMemory->getContext().devices()[0]) &&
           (queueDevice != srcMemory->getContext().devices()[0])) {
         pQueue = hip::getNullStream(srcMemory->getContext());
         amd::Command* cmd = queue.getLastQueuedCommand(true);
         if (cmd != nullptr) {
           waitList.push_back(cmd);
+        }
+      } else if (srcMemory->getContext().devices()[0] != dstMemory->getContext().devices()[0]) {
+        // Scenarios such as DtoH where dst is pinned memory
+        if ((queueDevice != srcMemory->getContext().devices()[0]) &&
+            (dstMemory->getContext().devices().size() != 1)) {
+          pQueue = hip::getNullStream(srcMemory->getContext());
+          amd::Command* cmd = queue.getLastQueuedCommand(true);
+          if (cmd != nullptr) {
+            waitList.push_back(cmd);
+          }
+        // Scenarios such as HtoD where src is pinned memory
+        } else if ((queueDevice != dstMemory->getContext().devices()[0]) &&
+                   (srcMemory->getContext().devices().size() != 1)) {
+          pQueue = hip::getNullStream(dstMemory->getContext());
+          amd::Command* cmd = queue.getLastQueuedCommand(true);
+          if (cmd != nullptr) {
+            waitList.push_back(cmd);
+          }
         }
       }
       command = new amd::CopyMemoryCommand(*pQueue, CL_COMMAND_COPY_BUFFER, waitList,


Change back to what peercoin had

Change back to what peercoin had

--- src/main.cpp
+++ src/main.cpp
@@ -33,8 +33,8 @@
 map<uint256, CBlockIndex*> mapBlockIndex;
 set<pair<COutPoint, unsigned int> > setStakeSeen;
 uint256 hashGenesisBlock = hashGenesisBlockOfficial;
-static CBigNum bnProofOfWorkLimit(~uint256(0) >> 20);
-static CBigNum bnInitialHashTarget(~uint256(0) >> 22);
+static CBigNum bnProofOfWorkLimit(~uint256(0) >> 32);
+static CBigNum bnInitialHashTarget(~uint256(0) >> 40);
 unsigned int nStakeMinAge = STAKE_MIN_AGE;
 int nCoinbaseMaturity = COINBASE_MATURITY;
 CBlockIndex* pindexGenesisBlock = NULL;


Simplified area menu handling by moving the menu

--- src/main.cpp
+++ src/main.cpp
@@ -120,14 +120,16 @@
 		// what happens in each area. Since we're defining the areas in
 		// code anyway, sticking with this isn't too much of a problem,
 		// and it keeps things easy to understand
+		if(result == 0)
+		{
+			// Open the menu
+			dialogue_menu(player);
+			continue;
+		}
 		if(currentArea == &(areaAtlas[0]))
 		{
 			switch(result)
 			{
-				// Open the menu
-				case 0:
-					dialogue_menu(player);
-					break;
 				case 1:
 				// Move to area 1
 					currentArea = &(areaAtlas[1]);
@@ -144,10 +146,6 @@
 		{
 			switch(result)
 			{
-				// Open the menu
-				case 0:
-					dialogue_menu(player);
-					break;
 				// Move to area 0
 				case 1:
 					currentArea = &(areaAtlas[0]);


Different way to print -help with no arguments

--- src/main.cpp
+++ src/main.cpp
@@ -70,12 +70,6 @@
 //! \returns EXIT_SUCCESS or EXIT_FAILURE.
 int main(int argc, char *argv[])
 {
-    if(argc <= 1)
-    {
-        print_help();
-        return EXIT_SUCCESS;
-    }
-
     std::vector<std::string> options;
     for(int i = 1; i < argc; ++i)
     {
@@ -92,6 +86,11 @@
         {
             options.push_back(argv[i]);
         }
+    }
+
+    if(options.empty())
+    {
+        options.push_back("-help");
     }

     try


Attempt to fix ClearCache. #576

Attempt to fix ClearCache. #576

--- src/main.cpp
+++ src/main.cpp
@@ -5723,8 +5723,8 @@
     if (mvCurrentNeuralNetworkHash.size() > 0) mvCurrentNeuralNetworkHash.clear();

     //Clear the votes
+    ClearCache("neuralsecurity");
     WriteCache("neuralsecurity","pending","0",GetAdjustedTime());
-    ClearCache("neuralsecurity");
     try
     {
         int nMaxDepth = nBestHeight;
@@ -8427,18 +8427,13 @@
 {
        for(map<string,string>::iterator ii=mvApplicationCache.begin(); ii!=mvApplicationCache.end(); ++ii)
        {
-                std::string key_section = mvApplicationCache[(*ii).first];
-                if (key_section.length() > section.length())
+                const std::string& key_section = (*ii).first;
+                if (boost::algorithm::starts_with(key_section, section))
                 {
-                    if (key_section.substr(0,section.length())==section)
-                    {
-                        printf("\r\nClearing the cache....of value %s \r\n",mvApplicationCache[key_section].c_str());
                         mvApplicationCache[key_section]="";
                         mvApplicationCacheTimestamp[key_section]=1;
-                    }
                 }
        }
-
 }


Move directory creation to free function.

--- src/main.cpp
+++ src/main.cpp
@@ -48,6 +48,31 @@
     return split(s, delim, elems);
 }

+void make_dir(const std::string &path)
+{
+    auto elems = split(path, '/');
+    std::string descend;
+    for (size_t i = 0, k = elems.size() - 1; i < k; ++i)
+    {
+        const std::string &s(elems[i]);
+        if (s.size() && s != ".")
+        {
+            descend.append((i > 0 ? "/" : "") + s);
+            auto status = mkdir(descend.c_str(), S_IRWXU);
+            if (status == -1)
+            {
+                std::error_code err(errno, std::generic_category());
+                if (err != std::errc::file_exists)
+                {
+                    std::cout << "error making dir: "
+                        << descend << ": "
+                        << err.message() << std::endl;
+                }
+            }
+        }
+    }
+}
+
 class Target
 {
     public:
@@ -67,41 +92,17 @@
         void fetch()
         {
             std::cout << "Statting target " << name() << "...";
-            std::string path;
             std::fstream fs(name(), std::ios_base::in);
             if (!fs.good())
             {
                 fs.close();
                 std::cout << " doesn't exist, creating new." << std::endl;
-                auto elems = split(name(), '/');
-                for (size_t i = 0, k = elems.size(); i < k; ++i)
-                {
-                    const std::string &s(elems[i]);
-                    if (s.size() && s != ".")
-                    {
-                        path.append((i > 0 ? "/" : "") + s);
-                        // i indicates a directory.
-                        if (i < k - 1)
-                        {
-                            auto status = mkdir(path.c_str(), S_IRWXU);
-                            if (status == -1)
-                            {
-                                std::error_code err(errno, std::generic_category());
-                                if (err != std::errc::file_exists)
-                                {
-                                    std::cout << "error making dir: "
-                                        << path << ": "
-                                        << err.message() << std::endl;
-                                }
-                            }
-                        }
-                    }
-                }
-                fs.open(path, std::ios_base::out);
+                make_dir(name());
+                fs.open(name(), std::ios_base::out);
                 if (!fs.good())
                 {
                     fs.close();
-                    std::cout << "Failed to create file: " << path << std::endl;
+                    std::cout << "Failed to create file: " << name() << std::endl;
                 }
                 else
                 {


Add save dialog to select cuesheet filename

--- src/main.cpp
+++ src/main.cpp
@@ -100,8 +100,25 @@
   return ss.str();
 }

-string generate_cuesheet_filename(vector<string> files) {
-  return "Cuesheet.cue";
+optional<string> get_cuesheet_filename(string directory, vector<string> files) {
+  TCHAR filename[MAX_PATH];
+  filename[0] = 0;
+  OPENFILENAME save_dialog {};
+  save_dialog.lStructSize = sizeof(save_dialog);
+  save_dialog.lpstrFilter = "Cuesheet files (*.cue)\0*.cue\0All files\0*";
+  save_dialog.lpstrDefExt = "cue";
+  save_dialog.lpstrFile = filename;
+  save_dialog.lpstrInitialDir = directory.c_str();
+  save_dialog.nMaxFile = MAX_PATH;
+  save_dialog.Flags = OFN_DONTADDTORECENT | OFN_ENABLESIZING | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST;
+  save_dialog.FlagsEx = OFN_EX_NOPLACESBAR;
+
+  if (GetSaveFileName(&save_dialog)) {
+    return string(filename);
+  }
+  else {
+    return {};
+  }
 }

 bool file_exists(string filename) {
@@ -122,17 +139,9 @@
       auto files = find_bin_files(*dir);
       if (files.empty()) throw runtime_error("No bin files found in the selected directory.");
       auto cuesheet = generate_cuesheet(files);
-      string filename = generate_cuesheet_filename(files);
-      string full_filename = *dir + '\\' + filename;
-
-      bool write_file = true;
-      if (file_exists(full_filename) &&
-        (MessageBox(nullptr, "A cuesheet file already exists. Do you want to overwrite it?", "File exists", MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) == IDNO)) {
-          write_file = false;
-        }
-
-      if (write_file) {
-        ofstream file(full_filename.c_str(), ios::out);
+      auto filename = get_cuesheet_filename(*dir, files);
+      if (filename) {
+        ofstream file(filename->c_str(), ios::out);
         file << cuesheet.c_str();
       }
     }


Made some simplifications in main() function.

git-svn-id: 0231d2b9506727b8389b50bfeac72ec1f38c13c1@2571 ac3cbfda-f6ac-4daa-b570-d46c5f00fc98

--- src/main.cpp
+++ src/main.cpp
@@ -231,20 +231,6 @@
 		// clog.exceptions(std::ios::badbit | std::ios::failbit);
 		// cerr.exceptions(std::ios::badbit | std::ios::failbit);

-		// Prevent multiple instances run by the same user
-		JEWEL_LOG_TRACE();
-		bool another_is_running = false;
-		wxString const app_name = App::application_name();
-		wxString const instance_identifier =
-			app_name +
-			wxString::Format("-%s", wxGetUserId().c_str());
-		wxSingleInstanceChecker const checker(instance_identifier);
-		if (checker.IsAnotherRunning())
-		{
-			another_is_running = true;
-			// to which we will respond below
-		}
-
 		// Process command line arguments
 		JEWEL_LOG_TRACE();
 		CmdLine cmd
@@ -278,26 +264,36 @@
 		(	new PhatbooksDatabaseConnection
 		);
 		App* app = new App;
-		if (another_is_running) app->notify_existing_application_instance();
+
+		// Prevent multiple instances run by the same user
+		wxString const app_name = App::application_name();
+		wxString const instance_identifier =
+			app_name +
+			wxString::Format("-%s", wxGetUserId().c_str());
+		wxSingleInstanceChecker const checker(instance_identifier);
+		if (checker.IsAnotherRunning())
+		{
+			app->notify_existing_application_instance();
+		}
+		app->set_database_connection(dbc);
+		wxApp::SetInstance(app);
+
+		// The argv array required by wxEntryStart must be an array
+		// of wchar_t*. We produce these as follows.
+		wstring const argv0_w(app_name.begin(), app_name.end());
+
+		// We do all this to avoid a const_cast.
+		// The extra 1000 is a safeguard against the fact that
+		// wxEntryStart (below) may modify the contents of the pointers
+		// passed to it. wxWidgets documentation does not say what it might write.
+		// We don't want it writing off the end. Yes, this
+		// is a grotesque hack.
+		size_t buf_0_sz = argv0_w.size() + 1 + 1000;
+		wchar_t* buf_0 = new wchar_t[buf_0_sz];
+		wcscpy(buf_0, argv0_w.c_str());
+
 		if (filepath_str.empty())
 		{
-			app->set_database_connection(dbc);
-			wxApp::SetInstance(app);
-
-			// The argv array required by wxEntryStart must be an array
-			// of wchar_t*. We produce these as follows.
-			wstring const argv0_w(app_name.begin(), app_name.end());
-
-			// We do all this to avoid a const_cast.
-			// The extra 1000 is a safeguard against the fact that
-			// wxEntryStart (below) may modify the contents of the pointers
-			// passed to it. wxWidgets documentation does not say what it might write.
-			// We don't want it writing off the end. Yes, this
-			// is a grotesque hack.
-			size_t buf_0_sz = argv0_w.size() + 1 + 1000;
-			wchar_t* buf_0 = new wchar_t[buf_0_sz];
-			wcscpy(buf_0, argv0_w.c_str());
-
 			// We now construct the arguments required by wxEntryStart.
 			wchar_t* argvs[] = { buf_0, 0 };
 			int argca = 0;
@@ -323,48 +319,38 @@
 			JEWEL_LOG_TRACE();
 			return 0;
 		}
-		JEWEL_ASSERT (!filepath_str.empty());
-		boost::filesystem::path const filepath(filepath_str);
-		if (!another_is_running) dbc->open(filepath);
-		app->set_database_connection(dbc);
-		wxApp::SetInstance(app);
-
-		// array of wchar_t*. We produce these as follows.
-		wstring const argv0_w(app_name.begin(), app_name.end());
-		wstring const argv1_w(filepath_str.begin(), filepath_str.end());
-
-		// We do all this to avoid a const_cast.
-		// The extra 1000 is a safeguard against the fact that
-		// wxEntryStart (below) may modify the contents of the pointers
-		// passed to it. wxWidgets documentation does not say what it might write.
-		// We don't want it writing off the end. Yes, this
-		// is a grotesque hack.
-		size_t buf_0_sz = argv0_w.size() + 1 + 1000;
-		size_t buf_1_sz = argv1_w.size() + 1 + 1000;
-		wchar_t* buf_0 = new wchar_t[buf_0_sz];
-		wchar_t* buf_1 = new wchar_t[buf_1_sz];
-		wcscpy(buf_0, argv0_w.c_str());
-		wcscpy(buf_1, argv1_w.c_str());
-
-		// We now construct the arguments required by wxEntryStart.
-		wchar_t* argvs[] = { buf_0, buf_1, 0 };
-		int argca = 0;
-		while (argvs[argca] != 0) ++argca;
-
-		// At last...
-		wxEntryStart(argca, argvs);
-		wxTheApp->OnInit();
-		wxTheApp->OnRun();
-		wxTheApp->OnExit();
-		wxEntryCleanup();
-
-		delete[] buf_0;
-		buf_0 = nullptr;
-		delete[] buf_1;
-		buf_1 = nullptr;
-
-		JEWEL_LOG_TRACE();
-		return 0;
+		else
+		{
+			JEWEL_ASSERT (!filepath_str.empty());
+			if (!checker.IsAnotherRunning())
+			{
+				dbc->open(boost::filesystem::path(filepath_str));
+			}
+			wstring const argv1_w(filepath_str.begin(), filepath_str.end());
+			size_t buf_1_sz = argv1_w.size() + 1 + 1000;
+			wchar_t* buf_1 = new wchar_t[buf_1_sz];
+			wcscpy(buf_1, argv1_w.c_str());
+
+			// We now construct the arguments required by wxEntryStart.
+			wchar_t* argvs[] = { buf_0, buf_1, 0 };
+			int argca = 0;
+			while (argvs[argca] != 0) ++argca;
+
+			// At last...
+			wxEntryStart(argca, argvs);
+			wxTheApp->OnInit();
+			wxTheApp->OnRun();
+			wxTheApp->OnExit();
+			wxEntryCleanup();
+
+			delete[] buf_0;
+			buf_0 = nullptr;
+			delete[] buf_1;
+			buf_1 = nullptr;
+
+			JEWEL_LOG_TRACE();
+			return 0;
+		}
 	}
 	catch (ArgException& e)
 	{


メソッド名を変更した。

メソッド名を変更した。

--- src/main.cpp
+++ src/main.cpp
@@ -428,7 +428,7 @@
 	}
 };
 static CheckingMethodFactory::Reg<CheckingMethod1> reg1_0("1");
-static CheckingMethodFactory::Reg<CheckingMethod1> reg1_1("summary");
+static CheckingMethodFactory::Reg<CheckingMethod1> reg1_1("dirsummary");

 /**
@@ -553,7 +553,7 @@
 	}
 };
 static CheckingMethodFactory::Reg<CheckingMethod2> reg2_0("2");
-static CheckingMethodFactory::Reg<CheckingMethod2> reg2_1("stat");
+static CheckingMethodFactory::Reg<CheckingMethod2> reg2_1("filestat");
 static CheckingMethodFactory::Reg<CheckingMethod2> reg2_2(""); //default

 }//namespace detfc


main.cpp: comment fix

main.cpp: comment fix

--- src/main.cpp
+++ src/main.cpp
@@ -300,10 +300,10 @@

 extern "C"
 {
-  // This symbol is provided by all recent GCC or MSVC linkers.
+  // This symbol is provided by all recent GCC and MSVC linkers.
   extern IMAGE_DOS_HEADER __ImageBase;

-  // This must be specified in the link command line, "-Wl,-ecustom_startup".
+  // This entry point must be specified in the linker command line.
   extern void custom_startup ()
   {
     HINSTANCE hInstance = reinterpret_cast <HINSTANCE> (& __ImageBase);


capture by reference to avoid copy construction

--- src/main.cpp
+++ src/main.cpp
@@ -63,6 +63,10 @@
 #include <entt/entt.hpp>

 // #include <nlohmann/json.hpp>
+
+#ifdef ORPG_DESKTOP_BUILD
+   #include <sol/sol.hpp>
+#endif

 auto operator+(Vector2 const& lhs, Vector2 const& rhs) noexcept { return Vector2{lhs.x + rhs.x, lhs.y + rhs.y}; }

@@ -320,13 +324,13 @@

    private:
       template <typename Layer>
-      void clear()
+      void clear() noexcept
       {
          const auto entities = registry.view<Layer>();
          registry.destroy(entities.begin(), entities.end());
       }

-      void handle_portal(portal const& p)
+      void handle_portal(portal const& p) noexcept
       {
          spdlog::debug("portal to '{}' triggered ... ", to_string(p.target));
          // select target (new) map
@@ -341,7 +345,7 @@
       }

       template <typename Map>
-      void load_map(Map map)
+      void load_map(Map map) noexcept
       {
          clear<layer2>();

@@ -372,9 +376,9 @@

       // const auto is_in_viewport = [this](auto ent) { return view.is_inside(registry.get<position>(ent)); };

-      void update_view() {}
-
-      void collision_detection()
+      void update_view() noexcept {}
+
+      void collision_detection() noexcept
       {
          registry.view<player, position, velocity>().each([this](auto, position const& pos, velocity& vel) {
             const auto map_size = rect{{0, 0}, std::visit([](auto map) { return extent(map); }, maps)};
@@ -389,7 +393,7 @@
          });
       }

-      void player_movement(const float) // dt
+      void player_movement(const float) noexcept // dt
       {
          registry.view<player, position, velocity>().each([](auto, position& pos, velocity const& vel) {
             pos.x += vel.dx;
@@ -397,7 +401,7 @@
          });
       }

-      void update_camera()
+      void update_camera() noexcept
       {
          auto& active_camera = single_entity<rpc_2d_camera>();
          const auto map_size = rect{{0, 0}, std::visit([](auto map) { return extent(map); }, maps)};
@@ -418,7 +422,7 @@
          active_camera.position.y = std::min(my, map_size.height() - active_camera.viewport.height());
       }

-      auto move_player(auto dx, auto dy)
+      auto move_player(auto dx, auto dy) noexcept
       {
          registry.view<player, velocity>().each([dx, dy](auto, velocity& vel) {
             vel.dx = dx;
@@ -426,7 +430,7 @@
          });
       }

-      void update_input()
+      void update_input() noexcept
       {
          if (IsKeyPressed(KEY_F12)) {
             spdlog::info("Take screenshot: {}", "screenshot.png");
@@ -699,7 +703,7 @@
       app.init();

 #if defined(PLATFORM_WEB)
-      emscripten_set_main_loop([=]() { app.update(); }, 60, 1);
+      emscripten_set_main_loop([&]() { app.update(); }, 60, 1);
 #else
       SetTargetFPS(60);


Added debug to the defaults

Added debug to the defaults

--- aws/src/S3StreamDefaults.cpp
+++ aws/src/S3StreamDefaults.cpp
@@ -1,14 +1,21 @@
 #include "S3StreamDefaults.h"
 #include <ossim/base/ossimPreferences.h>
 #include <ossim/base/ossimEnvironmentUtility.h>
+#include <ossim/base/ossimTrace.h>

 // defaults to a 1 megabyte block size
 //
 ossim_int64 ossim::S3StreamDefaults::m_readBlocksize = 32768;
 ossim_int64 ossim::S3StreamDefaults::m_nReadCacheHeaders = 10000;
+static ossimTrace traceDebug("ossimS3StreamDefaults:debug");

 void ossim::S3StreamDefaults::loadDefaults()
 {
+   if(traceDebug())
+   {
+      ossimNotify(ossimNotifyLevel_DEBUG)
+         << "ossim::S3StreamDefaults::loadDefaults() DEBUG: entered.....\n";
+   }
    ossimString s3ReadBlocksize = ossimEnvironmentUtility::instance()->getEnvironmentVariable("OSSIM_PLUGINS_AWS_S3_READBLOCKSIZE");

    ossimString  nReadCacheHeaders = ossimPreferences::instance()->findPreference("OSSIM_PLUGINS_AWS_S3_NREADCACHEHEADERS");
@@ -52,4 +59,13 @@
         m_nReadCacheHeaders = 10000;
       }
    }
+   if(traceDebug())
+   {
+      ossimNotify(ossimNotifyLevel_DEBUG)
+         << "m_readBlocksize: " << m_readBlocksize << "\n";
+      ossimNotify(ossimNotifyLevel_DEBUG)
+         << "m_nReadCacheHeaders: " << m_nReadCacheHeaders << "\n";
+      ossimNotify(ossimNotifyLevel_DEBUG)
+         << "ossim::S3StreamDefaults::loadDefaults() DEBUG: leaving.....\n";
+   }
 }


DDVSocket edits

DDVSocket edits

--- Connector_RTMP/main.cpp
+++ Connector_RTMP/main.cpp
@@ -125,7 +125,7 @@
         inited = true;
       }
       //only send data if previous data has been ACK'ed...
-      if (snd_cnt - snd_window_at < snd_window_size){
+      //if (snd_cnt - snd_window_at < snd_window_size){
         if (FLV_GetPacket(tag, ss)){//able to read a full packet?
           ts = tag->data[7] * 256*256*256;
           ts += tag->data[4] * 256*256;
@@ -151,7 +151,7 @@
           fprintf(stderr, "Sent a tag to %i\n", CONN_fd);
           #endif
         }
-      }
+      //}
     }
     //send ACK if we received a whole window
     if (rec_cnt - rec_window_at > rec_window_size){


Bypass bad block on testnet.

Bypass bad block on testnet.

--- src/main.cpp
+++ src/main.cpp
@@ -3276,20 +3276,19 @@
         {
             double OUT_POR = 0;
             double OUT_INTEREST_OWED = 0;
-
-            double dAccrualAge = 0;
-            double dAccrualMagnitudeUnit = 0;
-            double dAccrualMagnitude = 0;
-
+            double unused;
             GetProofOfStakeReward(
                         nCoinAge, nFees, bb.cpid, true, 1, nTime,
                         pindex, "connectblock_investor",
-                        OUT_POR, OUT_INTEREST_OWED, dAccrualAge, dAccrualMagnitudeUnit, dAccrualMagnitude);
+                        OUT_POR, OUT_INTEREST_OWED, unused, unused, unused);

             if(!is_claim_valid(nStakeReward, 0, OUT_INTEREST_OWED, nFees))
             {
-                return DoS(10, error("ConnectBlock[] : Investor Reward pays too much : actual %f vs calculated %f, Fees %f",
-                                     dStakeReward, OUT_INTEREST_OWED, /*dCalculatedResearchReward, (double)*/nFees));
+                if(GetBadBlocks().count(pindex->GetBlockHash()) == 0)
+                    return DoS(10, error("ConnectBlock[] : Investor Reward pays too much : actual %f vs calculated %f, Fees %f",
+                                         dStakeReward, OUT_INTEREST_OWED, /*dCalculatedResearchReward, (double)*/nFees));
+
+                LogPrintf("WARNING: ignoring invalid invalid claims on block %s", pindex->GetBlockHash().ToString());
             }
         }
     }


added completion notification

added completion notification

--- question.cc
+++ question.cc
@@ -88,19 +88,20 @@

     std::cout << question << std::endl;
     gettimeofday(starttime, NULL);
-
-    if (todo->empty())
-      std::swap(todo, done);
-
-    setStdinEcho(false);
+
+        setStdinEcho(false);
     std::cin.get();
     setStdinEcho(true);
     gettimeofday(endtime, NULL);
     double elapsed_time = static_cast<double>(endtime->tv_sec) + static_cast<double>(endtime->tv_usec) * 1E-6;
     elapsed_time -= static_cast<double>(starttime->tv_sec) + static_cast<double>(starttime->tv_usec) * 1E-6;
     std::cout <<  elapsed_time << " seconds for answer!" << std::endl;
+    if (todo->empty()) {
+        std::swap(todo, done);
+        std::cout << "### Complete, starting again. ###" << std::endl;
+    }
   }
-
+
   delete starttime;
   delete endtime;
   delete todo;


Follow-up to previous change: slider control should only be set when focus changes

--- indra/newview/llpanelprimmediacontrols.cpp
+++ indra/newview/llpanelprimmediacontrols.cpp
@@ -200,7 +200,7 @@
 		mScrollDownCtrl->setHeldDownCallback(onScrollDownHeld, this);
 		mScrollDownCtrl->setMouseUpCallback(onScrollStop, this);
 	}
-
+
 	mMediaAddress->setFocusReceivedCallback(boost::bind(&LLPanelPrimMediaControls::onInputURL, _1, this ));
 	mInactiveTimeout = gSavedSettings.getF32("MediaControlTimeout");
 	mControlFadeTime = gSavedSettings.getF32("MediaControlFadeTime");
@@ -215,11 +215,15 @@
 {
 	if (media_impl.notNull() && objectp.notNull())
 	{
+		LLUUID prev_id = mTargetImplID;
 		mTargetImplID = media_impl->getMediaTextureID();
 		mTargetObjectID = objectp->getID();
 		mTargetObjectFace = face;
 		mTargetObjectNormal = pick_normal;
 		mClearFaceOnFade = false;
+
+		if (prev_id != mTargetImplID)
+			mVolumeSliderCtrl->setValue(media_impl->getVolume());
 	}
 	else
 	{
@@ -407,14 +411,12 @@
 			{
 				mVolumeUpCtrl->setEnabled(TRUE);
 				mVolumeDownCtrl->setEnabled(FALSE);
-				media_impl->setVolume(0.0);
 				mMuteBtn->setToggleState(true);
 			}
 			else if (volume >= 1.0)
 			{
 				mVolumeUpCtrl->setEnabled(FALSE);
 				mVolumeDownCtrl->setEnabled(TRUE);
-				media_impl->setVolume(1.0);
 				mMuteBtn->setToggleState(false);
 			}
 			else
@@ -423,7 +425,6 @@
 				mVolumeUpCtrl->setEnabled(TRUE);
 				mVolumeDownCtrl->setEnabled(TRUE);
 			}
-			mVolumeSliderCtrl->setValue(volume);

 			switch(result)
 			{


Add x64 Windows here, too

Add x64 Windows here, too

--- desktop/source/deployment/misc/dp_platform.cxx
+++ desktop/source/deployment/misc/dp_platform.cxx
@@ -38,6 +38,7 @@

 #define PLATFORM_ALL                "all"
 #define PLATFORM_WIN_X86            "windows_x86"
+#define PLATFORM_WIN_X86_64         "windows_x86_64"
 #define PLATFORM_LINUX_X86          "linux_x86"
 #define PLATFORM_LINUX_X86_64       "linux_x86_64"
 #define PLATFORM_KFREEBSD_X86       "kfreebsd_x86"
@@ -133,6 +134,8 @@
             ret = true;
         else if (token.equals(OUSTR(PLATFORM_WIN_X86)))
             ret = checkOSandCPU(OUSTR("Windows"), OUSTR("x86"));
+        else if (token.equals(OUSTR(PLATFORM_WIN_X86_64)))
+            ret = checkOSandCPU(OUSTR("Windows"), OUSTR("x86_64"));
         else if (token.equals(OUSTR(PLATFORM_LINUX_X86)))
             ret = checkOSandCPU(OUSTR("Linux"), OUSTR("x86"));
         else if (token.equals(OUSTR(PLATFORM_LINUX_X86_64)))


Remove unnecessary applyMask() application.

applyMask(0xffffffff, x) is an identity function.

git-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@340152 91177308-0d34-0410-b5e6-96231b3b80d8

--- ELF/Arch/Hexagon.cpp
+++ ELF/Arch/Hexagon.cpp
@@ -129,7 +129,7 @@
     or32le(Loc, applyMask(0x000007e0, Val));
     break;
   case R_HEX_32:
-    or32le(Loc, applyMask(0xffffffff, Val));
+    or32le(Loc, Val);
     break;
   case R_HEX_32_6_X:
     or32le(Loc, applyMask(0x0fff3fff, Val >> 6));


Finished resource manager.

Finished resource manager.

Finished the final step of the resource manager, which was to implement Internal::FileExists, which is done with a quick fopen/fclose.

--- Source/Utilities/ResourceManager.cpp
+++ Source/Utilities/ResourceManager.cpp
@@ -16,7 +16,10 @@

 bool FileExists ( const std::string& path )
 {
-	return false;
+	FILE* fp = fopen(path.c_str(), "rb");
+	if (fp)
+		fclose(fp);
+	return fp != NULL;
 }

 }


rename functions for new draw.h

rename functions for new draw.h

--- examples/tjh_draw_03.cpp
+++ examples/tjh_draw_03.cpp
@@ -33,7 +33,7 @@
 		draw::clear(0.1, 0.1, 0.1);

 		draw::setColor( 0.5, 0.5, 0.5 );
-		draw::rectangle( x, y, size, size );
+		draw::rect( x, y, size, size );

 		x += xSpeed;
 		float newx = clamp(x, 0, WIDTH - size);


Basic vote check in CheckBlock

Basic vote check in CheckBlock

--- src/main.cpp
+++ src/main.cpp
@@ -2343,6 +2343,16 @@
     // Check merkleroot
     if (hashMerkleRoot != BuildMerkleTree())
         return DoS(100, error("CheckBlock() : hashMerkleRoot mismatch"));
+
+    // nubit: Basic vote check
+    if (IsProofOfStake())
+    {
+        CVote vote;
+        if (!ExtractVote(*this, vote))
+            return error("CheckBlock() : Unable to extract vote");
+        if (!vote.IsValid())
+            return error("CheckBlock() : Invalid vote");
+    }

     // ppcoin: check block signature
     if (!CheckBlockSignature())


[ELF] - Cosmetic change. NFC.

[ELF] - Cosmetic change. NFC.

peek()[0] == '*' changed to peek().startswith("*")

git-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@277043 91177308-0d34-0410-b5e6-96231b3b80d8

--- ELF/LinkerScript.cpp
+++ ELF/LinkerScript.cpp
@@ -747,7 +747,7 @@
   expect("{");

   while (!Error && !skip("}")) {
-    if ((!peek().empty() && peek()[0] == '*') || peek() == "KEEP") {
+    if ((!peek().empty() && peek().startswith("*")) || peek() == "KEEP") {
       Cmd->Commands.push_back(readInputSectionDescription());
       continue;
     }


Assert some invariants in TextTrack

Assert some invariants in TextTrack

A cue having a track reference implies it being in that track's list of
cues. Rely on this in a few places.

BUG=321654

Review URL: https://codereview.chromium.org/979743003

git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@191292 bbb929c8-8fbe-4397-9dbb-9b2b20218538

--- Source/core/html/track/TextTrack.cpp
+++ Source/core/html/track/TextTrack.cpp
@@ -288,11 +288,19 @@

     // 1. If the given cue is not currently listed in the method's TextTrack
     // object's text track's text track list of cues, then throw a NotFoundError exception.
+    if (cue->track() != this) {
+        exceptionState.throwDOMException(NotFoundError, "The specified cue is not listed in the TextTrack's list of cues.");
+        return;
+    }
+
+    // cue->track() == this implies that cue is in this track's list of cues,
+    // so this track should have a list of cues and the cue being removed
+    // should be in it.
+    ASSERT(m_cues);
+
     // 2. Remove cue from the method's TextTrack object's text track's text track list of cues.
-    if (cue->track() != this || !m_cues || !m_cues->remove(cue)) {
-        exceptionState.throwDOMException(NotFoundError, "The specified cue is not listed in the TextTrack's list of cues.");
-        return;
-    }
+    bool wasRemoved = m_cues->remove(cue);
+    ASSERT_UNUSED(wasRemoved, wasRemoved);

     // If the cue is active, a timeline needs to be available.
     ASSERT(!cue->isActive() || cueTimeline());
@@ -384,9 +392,13 @@

 void TextTrack::cueDidChange(TextTrackCue* cue)
 {
+    // This method is called through cue->track(), which should imply that this
+    // track has a list of cues.
+    ASSERT(m_cues && cue->track() == this);
+
     // Make sure the TextTrackCueList order is up-to-date.
     // FIXME: Only need to do this if the change was to any of the timestamps.
-    ensureTextTrackCueList()->updateCueIndex(cue);
+    m_cues->updateCueIndex(cue);

     // Since a call to cueDidChange is always preceded by a call to
     // cueWillChange, the cue should no longer be active when we reach this


Silence logging in a test which intentionally can trigger errors

--- test/encoder/EncUT_EncoderExt.cpp
+++ test/encoder/EncUT_EncoderExt.cpp
@@ -143,6 +143,9 @@
 TEST_F (EncoderInterfaceTest, EncoderAdditionalOptionSetTest) {
   int iResult, iValue, iReturn;
   float fValue, fReturn;
+  int uiTraceLevel = WELS_LOG_QUIET;
+
+  pPtrEnc->SetOption (ENCODER_OPTION_TRACE_LEVEL, &uiTraceLevel);

   InitializeParamExt();
   iResult = pPtrEnc->InitializeExt (pParamExt);
@@ -255,6 +258,9 @@
   iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi);
   EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
   pSrcPic->uiTimeStamp += 30;
+
+  uiTraceLevel = WELS_LOG_ERROR;
+  pPtrEnc->SetOption (ENCODER_OPTION_TRACE_LEVEL, &uiTraceLevel);
 }

 TEST_F (EncoderInterfaceTest, TemporalLayerSettingTest) {


rm: main file

rm: main file

--- src/main.cpp
+++ src/main.cpp
@@ -1,88 +0,0 @@
-#include <fstream>
-#include "get-cluster.h"
-using namespace cv;
-using namespace std;
-
-
-int main(int argc, char* argv[]){
-    if (argc < 3){
-		cout << "Usage: " << endl
-			<< "IntrinsicImage.exe [-i input_image_path] [-o output_path]" << endl;
-        exit(-1);
-    }
-    string image_path;
-    string region_file_path;
-    string mask_file_path;
-    string output_path;
-    for (int i = 1; i < argc; i = i + 2){
-        if (strcmp(argv[i], "-i") == 0){
-            image_path = string(argv[i+1]);
-            cout << "image_path: " << image_path << endl;
-        }
-        else if (strcmp(argv[i], "-r") == 0){
-            region_file_path = string(argv[i + 1]);
-            cout << "region_file_path: " << region_file_path << endl;
-        }
-        else if (strcmp(argv[i], "-m") == 0){
-            mask_file_path = string(argv[i + 1]);
-        }
-        else if (strcmp(argv[i], "-o") == 0){
-            output_path = string(argv[i + 1]);
-            cout << "output_path: " << output_path << endl;
-        }
-    }
-
-    Mat_<Vec3b> image = imread(image_path);
-    int image_width = image.cols;
-    int image_height = image.rows;
-    Mat_<Vec3b> lab_image(image_height, image_width);
-    Mat_<int> region(image_height, image_width, 1); // not used now
-    int expected_cluster_num = 500;
-    Mat_<int> mask(image_height, image_width, 1); // not used now
-
-    // transform into lab color space
-    cvtColor(image, lab_image, CV_BGR2Lab);
-
-    if(region_file_path.empty() == false){
-        ifstream fin;
-        fin.open(region_file_path);
-        for (int i = 0; i < image_height; i++){
-            for (int j = 0; j < image_width; j++){
-                fin >> region(i, j);
-            }
-        }
-        expected_cluster_num = 3000;
-    }
-
-    if(mask_file_path.empty() == false){
-        Mat_<uchar> temp = imread(mask_file_path);
-        mask = temp > 200;
-    }
-
-    Mat_<Vec3d> project_image = Mat_<Vec3d>(lab_image);
-    double l_ratio = 0.3;
-    for (int i = 0; i < image_height; i++){
-        for (int j = 0; j < image_width; j++){
-            project_image(i, j)[0] *= 0.3;
-        }
-    }
-
-    double sigma = 0;
-    double c = 500; // 1.0
-    int min_size = 5;
-    int cluster_num = 0;
-    Mat_<Vec3b> output;
-    Mat_<int> label;
-
-    cout << "Segment the image..." << endl;
-    GetReflectanceCluster(project_image, sigma, c, min_size, &cluster_num,
-            output, label, expected_cluster_num, region);
-    cout << "Super-pixel num: " << cluster_num << endl;
-
-
-    ofstream fout;
-    fout.open(output_path);
-    fout << cv::format(label, cv::Formatter::FMT_CSV) << endl;
-
-    return 0;
-}


Oilpan: fix build after r183736.

Oilpan: fix build after r183736.

TBR=haraken,oilpan-reviews
BUG=397902
NOTRY=true

Review URL: https://codereview.chromium.org/656093002

git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@183740 bbb929c8-8fbe-4397-9dbb-9b2b20218538

--- Source/core/svg/SVGCursorElement.cpp
+++ Source/core/svg/SVGCursorElement.cpp
@@ -44,7 +44,7 @@
 {
     // The below teardown is all handled by weak pointer processing in oilpan.
 #if !ENABLE(OILPAN)
-    for (auto& client : m_clients)
+    for (const auto& client : m_clients)
         client->cursorElementRemoved();
 #endif
 }
@@ -98,7 +98,7 @@
     SVGElement::InvalidationGuard invalidationGuard(this);

     // Any change of a cursor specific attribute triggers this recalc.
-    for (auto& client : m_clients)
+    for (const auto& client : m_clients)
         client->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::SVGCursor));
 }


Tests for polymorphic I/O

Tests for polymorphic I/O

--- test/encoding/classes_io_test.cpp
+++ test/encoding/classes_io_test.cpp
@@ -16,28 +16,28 @@

 TEST(IO, Polymorphic)
 {
-    ::test::derived_ptr inst1 = ::std::make_shared< ::test::derived >();
-    inst1->fvalue = 3.14;
-    inst1->svalue = "inst1";
-    inst1->ivalue = 100500;
-
-    ::test::derived_ptr inst2 = ::std::make_shared< ::test::derived >();
-    inst2->fvalue = 2.718;
-    inst2->svalue = "inst2";
-    inst2->bvalue = inst1;
-    inst2->ivalue = 42;
-
-    ::test::derived_ptr inst3 = ::std::make_shared< ::test::derived >();
-    inst3->fvalue = 2.718 * 3.14;
-    inst3->svalue = "inst3";
-    inst3->bvalue = inst1;
-    inst3->ivalue = 13;
-
-    ::test::base_ptr b1 = inst2;
-    ::test::base_ptr b2 = inst3;
-
     outgoing out{ core::connector_ptr{} };
     {
+        ::test::derived_ptr inst1 = ::std::make_shared< ::test::derived >();
+        inst1->fvalue = 3.14;
+        inst1->svalue = "inst1";
+        inst1->ivalue = 100500;
+
+        ::test::derived_ptr inst2 = ::std::make_shared< ::test::derived >();
+        inst2->fvalue = 2.718;
+        inst2->svalue = "inst2";
+        inst2->bvalue = inst1;
+        inst2->ivalue = 42;
+
+        ::test::derived_ptr inst3 = ::std::make_shared< ::test::derived >();
+        inst3->fvalue = 2.718 * 3.14;
+        inst3->svalue = "inst3";
+        inst3->bvalue = inst1;
+        inst3->ivalue = 13;
+
+        ::test::base_ptr b1 = inst2;
+        ::test::base_ptr b2 = inst3;
+
         write(::std::back_inserter(out), b1, b2);
         out.close_all_encaps();
         ::std::cerr << "Out buffer size " << out.size() << "\n";
@@ -46,8 +46,8 @@

     incoming in{ message{}, ::std::move(out) };
     {
-        b1.reset();
-        b2.reset();
+        ::test::base_ptr b1;
+        ::test::base_ptr b2;

         auto encaps = in.current_encapsulation();
         auto b = encaps.begin();
@@ -55,8 +55,17 @@
         read(b, e, b1, b2);
         encaps.read_indirection_table(b);

-        EXPECT_TRUE(b1.get());
-        EXPECT_TRUE(b2.get());
+        ASSERT_TRUE(b1.get());
+        ASSERT_TRUE(b2.get());
+
+        auto d1 = ::std::dynamic_pointer_cast<::test::derived>(b1);
+        auto d2 = ::std::dynamic_pointer_cast<::test::derived>(b2);
+
+        ASSERT_TRUE(d1.get());
+        ASSERT_TRUE(d2.get());
+        EXPECT_TRUE(d1->bvalue.get());
+
+        EXPECT_EQ(d1->bvalue, d2->bvalue);
     }
 }


[src/main.cpp] Script mode added, docopt.cpp used.

--- src/main.cpp
+++ src/main.cpp
@@ -1,66 +1,133 @@
 #include <thread>
 #include <utility>
 #include <istream>
+#include <map>

 #include "database.hpp"
 #include "ui.hpp"
 #include "searching.hpp"
+#include "../docopt.cpp/docopt.h"

 using namespace magicSearchEngine;
 using namespace std;

-int
-main(int argc, char *argv[]) {
-    JSONDatabase database;
-    search_engine oraculum(database);
-    // We expect enough space between running this program and writing the first
-    // command within its interface. So for fluency, we run a new thread doing
-    // expensive methods separately and after command processing we only check,
-    // that the user was not too fast. In case, we join the thread and simply wait.
-    thread data_loading([&]() {
-        database.load_database();
-        oraculum.create_index();
-    });
+
+static const char USAGE[] =
+        R"(Magic Search Engine.
+
+    Usage:
+      MagicSearchEngine find <name>
+      MagicSearchEngine similar <name> [<number>]
+      MagicSearchEngine (-h | --help)
+      MagicSearchEngine --interactive
+      MagicSearchEngine --version
+
+    Options:
+      <number>          Number of cards returned [default: 3].
+      -h --help         Show this screen.
+      --interactive     Run interactive mode (type 'help' there).
+      --version         Show version.
+)";
+
+static const char USAGE_INTERACTIVE[] =
+        R"(Magic Search Engine, interactive mode.
+
+    Usage:
+      find <name>
+      similar <name> [<number>]
+      MagicSearchEngine (h | help)
+
+
+    Options:
+      <number>          Number of cards returned [default: 3].
+      -h --help         Show this screen.
+)";
+
+inline void
+find(const JSONDatabase & database,
+        search_engine & oraculum,
+        thread & data_loading,
+        const string & name) {
+    if (!database.is_ready()) {
+        data_loading.join();
+    }
+    auto res = oraculum.search_for(name);
+    if (res == nullptr) {
+        cout << "Demanded card was not found." << endl;
+    }
+    else {
+        cout << *(res) << endl;
+    }
+}
+
+inline void
+similar(const JSONDatabase & database,
+        search_engine & oraculum,
+        thread & data_loading,
+        const string & name,
+        const string & count) {
+    // Parsing count.
+    int cnt = 1;
+    try {
+        cnt = stoi(count);
+        if (cnt < 1) {
+            cout << "Number must be a positive integer." << endl;
+            return;
+        }
+    }
+    catch (...) {
+        cout << USAGE << endl;
+        return;
+    }
+    // Is db loaded?
+    if (!database.is_ready()) {
+        data_loading.join();
+    }
+    // Searching.
+    vector<const Card *> res;
+    res = oraculum.find_similar(name, cnt); // Here cnt is >= 1.
+    if (res.size() == 0) {
+        cout << "Demanded card was not found." << endl;
+    }
+    else {
+        for (const Card * card : res) {
+            cout << (*card) << endl;
+        }
+    }
+}
+
+inline void
+interactive_mode(const JSONDatabase & database,
+        search_engine & oraculum,
+        thread & data_loading) {
     console cmd_ui(cin);
-
     while (true) {
-        auto command = cmd_ui.get_cmd();
-        switch (command.first) {
+        const auto & c = cmd_ui.get_cmd();
+        switch (c.first) {
             case cmd::error:
             case cmd::parse_error:
-                cmd_ui.bad_input();
+                cout << "Error while parsing last input. Use command \"help\"." << endl;
+            case cmd::help:
+                cout << USAGE_INTERACTIVE << endl;
+                break;
             case cmd::end_of_input:
             case cmd::exit:
-                return 0;
+                return;
             case cmd::none:
                 this_thread::yield();
                 break;
             case cmd::find:
             {
-                if (!database.is_ready()) {
-                    data_loading.join();
-                }
-                auto res = oraculum.search_for(command.second[1]);
-                if (res == nullptr) {
-                    cout << "Demanded card was not found." << endl;
-                }
-                else {
-                    cout << *(res) << endl;
-                }
+                find(database, oraculum, data_loading, c.second[1]);
                 break;
             }
             case cmd::similar:
             {
-                if (!database.is_ready()) {
-                    data_loading.join();
-                }
-                auto && res = oraculum.find_similar(command.second[1], 3);
-                if (res.size() == 0) {
-                    cout << "Demanded card was not found." << endl;
-                }
-                for (auto && card : res) {
-                    cout << *card << endl;
-                }
+                if (c.second.size() == 2)
+                    similar(database, oraculum, data_loading, c.second[1], "3");
+                else
+                    similar(database, oraculum, data_loading, c.second[1], c.second[2]);
+                break;
             }
             default:
                 this_thread::yield();
@@ -68,3 +135,45 @@
         }
     }
 }
+
+int
+main(int argc, char * argv[]) {
+    JSONDatabase database;
+    search_engine oraculum(database);
+    // We expect enough space between running this program and writing the first
+    // command in interactive mode. So for fluency, we run a new thread doing
+    // expensive methods separately and after command processing we only check,
+    // that the user was not too fast. In case, we join the thread and simply wait.
+    thread data_loading([&]() {
+        database.load_database();
+        oraculum.create_index();
+    });
+
+    map<string, docopt::value> args = docopt::docopt(USAGE,{argv + 1, argv + argc},
+    true, // show help if requested
+    "Magic Search Engine 1.0"); // version string
+
+    if (args["find"].asBool()) {
+        find(database, oraculum, data_loading, args["<name>"].asString());
+    }
+    else if (args["similar"].asBool()) {
+        if (!args["<number>"]) {
+            similar(database, oraculum, data_loading, args["<name>"].asString(), "3");
+        }
+        else {
+            similar(database, oraculum, data_loading, args["<name>"].asString(), args["<number>"].asString());
+        }
+    }
+    else if (args["--interactive"].asBool()) {
+        interactive_mode(database, oraculum, data_loading);
+    }
+
+    // Avoiding destruction of detachable thread in case of script mode with
+    // wrong input parameters (i.g. negative number). In this way detached
+    // thread is killed with main() instead of terminating program with thread
+    // exception.
+    if (data_loading.joinable())
+        data_loading.detach();
+
+    return 0;
+}


Updated exception tests

Updated exception tests

--- test/exception/exception_test.cpp
+++ test/exception/exception_test.cpp
@@ -78,29 +78,29 @@
 TEST(Exception, OutOfBoundsException_default_construction)
 {
     fl::OutOfBoundsException e;
-//    EXPECT_NE(
-//        std::string(e.what()).find("Index out of bounds"),
-//        std::string::npos);
+    EXPECT_NE(
+        std::string(e.what()).find("Index out of bounds"),
+        std::string::npos);

-    try {
-        fl_throw(fl::OutOfBoundsException());
-    } catch (fl::Exception& e) {
-        std::cout << e.what() << std::endl;
-    }
+//    try {
+//        fl_throw(fl::OutOfBoundsException());
+//    } catch (fl::Exception& e) {
+//        std::cout << e.what() << std::endl;
+//    }
 }

 TEST(Exception, OutOfBoundsException_index)
 {
     fl::OutOfBoundsException e(10);
-//    EXPECT_NE(
-//        std::string(e.what()).find("Index[10] out of bounds"),
-//        std::string::npos);
+    EXPECT_NE(
+        std::string(e.what()).find("Index[10] out of bounds"),
+        std::string::npos);

-    try {
-        fl_throw(e);
-    } catch (fl::Exception& e) {
-        std::cout << e.what() << std::endl;
-    }
+//    try {
+//        fl_throw(e);
+//    } catch (fl::Exception& e) {
+//        std::cout << e.what() << std::endl;
+//    }
 }

 TEST(Exception, OutOfBoundsException_index_size)
@@ -110,9 +110,9 @@
         std::string(e.what()).find("Index[10] out of bounds [0, 8)"),
         std::string::npos);

-    try {
-        fl_throw(e);
-    } catch (fl::Exception& e) {
-        std::cout << e.what() << std::endl;
-    }
+//    try {
+//        fl_throw(e);
+//    } catch (fl::Exception& e) {
+//        std::cout << e.what() << std::endl;
+//    }
 }


Switched testnet difficulty to use real timing.

--- src/main.cpp
+++ src/main.cpp
@@ -1141,26 +1141,6 @@
     // Only change once per interval
     if (((pindexLast->nHeight+1) % nInterval) != 0)
     {
-        // Special difficulty rule for testnet:
-        if (fTestNet)
-        {
-            // If the new block's timestamp is more than 2* 10 minutes
-            // then allow mining of a min-difficulty block.
-            // FIXME: Constant difficulty for testnet while testing
-            // FIXME: Constant difficulty for testnet while testing
-            // FIXME: Constant difficulty for testnet while testing
-            /* if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2) */
-                return nProofOfWorkLimit;
-            /* else */
-            /* { */
-            /*     // Return the last non-special-min-difficulty-rules-block */
-            /*     const CBlockIndex* pindex = pindexLast; */
-            /*     while (pindex->pprev && pindex->nHeight % nInterval != 0 && pindex->nBits == nProofOfWorkLimit) */
-            /*         pindex = pindex->pprev; */
-            /*     return pindex->nBits; */
-            /* } */
-        }
-
         return pindexLast->nBits;
     }


NLL trains but it is slower than Torch and yields a lower accuracy.

--- src/main.cpp
+++ src/main.cpp
@@ -334,23 +334,25 @@

 	Tensor<double> trainFeat = train.sub({ {}, { 0, train.size(1) - 1 } }).scale(1.0 / 255.0);
 	Tensor<double> trainLab = train.sub({ {}, { train.size(1) - 1 } });
-
+	/*
 	trainLab = Tensor<double>(train.size(0), 10);
 	for(size_t i = 0; i < train.size(0); ++i)
 	{
 		size_t j = train(i, train.size(1) - 1);
 		trainLab(i, j) = 1;
 	}
+	*/

 	Tensor<double> testFeat = test.sub({ {}, { 0, test.size(1) - 1 } }).scale(1.0 / 255.0);
 	Tensor<double> testLab = test.sub({ {}, { test.size(1) - 1 } });
-
+	/*
 	testLab = Tensor<double>(test.size(0), 10);
 	for(size_t i = 0; i < test.size(0); ++i)
 	{
 		size_t j = test(i, train.size(1) - 1);
 		testLab(i, j) = 1;
 	}
+	*/

 	Sequential<> nn(
 		new Linear<>(trainFeat.size(1), 300), new TanH<>(),
@@ -358,7 +360,7 @@
 		new Linear<>(10), new TanH<>(),
 		new LogSoftMax<>()
 	);
-	MSE<> critic(nn);
+	NLL<> critic(nn);
 	auto optimizer = makeOptimizer<SGD>(nn, critic).learningRate(0.001);

 	cout << "Training..." << endl;


Parallelize at higher granularity.

Parallelize at higher granularity.

--- src/main.cpp
+++ src/main.cpp
@@ -61,43 +61,43 @@
         std::cout << desc << "\n";
         return 1;
     }
-
+
     verbose = vmap.count("verbose");

     int iterations = vmap.count("iterations") ? vmap["iterations"].as<int>() : default_iterations;

     if (verbose) {
-      print(iterations);
-      #pragma omp parallel
-      #pragma omp single
-      print(omp_get_num_threads());
+        print(iterations);
+        #pragma omp parallel
+        #pragma omp single
+        print(omp_get_num_threads());
     }
-
+
     OutputType output_style = vmap.count("output") ? (OutputType)vmap["output"].as<int>() : CommaSeparated;
-
+
     /*! This call sets up our state machine for the wheel. Each state (i.e. "A0", "C1") is
      represented by an object with pointers to the next states and the bit-flip states. */
     setupStates();
-
+
     Constants constants;

-    /*! The delta used here is NOT, at this point, the delta used in the paper. This is the
+    /*! The delta used here is NOT, at this point, the delta used in the paper. This is the
      ratio of ones to zeroes in the bit stream. Probably worth changing the name, but
      calculating this at runtime is just an invitation for bugs. */
     constants.delta = .5;
     constants.epsilon = .7;
     constants.tau = 1;
     int dimension = 50;
+    #pragma omp parallel for private(constants)
     for (int k=dimension*dimension; k>=0; k--) {
         constants.epsilon = (k % dimension)/(double)(dimension);
         constants.delta = .5 + .5*(k / dimension)/(double)(dimension);
         simulate_and_print(constants, iterations, output_style);
     }
-
+
 }

 void simulate_and_print(Constants constants, int iterations, OutputType type) {
-    boost::timer::auto_cpu_timer t;

     /*! Use this to change the length of the tape. */
     const int BIT_STREAM_LENGTH = 8;
@@ -147,9 +147,7 @@
         #pragma omp single nowait
         delete [] histogram;

-	#pragma omp barrier
-
-        //Make sure we don't accidentally share a seed.
+        #pragma omp barrier

         #pragma omp for reduction(+ : sum)
         for(int k=0; k<iterations; k++) {
@@ -170,6 +168,10 @@
         {
             delete [] p_prime;
             delete [] p;
+        }
+
+        #pragma omp critical
+        {
             if(type==CommaSeparated) {
                 static int once = 0;
                 if (!once) {
@@ -192,6 +194,6 @@
                 assert(0);
             }
         }
-	gsl_rng_free(localRNG);
+        gsl_rng_free(localRNG);
     }
 }


Avoid "Unknown command" messages when receiving getaddr on outbound connections.

Github-Pull: #7642
Rebased-From: d84ea1a59ce3704457a162f1fd8a7353047156de

--- src/main.cpp
+++ src/main.cpp
@@ -5247,13 +5247,18 @@
     }

-    // This asymmetric behavior for inbound and outbound connections was introduced
-    // to prevent a fingerprinting attack: an attacker can send specific fake addresses
-    // to users' AddrMan and later request them by sending getaddr messages.
-    // Making nodes which are behind NAT and can only make outgoing connections ignore
-    // the getaddr message mitigates the attack.
-    else if ((strCommand == NetMsgType::GETADDR) && (pfrom->fInbound))
-    {
+    else if (strCommand == NetMsgType::GETADDR)
+    {
+        // This asymmetric behavior for inbound and outbound connections was introduced
+        // to prevent a fingerprinting attack: an attacker can send specific fake addresses
+        // to users' AddrMan and later request them by sending getaddr messages.
+        // Making nodes which are behind NAT and can only make outgoing connections ignore
+        // the getaddr message mitigates the attack.
+        if (!pfrom->fInbound) {
+            LogPrint("net", "Ignoring \"getaddr\" from outbound connection. peer=%d\n", pfrom->id);
+            return true;
+        }
+
         pfrom->vAddrToSend.clear();
         vector<CAddress> vAddr = addrman.GetAddr();
         BOOST_FOREACH(const CAddress &addr, vAddr)


Fem1DElementBeam.cppC: clean commented code + fix typo

--- SurgSim/Physics/Fem1DElementBeam.cpp
+++ SurgSim/Physics/Fem1DElementBeam.cpp
@@ -243,8 +243,6 @@
 	m_MLocal(5, 7)   =  13.0 * L / 420.0 - m_Iz / (10.0 * AL);
 	m_MLocal(5, 11)  = -L2 / 140.0 - m_Iz / (30.0 * m_A);

-	//m_MLocal.setIdentity();
-
 	m_MLocal *= m;

 	// Transformation Local -> Global
@@ -258,7 +256,7 @@
 	double L2 = L * L;
 	double L3 = L2 * L;

-	// General expresson for shear modulus in terms of Young's modulus and Poisson's ratio
+	// General expression for shear modulus in terms of Young's modulus and Poisson's ratio
 	m_G = m_E / (2.0 * (1.0 + m_nu));

 	if (m_haveShear)


remove compiler warning (VS2017.6)

remove compiler warning (VS2017.6)

--- far/vc_crt_fix_ulink.cpp
+++ far/vc_crt_fix_ulink.cpp
@@ -52,7 +52,9 @@
        && (   !lstrcmpA(pdli->dlp.szProcName, "EncodePointer")
            || !lstrcmpA(pdli->dlp.szProcName, "DecodePointer")))
     {
+#pragma warning(disable: 4191)  // unsafe conversion from...to
       return (FARPROC)no_recode_pointer;
+#pragma warning(default: 4191)
     }
     return nullptr;
 }


make fadeout screen look a little better

git-svn-id: 39e099a8ed5324aded674b764a67f7a08796d9a7@849 662fdd30-d327-0410-a531-f549c87e1e9e

--- src/main.cpp
+++ src/main.cpp
@@ -95,31 +95,60 @@
 /* fade the screen and tell the player they lost */
 void fadeOut( const string & message ){
 	Bitmap dark( GFX_X, GFX_Y );
-	dark.fill( Bitmap::makeColor( 0, 0, 0 ) );
+	Bitmap copy( *Bitmap::Screen );
+	Bitmap work( GFX_X, GFX_Y );
+	// dark.fill( Bitmap::makeColor( 32, 32, 32 ) );
 	Global::speed_counter = 0;
-	Bitmap::transBlender( 0, 0, 0, 10 );
 	int fade = 0;
+	int colors[ 100 ];
+	Util::blend_palette( colors, 100, Bitmap::makeColor( 26, 24, 24 ), Bitmap::makeColor( 97, 90, 91 ) );
+	for ( int y = 0; y < GFX_Y; y++ ){
+			  int color = colors[ (GFX_Y - y) / 5 ];
+			  // dark.line( 0, y, GFX_X, y, Bitmap::makeColor( (GFX_Y - y) / 6, (GFX_Y - y) / 4, (GFX_Y - y) / 5 ) );
+			  dark.line( 0, y, GFX_X, y, color );
+	}
 	const Font & f = Font::getFont( Util::getDataPath() + DEFAULT_FONT, 50, 50 );
 	f.printf( 200, 200, Bitmap::makeColor( 255, 0, 0 ), dark, message, 0 );
-	while ( fade < 100 ){
-		fade++;
-
-		Bitmap::transBlender( 0, 0, 0, fade / 2 );
+	/*
+	for ( int y = 0; y < GFX_Y; y += 6 ){
+
+			  if ( Global::speed_counter >= 1 ){
+						 dark.Blit( 0, y, GFX_X, 6, 0, y, *Bitmap::Screen );
+						 Global::speed_counter = 0;
+			  }
+
+			  while ( Global::speed_counter < 1 ){
+						 Util::rest( 1 );
+			  }
+	}
+	*/
+	while ( fade < 64 ){

 		bool draw = false;
 		if ( Global::speed_counter > 0 ){
+			fade += Global::speed_counter;
 			draw = true;
 			Global::speed_counter = 0;
 		}

 		if ( draw ){
-			dark.drawTrans( 0, 0, *Bitmap::Screen );
+			// Bitmap::transBlender( 0, 0, 0, 255 - fade );
+			// copy.drawTrans( 0, 0, work );
+			dark.Blit( work );
+			Bitmap::transBlender( 0, 0, 0, 255 - fade * fade / 8 );
+			copy.drawTrans( 0, 0, work );
+			work.BlitToScreen();
+			// work.clear();
+			// dark.drawTrans( 0, 0, *Bitmap::Screen );
+			// dark.drawTrans( 0, 0, copy );
+			// copy.BlitToScreen();
 		}

 		while ( Global::speed_counter == 0 ){
 			Util::rest( 1 );
 		}
 	}
+	dark.Blit( *Bitmap::Screen );

 	Util::rest( 1000 );
 }


Add declarations to dict as Declareds

Add declarations to dict as Declareds

--- Synopsis/Parsers/Cxx/syn/synopsis.cc
+++ Synopsis/Parsers/Cxx/syn/synopsis.cc
@@ -138,6 +138,8 @@
 	    cout << "Fatal: Still not PyObject after converting." << endl;
 	    throw "Synopsis::Private::py(AST::Declaration*)";
 	}
+	// Add the Declared for this declaration
+	PyObject_SetItem(m_syn->m_dictionary, Tuple(decl->name()), py(decl->declared()));
     }
     PyObject* obj = iter->second;
     Py_INCREF(obj);


outofcore: updated the bounding box unit test for epsilon added in ooc bb

git-svn-id: e7ea667a1d39a4453c4efcc4ba7bca3d620c3f19@6393 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- test/outofcore/test_outofcore.cpp
+++ test/outofcore/test_outofcore.cpp
@@ -232,11 +232,18 @@

   for(int i=0; i<3; i++)
   {
-    EXPECT_EQ (min_otreeA[i], min[i]);
-    EXPECT_EQ (max_otreeA[i], max[i]);
-
-    EXPECT_EQ (min_otreeB[i], min[i]);
-    EXPECT_EQ (max_otreeB[i], max[i]);
+    //octree adds an epsilon to bounding box
+    EXPECT_LE (min_otreeA[i], min[i]);
+    EXPECT_NEAR (min_otreeA[i], min[i], 1e4);
+
+    EXPECT_GE (max_otreeA[i], max[i]);
+    EXPECT_NEAR (max_otreeA[i], max[i], 1e4);
+
+    EXPECT_LE (min_otreeB[i] , min[i]);
+    EXPECT_NEAR (min_otreeB[i], min[i], 1e4);
+
+    EXPECT_GE (max_otreeB[i] , max[i]);
+    EXPECT_NEAR (max_otreeB[i], max[i], 1e4);
   }
 }

@@ -805,8 +812,8 @@
   ASSERT_EQ (points_added, dst_blob->width*dst_blob->height );
   ASSERT_EQ (LOD_points_added, dst_blob->width*dst_blob->height );

-  sensor_msgs::PointCloud2::Ptr query_result_a (new sensor_msgs::PointCloud2 () );
-  sensor_msgs::PointCloud2::Ptr query_result_b (new sensor_msgs::PointCloud2 () );
+  sensor_msgs::PointCloud2::Ptr query_result_a ( new sensor_msgs::PointCloud2 () );
+  sensor_msgs::PointCloud2::Ptr query_result_b ( new sensor_msgs::PointCloud2 () );

   octreeA.queryBBIncludes ( min, max, octreeA.getDepth (), query_result_a );

@@ -814,7 +821,7 @@

   uint64_t total_octreeB_LOD_query = 0;

-  for( int i=0; i <= octreeB.getDepth (); i++ )
+  for ( int i=0; i <= octreeB.getDepth (); i++ )
   {
     octreeB.queryBBIncludes ( min, max, i, query_result_b );
     total_octreeB_LOD_query += query_result_b->width*query_result_b->height;
@@ -830,8 +837,6 @@
 int
 main (int argc, char** argv)
 {
-//  pcl::console::setVerbosityLevel ( pcl::console::L_DEBUG );
-
   testing::InitGoogleTest (&argc, argv);
   return (RUN_ALL_TESTS ());
 }


fix lat lng types to double

fix lat lng types to double

--- src/main.cpp
+++ src/main.cpp
@@ -19,8 +19,8 @@
 Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085);
 TinyGPSPlus gps;

-float lat = 0.00;
-float lng = 0.00;
+double lat = 0.00;
+double lng = 0.00;

 float hum = 0;
 float tmp = 0;


fix win32 build

fix win32 build

git-svn-id: e7ea667a1d39a4453c4efcc4ba7bca3d620c3f19@6215 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- test/outofcore/test_outofcore.cpp
+++ test/outofcore/test_outofcore.cpp
@@ -101,7 +101,7 @@

 /** \brief helper function to compare two points. is there a templated function in pcl to do this for arbitrary point types?*/
 bool
-compPt ( PointT p1, PointT p2 )
+compPt ( const PointT &p1, const PointT &p2 )
 {
   if( p1.x != p2.x || p1.y != p2.y || p1.z != p2.z )
     return false;


removing -o and -s arguments

removing -o and -s arguments

--- src/main.cpp
+++ src/main.cpp
@@ -40,7 +40,6 @@
 // Console elements
 CommandList commands;
 std::mutex  consoleMutex;
-std::string outputFile      = "";
 std::vector<std::string> cmds_arguments;    // Execute commands
 bool        execute_exit    = false;

@@ -102,8 +101,6 @@
     std::cerr << "// [-I<include_folder>] - add an include folder to default for #include files" << std::endl;
     std::cerr << "// [-D<define>] - add system #defines directly from the console argument" << std::endl;
     std::cerr << "// [-p <osc_port>] - open OSC listening port" << std::endl;
-    std::cerr << "// [-o <file>.(png,jpg,tga,bmp,hdr)] - save the viewport to an image file before exit" << std::endl;
-    std::cerr << "// [-s/--sec <seconds>] - exit app after a specific amount of seconds" << std::endl;
     std::cerr << "// [-e/-E <command>] - execute command when start. Multiple -e flags can be chained" << std::endl;
     std::cerr << "// [-v/--version] - return glslViewer version" << std::endl;
     std::cerr << "// [--verbose] - turn verbose outputs on" << std::endl;
@@ -434,18 +431,12 @@
     "cursor[,on|off]                show/hide cursor", false));

     commands.push_back(Command("screenshot", [&](const std::string& _line){
-        if (_line == "screenshot" && outputFile != "") {
-            sandbox.screenshotFile = outputFile;
-            return true;
-        }
-        else {
-            std::vector<std::string> values = split(_line,',');
-            if (values.size() == 2) {
-                consoleMutex.lock();
-                sandbox.screenshotFile = values[1];
-                consoleMutex.unlock();
-                return true;
-            }
+        std::vector<std::string> values = split(_line,',');
+        if (values.size() == 2) {
+            consoleMutex.lock();
+            sandbox.screenshotFile = values[1];
+            consoleMutex.unlock();
+            return true;
         }
         return false;
     },
@@ -612,7 +603,6 @@
     initGL (windowPosAndSize, windowStyle);

     struct stat st;                         // for files to watch
-    float       timeLimit       = -1.0f;    // Time limit
     int         textureCounter  = 0;        // Number of textures to load
     bool        vFlip           = true;     // Flip state

@@ -638,29 +628,6 @@
         }
         else if ( argument == "--fxaa" ) {
             sandbox.fxaa = true;
-        }
-        else if ( argument == "-s" || argument == "--sec" ) {
-            if(++i < argc) {
-                argument = std::string(argv[i]);
-                timeLimit = toFloat(argument);
-                std::cout << "// Will exit in " << timeLimit << " seconds." << std::endl;
-            }
-            else
-                std::cout << "Argument '" << argument << "' should be followed by <seconds>. Skipping argument." << std::endl;
-        }
-        else if ( argument == "-o" ) {
-            if(++i < argc) {
-                argument = std::string(argv[i]);
-                if ( haveExt(argument, "png" )) {
-                    outputFile = argument;
-                    std::cout << "// Will save screenshot to " << outputFile  << " on exit." << std::endl;
-                }
-                else {
-                    std::cerr << "At the moment screenshots only support PNG formats" << std::endl;
-                }
-            }
-            else
-                std::cout << "Argument '" << argument << "' should be followed by a <file>. Skipping argument." << std::endl;
         }
         else if ( argument== "-p" || argument == "--port" ) {
             if(++i < argc)
@@ -845,12 +812,6 @@
     while ( isGL() && bRun.load() ) {
         // Update
         updateGL();
-
-        // Calculate if timeout required
-        if ( timeLimit >= 0.0 && getTime() >= timeLimit ) {
-            timeOut = true;
-            sandbox.screenshotFile = outputFile;
-        }

         glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );


Add print statements

Add print statements

--- src/main.cpp
+++ src/main.cpp
@@ -57,6 +57,7 @@
 }

 void create_image_hdu(const string &hdu_name, const string &column, fitsfile *fptr, int datatype, const vector<string> &files, long nobjects, long nimages, int *status) {
+    cout << "Creating " << hdu_name << " hdu, from column " << column << endl;
     long naxes[] = {nimages, nobjects};

     switch (datatype) {
@@ -76,11 +77,13 @@
     int hdunum = 0;
     fits_checkp(fits_get_hdu_num(fptr, &hdunum));

+    cout << "Writing hdu name" << endl;
     char *extname = const_cast<char*>(hdu_name.c_str());
     fits_checkp(fits_update_key(fptr, TSTRING, "EXTNAME", extname, NULL, status));

     for (int i=0; i<nobjects; i++) {
         auto filename = files[i];
+        cout << "Updating from file " << filename << endl;
         auto data = get_column(filename, column, datatype, status);
         for (int j=data.size(); j<nimages; j++) {
             data.push_back(NULL_VALUE);
@@ -120,9 +123,10 @@
     assert(nullptr != fptr);

     /* Create the primary hdu */
+    cout << "Creating primary hdu" << endl;
     fits_check(fits_create_img(fptr, BYTE_IMG, 0, NULL, &status));

-    /* Write the HDUS */
+    /* Write the image HDUS */
     fits_check(create_image_hdu("HJD", "TIME", fptr, TDOUBLE, files, nobjects, nimages, &status));
     fits_check(create_image_hdu("FLUX", "DETFLUX", fptr, TDOUBLE, files, nobjects, nimages, &status));
     fits_check(create_image_hdu("FLUXERR", "DETFLUX_ERR", fptr, TDOUBLE, files, nobjects, nimages, &status));


Typo Fix

Typo Fix

Fixed typo in block time

--- src/main.cpp
+++ src/main.cpp
@@ -981,7 +981,7 @@
 static const int64 nTargetTimespan = 1 * 60 * 60; // KittehCoin: retarget every 1 hours
 int64 GetTargetSpacing()
 {
-    int nTargetSpacing = 60; // OLD KittehCoin block spacing: 30 seconds
+    int nTargetSpacing = 30; // OLD KittehCoin block spacing: 30 seconds

     if(nBestHeight > HARDFORK_BLOCK_HEIGHT)
         nTargetSpacing = 60; // NEW KittehCoin block spacing: 60 seconds


removed some debugging stuff i forgot to remove on the last commit


Fixed off-by-one error in filelist

Fixed off-by-one error in filelist

--- src/main.cpp
+++ src/main.cpp
@@ -69,7 +69,7 @@
         std::vector<std::string> filenames;
         if (argc > 3)
         {
-            filenames.assign(&argv[3], &argv[argc-1]);
+            filenames.assign(&argv[3], &argv[argc]);
         }

         auto num_files = filenames.size();


v1.3.3

--- src/main.cpp
+++ src/main.cpp
@@ -1284,13 +1284,10 @@
 static const int64 nStartSubsidyNEW = 72 * COIN;
 static const int64 nMinSubsidyNEW = 0.1 * COIN;

-static const int64 nStartSubsidyNEW2 = 32 * COIN;
-
 int64 static GetBlockValue(int nHeight, int64 nFees, uint256 prevHash)
 {
     int64 nSubsidy = nStartSubsidy;
     int64 nSubsidyNEW = nStartSubsidyNEW;
-    int64 nSubsidyNEW2 = nStartSubsidyNEW2;

     std::string cseed_str = prevHash.ToString().substr(5,7);
     const char* cseed = cseed_str.c_str();
@@ -1305,14 +1302,14 @@
             nSubsidy *= 5;
         }
     }
-
-    else if(nHeight > DIFF_SWITCH_BLOCK_2 && nHeight < DIFF_SWITCH_BLOCK_3)
+    else
     {
         //Random Superblock
-        if(rand > 2190 && rand < 2199)
-        {
-            nSubsidyNEW2 *= 5;
-        }
+        if(rand > 2099 && rand < 2199)
+        {
+            nSubsidyNEW *= 5;
+        }
+
     }

     // 1st 2 days bonus
@@ -1321,104 +1318,47 @@
         nSubsidy *= 3;
     }

+    //Super block weeks after every year for the 1st 5 years
+    if(nHeight > 345599 && nHeight < 352321)
+    {
+        nSubsidy *= 5;
+    }
+
+    else if(nHeight > 691197 && nHeight < 697919)
+    {
+        nSubsidy *= 5;
+    }
+
+    else if(nHeight > 1036797 && nHeight < 1043519)
+    {
+        nSubsidy *= 5;
+    }
+
+    else if(nHeight > 1382397 && nHeight < 1389119)
+    {
+        nSubsidy *= 5;
+    }
+
+    else if(nHeight > 1727997 && nHeight < 1734719)
+    {
+        nSubsidy *= 7;
+    }

     if(nHeight < DIFF_SWITCH_BLOCK)
     {
         // Mining phase: Subsidy is cut in half every SubsidyHalvingInterval
         nSubsidy >>= (nHeight / Params().SubsidyHalvingInterval());
     }
-    else if(nHeight > DIFF_SWITCH_BLOCK_3)
-    {
-       if(nHeight > 171780 && nHeight < 344582)
-       {
-            nSubsidyNEW2 = nStartSubsidyNEW2;
-       }
-       else if(nHeight > 344581 && nHeight < 430983)
-       {
-            nSubsidyNEW2 = 27 * COIN;
-       }
-       else if(nHeight > 430982 && nHeight < 603784)
-       {
-            nSubsidyNEW2 = 21 * COIN;
-       }
-       else if(nHeight > 603783 && nHeight < 690185)
-       {
-            nSubsidyNEW2 = 17 * COIN;
-       }
-       else if(nHeight > 690184 && nHeight < 862986)
-       {
-            nSubsidyNEW2 = 14 * COIN;
-       }
-       else if(nHeight > 862985 && nHeight < 1213387)
-       {
-            nSubsidyNEW2 = 12 * COIN;
-       }
-       else if(nHeight > 1213386 && nHeight < 1386188)
-       {
-            nSubsidyNEW2 = 11 * COIN;
-       }
-       else if(nHeight > 1386187 && nHeight < 1736589)
-       {
-            nSubsidyNEW2 = 9 * COIN;
-       }
-       else if(nHeight > 1736588 && nHeight < 2086990)
-       {
-            nSubsidyNEW2 = 8 * COIN;
-       }
-       else if(nHeight > 2086989 && nHeight < 2437391)
-       {
-            nSubsidyNEW2 = 6 * COIN;
-       }
-       else if(nHeight > 2437390 && nHeight < 2787792)
-       {
-            nSubsidyNEW2 = 4 * COIN;
-       }
-       else if(nHeight > 2787791 && nHeight < 4539793)
-       {
-            nSubsidyNEW2 = 2 * COIN;
-       }
-       else if(nHeight > 4539792 && nHeight < 6291794)
-       {
-            nSubsidyNEW2 = 1 * COIN;
-       }
-       else if(nHeight > 6291793 && nHeight < 9795795)
-       {
-            nSubsidyNEW2 = 0.5 * COIN;
-       }
-       else if(nHeight > 9795794 && nHeight < 13299796)
-       {
-            nSubsidyNEW2 = 0.2 * COIN;
-       }
-       else if(nHeight > 13299795 && nHeight < 20307797)
-       {
-            nSubsidyNEW2 = 0.1 * COIN;
-       }
-       else
-       {
-            nSubsidyNEW2 = 2 * COIN;
-       }
-
-       //Random Superblock For HF v1.3.3
-        if(rand > 2099 && rand < 2199)
-        {
-            nSubsidyNEW2 *= 3;
-        }
-
-
-    }
     else
     {
-
         // Mining phase: Subsidy is cut in half every SubsidyHalvingInterval
         nSubsidyNEW >>= (nHeight / Params().SubsidyHalvingIntervalNEW());
-
     }

     // Inflation phase: Subsidy reaches minimum subsidy
     // Network is rewarded for transaction processing with transaction fees and
     // the inflationary subsidy
-
-    /*if(nHeight < DIFF_SWITCH_BLOCK)
+    if(nHeight < DIFF_SWITCH_BLOCK)
     {
         if (nSubsidy < nMinSubsidy)
         {
@@ -1432,14 +1372,9 @@
             nSubsidyNEW = nMinSubsidyNEW;
         }
     }
-    */
     if(nHeight < DIFF_SWITCH_BLOCK)
     {
         return nSubsidy + nFees;
-    }
-    else if(nHeight > DIFF_SWITCH_BLOCK_3)
-    {
-        return nSubsidyNEW2 + nFees;
     }
     else
     {


drop testcase

drop testcase

--- test/src/unit-element_access2.cpp
+++ test/src/unit-element_access2.cpp
@@ -187,7 +187,6 @@
                     CHECK(j.value("_", 12.34) == Approx(12.34));
                     CHECK(j.value("_", json({{"foo", "bar"}})) == json({{"foo", "bar"}}));
                     CHECK(j.value("_", json({10, 100})) == json({10, 100}));
-                    CHECK(j.value("_", std::move("default_value")) == "default_value");

                     CHECK(j_const.value("_", 2) == 2);
                     CHECK(j_const.value("_", 2u) == 2u);
@@ -196,7 +195,6 @@
                     CHECK(j_const.value("_", 12.34) == Approx(12.34));
                     CHECK(j_const.value("_", json({{"foo", "bar"}})) == json({{"foo", "bar"}}));
                     CHECK(j_const.value("_", json({10, 100})) == json({10, 100}));
-                    CHECK(j_const.value("_", std::move("default_value")) == "default_value");
                 }

                 SECTION("access on non-object type")


Application starts in editor mode by default

--- src/main.cpp
+++ src/main.cpp
@@ -21,7 +21,7 @@
     QApplication a(argc, argv);
     try
     {
-        if (argc > 1 && QString(argv[1]) == "--editor" )
+        if (argc == 1)
         {
             new MainWindow();
         }


Luffa7

--- src/main.cpp
+++ src/main.cpp
@@ -1658,7 +1658,7 @@
 		nSubsidy = (150 + CPU_MAXIMUM_BLOCK_PAYMENT_AMOUNT) * COIN;
 	} else
 	{
-		nSubsidy = (155) * COIN;
+		nSubsidy = (154) * COIN;
 	}

     // Subsidy is cut in half every 840000 blocks, which will occur approximately every 4 years


changes

changes

--- src/main.cpp
+++ src/main.cpp
@@ -585,7 +585,7 @@

     if (IsCoinBase())
     {
-        if (vin[0].scriptSig.size() < 2 || vin[0].scriptSig.size() > 100)
+        if (vin[0].scriptSig.size() < 2 || vin[0].scriptSig.size() > 150)
             return state.DoS(100, error("CTransaction::CheckTransaction() : coinbase script size"));
     }
     else


Set nBytesOrphanPool to zero on startup

Set nBytesOrphanPool to zero on startup

This happens during initialization when UnloadBlockIndex() is called
during startup.

--- src/main.cpp
+++ src/main.cpp
@@ -4881,6 +4881,7 @@
         LOCK(cs_orphancache);
         mapOrphanTransactions.clear();
         mapOrphanTransactionsByPrev.clear();
+        nBytesOrphanPool = 0;
     }

     LOCK(cs_main);


Improve help display

Improve help display

--- src/main.cpp
+++ src/main.cpp
@@ -14,10 +14,22 @@
 #include "arrow/tokenizer.hpp"
 #include "arrow/command.hpp"

-void help(char* binary_path) {
+void help(char* binary_path,
+          const std::deque<std::shared_ptr<arrow::Command>>& commands) {
   std::printf(
     "Usage: \x1b[0;36m%s\x1b[0m [<command>] [<options>] <input-file>\n",
     binary_path);
+
+  std::printf("Commands:\n");
+  for (auto& cmd : commands) {
+    std::printf("  \x1b[0;33m--%-10s\x1b[0m", cmd->name());
+    std::printf("%s", cmd->description());
+    std::printf("\n");
+  }
+
+  std::printf("  \x1b[0;33m--%-10s\x1b[0m", "help");
+  std::printf("Display this help information");
+  std::printf("\n");

   std::printf("\n");
 }
@@ -52,8 +64,7 @@
     }
   } else {
     // Show help
-    // help(argv[0], commands);
-    help(argv[0]);
+    help(argv[0], commands);
     return 0;
   }

@@ -61,8 +72,7 @@
     std::string a1(args[1]);
     if (a1.substr(2) == "help" || a1.substr(1) == "h") {
       // Show help
-      // help(argv[0], commands);
-      help(argv[0]);
+      help(argv[0], commands);
       return 0;
     }
   }


trigger

trigger

--- src/main.cpp
+++ src/main.cpp
@@ -71,8 +71,6 @@

 	} else if(strncmp(&argv[1][0], "stats", 5) == 0){
 		return(stats(argc, argv));
-		//std::cerr << "Not implemented" << std::endl;
-		//return(1);

 	} else if(strncmp(&argv[1][0], "--version", 9) == 0 || strncmp(&argv[1][0], "version", 7) == 0){
 		programMessage(false);


Optimize getfilecontents to reduce chance of race on client_state.xml

--- src/main.cpp
+++ src/main.cpp
@@ -5069,41 +5069,31 @@
 }

-
-
 std::string getfilecontents(std::string filename)
 {
-    std::string buffer;
-    std::string line;
-    ifstream myfile;
-    if (fDebug10) LogPrintf("loading file to string %s",filename);
-
-    filesystem::path path = filename;
-
-    if (!filesystem::exists(path)) {
-        LogPrintf("the file does not exist %s",path.string());
+    if (!filesystem::exists(filename)) {
+        LogPrintf("getfilecontents: file does not exist %s", filename);
         return "-1";
     }

-     FILE *file = fopen(filename.c_str(), "rb");
-     CAutoFile filein = CAutoFile(file, SER_DISK, CLIENT_VERSION);
-     int fileSize = GetFilesize(filein);
-     filein.fclose();
-
-     myfile.open(filename.c_str());
-
-    buffer.reserve(fileSize);
-    if (fDebug10) LogPrintf("opening file %s",filename);
-
-    if(myfile)
-    {
-      while(getline(myfile, line))
-      {
-            buffer = buffer + line + "\n";
-      }
-    }
-    myfile.close();
-    return buffer;
+    std::ifstream in(filename, std::ios::in | std::ios::binary);
+
+    if (in.fail()) {
+        LogPrintf("getfilecontents: error opening file %s", filename);
+        return "-1";
+    }
+
+    if (fDebug10) LogPrintf("loading file to string %s", filename);
+
+    std::ostringstream out;
+
+    out << in.rdbuf();
+
+    // Immediately close instead of waiting for the destructor to decrease the
+    // chance of a race when calling this to read BOINC's client_state.xml:
+    in.close();
+
+    return out.str();
 }

 bool IsCPIDValidv3(std::string cpidv2, bool allow_investor)
@@ -7448,8 +7438,8 @@
  try
  {
     std::string sourcefile = GetBoincDataDir() + "client_state.xml";
-    std::string sout = "";
-    sout = getfilecontents(sourcefile);
+    std::string sout = getfilecontents(sourcefile);
+
     if (sout == "-1")
     {
         LogPrintf("Unable to obtain Boinc CPIDs ");


added nouce calculation

added nouce calculation

--- src/main.cpp
+++ src/main.cpp
@@ -31,7 +31,7 @@
 unsigned int nTransactionsUpdated = 0;

 map<uint256, CBlockIndex*> mapBlockIndex;
-uint256 hashGenesisBlock("0x61a8e2e4a21ff79a135f0928e958ef3e9d8031f52a977ac0f49cfd9cecb33cf6");
+uint256 hashGenesisBlock("0xa8f2c5db0ff04ecc771dc58964473b5d565902628b05b13130f157dab27701ba");
 static CBigNum bnProofOfWorkLimit(~uint256(0) >> 20); // Xcoin: starting difficulty is 1 / 2^12
 CBlockIndex* pindexGenesisBlock = NULL;
 int nBestHeight = -1;
@@ -2770,12 +2770,42 @@
         block.nVersion = 1;
         block.nTime    = 1389401959;
         block.nBits    = 0x1e0ffff0;
-        block.nNonce   = 1084524493;
+        block.nNonce   = 17355177984;

         if (fTestNet)
         {
             block.nTime    = 1317798646;
             block.nNonce   = 385270584;
+        }
+
+        if (true && block.GetHash() != hashGenesisBlock)
+        {
+            printf("Searching for genesis block...\n");
+            // This will figure out a valid hash and Nonce if you're
+            // creating a different genesis block:
+            uint256 hashTarget = CBigNum().SetCompact(block.nBits).getuint256();
+            uint256 thash;
+            char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
+
+            loop
+            {
+                scrypt_1024_1_1_256_sp(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
+                if (thash <= hashTarget)
+                    break;
+                if ((block.nNonce & 0xFFF) == 0)
+                {
+                    printf("nonce %08X: hash = %s (target = %s)\n", block.nNonce, thash.ToString().c_str(), hashTarget.ToString().c_str());
+                }
+                ++block.nNonce;
+                if (block.nNonce == 0)
+                {
+                    printf("NONCE WRAPPED, incrementing time\n");
+                    ++block.nTime;
+                }
+            }
+            printf("block.nTime = %u \n", block.nTime);
+            printf("block.nNonce = %u \n", block.nNonce);
+            printf("block.GetHash = %s\n", block.GetHash().ToString().c_str());
         }

         //// debug print


commit to save final changes

commit to save final changes

--- src/main.cpp
+++ src/main.cpp
@@ -545,7 +545,6 @@
 			j++;
 		}

-
 		//check if current arg is exit
 		if(0 == (strcmp(input[0], "exit")))
 		{
@@ -561,7 +560,7 @@
 		{
 			perror("fork");
 			//FIXed MEMORY LEAK!!!!!!
-			delete[] input;
+			delete[] input[j];
 			return false;
 		}
 		else if(pid == 0) //child


Add missing cs_main lock to ::GETBLOCKTXN processing

Note that this is not a major issue as, in order for the missing
lock to cause issues, you have to receive a GETBLOCKTXN message
while reindexing, adding a block header via RPC, etc, which results
in either a table rehash or an insert into the bucket which you are
currently looking at.

Github-Pull: #8995
Rebased-From: dfe79060a62c8de098e75d527d97b99c3b10de50

--- src/main.cpp
+++ src/main.cpp
@@ -5388,6 +5388,8 @@
         BlockTransactionsRequest req;
         vRecv >> req;

+        LOCK(cs_main);
+
         BlockMap::iterator it = mapBlockIndex.find(req.blockhash);
         if (it == mapBlockIndex.end() || !(it->second->nStatus & BLOCK_HAVE_DATA)) {
             LogPrintf("Peer %d sent us a getblocktxn for a block we don't have", pfrom->id);


Remove elipses on persistenc diag title

Remove elipses on persistenc diag title

--- topo-volume/persistence_curve_widget.cpp
+++ topo-volume/persistence_curve_widget.cpp
@@ -114,7 +114,7 @@
     ImGui::PopStyleVar(2);
 }
 void PersistenceCurveWidget::draw_persistence_diagram(float ysize) {
-    ImGui::Text("Persistence Diagram...");
+    ImGui::Text("Persistence Diagram");

     ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, glm::vec2(1));
     ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, glm::vec2(0));


Minor cleanup of drawScene.

Minor cleanup of drawScene.

--- src/main.cpp
+++ src/main.cpp
@@ -71,8 +71,6 @@

 void drawScene(void)
 {
-    glClear(GL_COLOR_BUFFER_BIT);
-
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
     glFrustum(-0.1f, 0.1f, -0.075f, 0.075f, 0.1f, 100.0f);
@@ -81,7 +79,9 @@
     glRotatef(90.0f - playerFace, 0.0f, 0.0f, 1.0f);
     glTranslatef(-playerX, -playerY, -1.0f);
     glMatrixMode(GL_MODELVIEW);
+
     drawGround();
+
     SDL_GL_SwapBuffers();
 }