Convert GenerateClassWrappersPass to use fmt lib.

--- Generator/Pass/CSharp/GenerateClassWrappers.cpp
+++ Generator/Pass/CSharp/GenerateClassWrappers.cpp
@@ -20,6 +20,7 @@
 // THE SOFTWARE.
 //

+#include <fmt/format.h>
 #include <Urho3D/IO/File.h>
 #include <Urho3D/IO/Log.h>
 #include "GenerateClassWrappers.h"
@@ -61,18 +62,12 @@
         return info.event != info.container_entity_enter;
     }

-    printer_ << fmt("class URHO3D_EXPORT_API {{name}} : public {{symbol}}", {
-        {"name", entity->name_},
-        {"symbol", entity->uniqueName_},
-    });
+    printer_ << fmt::format("class URHO3D_EXPORT_API {} : public {}", entity->name_, entity->uniqueName_);
     printer_.Indent();

     // Urho3D-specific
     if (IsSubclassOf(cls, "Urho3D::Object"))
-    {
-        printer_ << fmt("URHO3D_OBJECT({{name}}, {{symbol_name}});", {{"name",        entity->name_},
-                                                                      {"symbol_name", entity->uniqueName_}});
-    }
+        printer_ << fmt::format("URHO3D_OBJECT({}, {});", entity->name_, entity->uniqueName_);

     printer_.WriteLine("public:", false);
     // Wrap constructors
@@ -81,14 +76,11 @@
         if (e->kind_ == cppast::cpp_entity_kind::constructor_t)
         {
             const auto& ctor = e->Ast<cppast::cpp_constructor>();
-            printer_ << fmt("{{name}}({{parameter_list}}) : {{symbol_name}}({{parameter_name_list}}) { }",
-                {{"name",                entity->name_},
-                 {"symbol_name",         entity->uniqueName_},
-                 {"parameter_list",      ParameterList(ctor.parameters())},
-                 {"parameter_name_list", ParameterNameList(ctor.parameters())},});
+            printer_ << fmt::format("{}({}) : {}({}) {{ }}", entity->name_, ParameterList(ctor.parameters()),
+                entity->uniqueName_, ParameterNameList(ctor.parameters()));
         }
     }
-    printer_ << fmt("virtual ~{{name}}() = default;", {{"name", entity->name_}});
+    printer_ << fmt::format("virtual ~{}() = default;", entity->name_);

     std::vector<std::string> wrappedList;
     auto implementWrapperClassMembers = [&](const MetaEntity* cls)
@@ -107,14 +99,14 @@
                     type.kind() != cppast::cpp_type_kind::reference_t &&
                     type.kind() != cppast::cpp_type_kind::builtin_t;

-                auto vars = fmt({
-                    {"name", child->name_},
-                    {"type", cppast::to_string(type)},
-                    {"ref", wouldReturnByCopy ? "&" : ""}
-                });
-
-                printer_ << fmt("{{type}}{{ref}} __get_{{name}}() { return {{name}}; }", vars);
-                printer_ << fmt("void __set_{{name}}({{type}} value) { {{name}} = value; }", vars);
+                auto name = child->name_;
+                auto typeName = cppast::to_string(type);
+                auto ref = wouldReturnByCopy ? "&" : "";
+
+                printer_ << fmt::format("{typeName}{ref} __get_{name}() {{ return {name}; }}",
+                    FMT_CAPTURE(name), FMT_CAPTURE(typeName), FMT_CAPTURE(ref));
+                printer_ << fmt::format("void __set_{name}({typeName} value) {{ {name} = value; }}",
+                    FMT_CAPTURE(name), FMT_CAPTURE(typeName), FMT_CAPTURE(ref));
             }
             else if (child->kind_ == cppast::cpp_entity_kind::member_function_t)
             {
@@ -126,35 +118,40 @@
                     wrappedList.emplace_back(methodId);
                     // Function pointer that virtual method will call
                     const auto& cls = child->parent_;
-                    auto vars = fmt({
-                        {"type",                cppast::to_string(func.return_type())},
-                        {"name",                child->name_},
-                        {"class_name",          entity->name_},
-                        {"full_class_name",     entity->uniqueName_},
-                        {"parameter_list",      ParameterList(func.parameters())},
-                        {"parameter_name_list", ParameterNameList(func.parameters())},
-                        {"return",              IsVoid(func.return_type()) ? "" : "return"},
-                        {"const",               cppast::is_const(func.cv_qualifier()) ? "const " : ""},
-                        {"has_params",          Count(func.parameters()) > 0},
-                        {"symbol_name",         Sanitize(child->uniqueName_)}
-                    });
+                    auto typeName = cppast::to_string(func.return_type());
+                    auto name = child->name_;
+                    auto parameterList = ParameterList(func.parameters());
+                    auto parameterNameList = ParameterNameList(func.parameters());
+                    auto constModifier = cppast::is_const(func.cv_qualifier()) ? "const " : "";
+                    auto pc = Count(func.parameters()) > 0 ? ", " : "";
+                    auto symbolName = Sanitize(child->uniqueName_);
+                    auto fullClassName = entity->uniqueName_;
+                    auto className = entity->name_;
+
                     if (func.is_virtual())
                     {
-                        printer_ << fmt("{{type}}(*fn{{symbol_name}})({{class_name}} {{const}}*{{#has_params}}, {{/has_params}}{{parameter_list}}) = nullptr;", vars);
+                        printer_ << fmt::format("{typeName}(*fn{symbolName})({className} {constModifier}*{pc}{parameterList}) = nullptr;",
+                            FMT_CAPTURE(typeName), FMT_CAPTURE(symbolName), FMT_CAPTURE(className),
+                            FMT_CAPTURE(constModifier), FMT_CAPTURE(pc), FMT_CAPTURE(parameterList));
                         // Virtual method that calls said pointer
-                        printer_ << fmt("{{type}} {{name}}({{parameter_list}}) {{const}}override", vars);
+                        printer_ << fmt::format("{typeName} {name}({parameterList}) {constModifier}override",
+                            FMT_CAPTURE(typeName), FMT_CAPTURE(name), FMT_CAPTURE(parameterList),
+                            FMT_CAPTURE(constModifier));
                         printer_.Indent();
                         {
-                            printer_ << fmt("if (fn{{symbol_name}} == nullptr)", vars);
+                            printer_ << fmt::format("if (fn{symbolName} == nullptr)", FMT_CAPTURE(symbolName));
                             printer_.Indent();
                             {
-                                printer_ << fmt("{{full_class_name}}::{{name}}({{parameter_name_list}});", vars);
+                                printer_ << fmt::format("{fullClassName}::{name}({parameterNameList});",
+                                    FMT_CAPTURE(fullClassName), FMT_CAPTURE(name), FMT_CAPTURE(parameterNameList));
                             }
                             printer_.Dedent();
                             printer_ << "else";
                             printer_.Indent();
                             {
-                                printer_ << fmt("{{return}}(fn{{symbol_name}})(this{{#has_params}}, {{/has_params}}{{parameter_name_list}});", vars);
+                                printer_ << (IsVoid(func.return_type()) ? "" : "return ") +
+                                    fmt::format("(fn{symbolName})(this{pc}{parameterNameList});",
+                                        FMT_CAPTURE(symbolName), FMT_CAPTURE(pc), FMT_CAPTURE(parameterNameList));
                             }
                             printer_.Dedent();

@@ -163,9 +160,11 @@
                     }
                     else if (child->access_ == cppast::cpp_protected) // Protected virtuals are not exposed, no point
                     {
-                        printer_ << fmt("{{type}} __public_{{name}}({{parameter_list}})", vars);
+                        printer_ << fmt::format("{typeName} __public_{name}({parameterList})",
+                            FMT_CAPTURE(typeName), FMT_CAPTURE(name), FMT_CAPTURE(parameterList));
                         printer_.Indent();
-                        printer_ << fmt("{{name}}({{parameter_name_list}});", vars);
+                        printer_ << fmt::format("{name}({parameterNameList});", FMT_CAPTURE(name),
+                            FMT_CAPTURE(parameterNameList));
                         printer_.Dedent();
                     }
                 }


generalize projection function; move distance functions to global namespace

--- src/move_base_node.cpp
+++ src/move_base_node.cpp
@@ -44,23 +44,23 @@

 #include <pcl_conversions/pcl_conversions.h>

-namespace pcl
-{
-    template<typename PointA, typename PointB>
-    double sqdist(const PointA& a, const PointB& b)
-    {
-        double dx = a.x - b.x;
-        double dy = a.y - b.y;
-        double dz = a.z - b.z;
-        return dx * dx + dy * dy + dz * dz;
-    }
-
-    template<typename PointA, typename PointB>
-    double dist(const PointA& a, const PointB& b)
-    {
-        return sqrt(sqdist(a, b));
-    }
-}
+
+template<typename PointA, typename PointB>
+double sqdist(const PointA& a, const PointB& b)
+{
+    double dx = a.x - b.x;
+    double dy = a.y - b.y;
+    double dz = a.z - b.z;
+    return dx * dx + dy * dy + dz * dz;
+}
+
+
+template<typename PointA, typename PointB>
+double dist(const PointA& a, const PointB& b)
+{
+    return sqrt(sqdist(a, b));
+}
+

 class MoveBase
 {
@@ -95,6 +95,7 @@
     void onNavigationFunctionChange(const sensor_msgs::PointCloud2::ConstPtr& msg);
     void onGoal(const geometry_msgs::PointStamped::ConstPtr& msg);
     void onGoal(const geometry_msgs::PoseStamped::ConstPtr& msg);
+    int projectPositionToNavigationFunction(const geometry_msgs::Point& pos);
     void projectGoalPositionToNavigationFunction();
     bool getRobotPose();
     double positionError();
@@ -207,23 +208,33 @@
 }

-void MoveBase::projectGoalPositionToNavigationFunction()
-{
-    pcl::PointXYZI goal;
-    goal.x = goal_.pose.position.x;
-    goal.y = goal_.pose.position.y;
-    goal.z = goal_.pose.position.z;
+int MoveBase::projectPositionToNavigationFunction(const geometry_msgs::Point& pos)
+{
+    pcl::PointXYZI p;
+    p.x = pos.x;
+    p.y = pos.y;
+    p.z = pos.z;
     std::vector<int> pointIdx;
     std::vector<float> pointDistSq;
     if(navfn_octree_ptr_->nearestKSearch(goal, 1, pointIdx, pointDistSq) < 1)
     {
+        return -1;
+    }
+    return pointIdx[0];
+}
+
+
+void MoveBase::projectGoalPositionToNavigationFunction()
+{
+    int goal_index = projectPositionToNavigationFunction(goal_.pose.position);
+    if(goal_index == -1)
+    {
         ROS_ERROR("Failed to project goal position to navfn pcl");
         return;
     }
-    int i = pointIdx[0];
-    goal_.pose.position.x = navfn_[i].x;
-    goal_.pose.position.y = navfn_[i].y;
-    goal_.pose.position.z = navfn_[i].z;
+    goal_.pose.position.x = navfn_[goal_index].x;
+    goal_.pose.position.y = navfn_[goal_index].y;
+    goal_.pose.position.z = navfn_[goal_index].z;
 }


Silent warnings reported by Clang

Silent warnings reported by Clang

Signed-off-by: Fs <3f4bb586f04a0c1d93eadab9363a8a3183b4860c@FsdeMacBook-Air.local>

--- Functions.cpp
+++ Functions.cpp
@@ -281,7 +281,7 @@
         "           to \"%s\".\n",
         oldFileName, newFileName);

-    if (!rename(oldFileName, newFileName) == 0) {
+    if (rename(oldFileName, newFileName) != 0) {
         LOG_E("Error renaming file \"%s\" to \"%s\". Error %i.\n",
             oldFileName, newFileName, errno);
         return false;


Enhance printing with size capabilities

Enhance printing with size capabilities

--- src/mtac/Quadruple.cpp
+++ src/mtac/Quadruple.cpp
@@ -198,6 +198,21 @@
     }
 }

+std::string size(mtac::Size size){
+    switch(size){
+        case mtac::Size::DEFAULT:
+            return "";
+        case mtac::Size::BYTE:
+            return " (byte)";
+        case mtac::Size::WORD:
+            return " (word)";
+        case mtac::Size::DOUBLE_WORD:
+            return " (dword)";
+        case mtac::Size::QUAD_WORD:
+            return " (qword)";
+    }
+}
+
 }

 std::ostream& eddic::mtac::operator<<(std::ostream& stream, const mtac::Quadruple& quadruple){
@@ -285,7 +300,7 @@
             stream << "\t" << quadruple.result << " = (cast int) " << *quadruple.arg1 << " : "<< quadruple.depth;
             break;
         case mtac::Operator::DOT:
-            stream << "\t" << quadruple.result << " = (normal) (" << *quadruple.arg1 << ")" << *quadruple.arg2 << " : "<< quadruple.depth;
+            stream << "\t" << quadruple.result << " = (normal)" << size(quadruple.size) << " (" << *quadruple.arg1 << ")" << *quadruple.arg2 << " : "<< quadruple.depth;
             break;
         case mtac::Operator::FDOT:
             stream << "\t" << quadruple.result << " = (float) (" << *quadruple.arg1 << ")" << *quadruple.arg2 << " : "<< quadruple.depth;
@@ -294,7 +309,7 @@
             stream << "\t" << quadruple.result << " = (pointer) (" << *quadruple.arg1 << ")" << *quadruple.arg2 << " : "<< quadruple.depth;
             break;
         case mtac::Operator::DOT_ASSIGN:
-            stream << "\t" << "(" << quadruple.result << ")" << *quadruple.arg1 << " = (normal) " << *quadruple.arg2 << " : "<< quadruple.depth;
+            stream << "\t" << "(" << quadruple.result << ")" << *quadruple.arg1 << " = (normal)" << size(quadruple.size) << " " << *quadruple.arg2 << " : "<< quadruple.depth;
             break;
         case mtac::Operator::DOT_FASSIGN:
             stream << "\t" << "(" << quadruple.result << ")" << *quadruple.arg1 << " = (float) " << *quadruple.arg2 << " : "<< quadruple.depth;


qe_lite> fix crash in is_var_eq()
(by me & Nikolaj)

Signed-off-by: Nuno Lopes <51e5d1eaeb8b342ba5960787a7112180a123b495@microsoft.com>

--- src/muz_qe/qe_lite.cpp
+++ src/muz_qe/qe_lite.cpp
@@ -201,9 +201,15 @@
             return (*m_is_variable)(e);
         }

-        bool is_neg_var(ast_manager & m, expr * e) {
+        bool is_neg_var(ast_manager & m, expr * e, var*& v) {
             expr* e1;
-            return m.is_not(e, e1) && is_variable(e1);
+            if (m.is_not(e, e1) && is_variable(e1)) {
+                v = to_var(e1);
+                return true;
+            }
+            else {
+                return false;
+            }
         }

@@ -328,18 +334,19 @@

         bool is_var_eq(expr * e, ptr_vector<var>& vs, expr_ref_vector & ts) {
             expr* lhs, *rhs;
+            var* v;

             // (= VAR t), (iff VAR t), (iff (not VAR) t), (iff t (not VAR)) cases
             if (m.is_eq(e, lhs, rhs) || m.is_iff(e, lhs, rhs)) {
                 // (iff (not VAR) t) (iff t (not VAR)) cases
                 if (!is_variable(lhs) && !is_variable(rhs) && m.is_bool(lhs)) {
-                    if (!is_neg_var(m, lhs)) {
+                    if (!is_neg_var(m, lhs, v)) {
                         std::swap(lhs, rhs);
                     }
-                    if (!is_neg_var(m, lhs)) {
+                    if (!is_neg_var(m, lhs, v)) {
                         return false;
                     }
-                    vs.push_back(to_var(lhs));
+                    vs.push_back(v);
                     ts.push_back(m.mk_not(rhs));
                     TRACE("qe_lite", tout << mk_pp(e, m) << "\n";);
                     return true;
@@ -378,9 +385,9 @@
             }

             // VAR = false case
-            if (is_neg_var(m, e)) {
+            if (is_neg_var(m, e, v)) {
                 ts.push_back(m.mk_false());
-                vs.push_back(to_var(to_app(e)->get_arg(0)));
+                vs.push_back(v);
                 TRACE("qe_lite", tout << mk_pp(e, m) << "\n";);
                 return true;
             }


Fix incorrect OS masking

Fix incorrect OS masking

Summary: Need to actually `#ifdef` the content of a "public" method. Follow-up for {D24660475 (https://github.com/facebook/redex/commit/0b81ca45429f901b7d3c243b055222b0864789f1)}.

Reviewed By: yuxuanchen1997

Differential Revision: D24744379

fbshipit-source-id: 48e8589927e5c94631703c60ecbd1b6c46b087ac

--- libredex/PassManager.cpp
+++ libredex/PassManager.cpp
@@ -588,7 +588,11 @@
 #endif
   }

-  void wait() { check_open_jobs(/*no_hang=*/false); }
+  void wait() {
+#ifdef __linux__
+    check_open_jobs(/*no_hang=*/false);
+#endif
+  }

  private:
 #ifdef __linux__


Fixed occurrences of 'static variable' that should have been
'static int variable'.  The former breaks on GCC (at least, on version 2.95).

git-svn-id: 28d9401aa571d5108e51b194aae6f24ca5964c06@2994 8cc4aa7f-3514-0410-904f-f2cc9021211c

--- libs/csterr/ddgnoise.cpp
+++ libs/csterr/ddgnoise.cpp
@@ -111,7 +111,7 @@
 #define NP 12   /* 2^N */
 #define NM 0xfff

-static p[B + B + 2];
+static int p[B + B + 2];
 static double g3[B + B + 2][3];
 static double g2[B + B + 2][2];
 static double g1[B + B + 2];
@@ -154,7 +154,7 @@
 {
 	int bx0, bx1, by0, by1, b00, b10, b01, b11;
 	double rx0, rx1, ry0, ry1, *q, sx, sy, a, b, t, u, v;
-	register i, j;
+	register int i, j;

 	if (start) {
 		init();
@@ -191,7 +191,7 @@
 {
 	int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11;
 	double rx0, rx1, ry0, ry1, rz0, rz1, *q, sy, sz, a, b, c, d, t, u, v;
-	register i, j;
+	register int i, j;

 	if (start) {
 		init();
@@ -682,4 +682,4 @@
 //printf("sum %f, weight %f\n", sum, weight);
   return sum/weight;
 //printf("returning\n");
-}+}


method calls comments

method calls comments

--- NativeExample.cpp
+++ NativeExample.cpp
@@ -14,11 +14,11 @@
     std::cout<<"found class"<<std::endl;
   }

-  // use javap -s Abc to find methog signatures
+  // use javap -s Abc to find method signatures
   jmethodID constructor = env->GetMethodID(classObject,"<init>","()V");
   jobject object = env->NewObject(classObject, constructor);

-  // use javap -s Abc to find methog signatures
+  // use javap -s Abc to find method signatures
   jmethodID method1Object = env->GetMethodID(classObject,"method1","(I)V");
   if(method1Object==0){
     std::cout<<"coudn't find method"<<std::endl;


[SAFS]: don't set NUMA bind policy strict.

--- libsafs/io_interface.cpp
+++ libsafs/io_interface.cpp
@@ -180,8 +180,6 @@

 	params.init(configs->get_options());
 	params.print();
-
-	numa_set_bind_policy(1);
 	thread::thread_class_init();

 	// The I/O system has been initialized.


fix inv check that bitcoin messed up

fix inv check that bitcoin messed up

we have more inv's than just blocks/txs so we need to store tx_process_time based on CInv and not uint256. So when messages are sent it should have the inv there to check instead of recreating it.

Former-commit-id: c6c982f1382ab4d9e76f4375243c5a8b71f90c0c

--- src/net_processing.cpp
+++ src/net_processing.cpp
@@ -345,7 +345,8 @@
         /* Track when to attempt download of announced transactions (process
          * time in micros -> txid)
          */
-        std::multimap<int64_t, uint256> m_tx_process_time;
+        // SYSCOIN
+        std::multimap<int64_t, CInv> m_tx_process_time;

         //! Store all the transactions a peer has recently announced
         std::set<uint256> m_tx_announced;
@@ -697,18 +698,19 @@
         g_already_asked_for.update(it, request_time);
     }
 }
-void RequestTx(CNodeState* state, const uint256& txid, int64_t nNow) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
+// SYSCOIN
+void RequestTx(CNodeState* state, const CInv& inv, int64_t nNow) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 {
     CNodeState::TxDownloadState& peer_download_state = state->m_tx_download;
-    if (peer_download_state.m_tx_announced.size() >= MAX_PEER_TX_ANNOUNCEMENTS || peer_download_state.m_tx_announced.count(txid)) {
+    if (peer_download_state.m_tx_announced.size() >= MAX_PEER_TX_ANNOUNCEMENTS || peer_download_state.m_tx_announced.count(inv.hash)) {
         // Too many queued announcements from this peer, or we already have
         // this announcement
         return;
     }
-    peer_download_state.m_tx_announced.insert(txid);
+    peer_download_state.m_tx_announced.insert(inv.hash);

     int64_t process_time;
-    int64_t last_request_time = GetTxRequestTime(txid);
+    int64_t last_request_time = GetTxRequestTime(inv.hash);
     // First time requesting this tx
     if (last_request_time == 0) {
         process_time = nNow;
@@ -721,7 +723,7 @@
     // We delay processing announcements from non-preferred (eg inbound) peers
     if (!state->fPreferredDownload) process_time += INBOUND_PEER_TX_DELAY;

-    peer_download_state.m_tx_process_time.emplace(process_time, txid);
+    peer_download_state.m_tx_process_time.emplace(process_time, inv);
 }
 } // namespace
 /// SYSCOIN
@@ -738,7 +740,7 @@
 }
 void RequestInv(const CNode* pfrom, const CInv &inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 {
-    RequestTx(State(pfrom->GetId()), inv.hash, GetTimeMicros());
+    RequestTx(State(pfrom->GetId()), inv, GetTimeMicros());
 }
 // This function is used for testing the stale tip eviction logic, see
 // denialofservice_tests.cpp
@@ -2337,7 +2339,8 @@
                 if (fBlocksOnly) {
                     LogPrint(BCLog::NET, "transaction (%s) inv sent in violation of protocol peer=%d\n", inv.hash.ToString(), pfrom->GetId());
                 } else if (!fAlreadyHave && !fImporting && !fReindex && !IsInitialBlockDownload()) {
-                    RequestTx(State(pfrom->GetId()), inv.hash, nNow);
+                    // SYSCOIN
+                    RequestTx(State(pfrom->GetId()), inv, nNow);
                 }
             }
         }
@@ -2638,7 +2641,8 @@
                 for (const CTxIn& txin : tx.vin) {
                     CInv _inv(MSG_TX | nFetchFlags, txin.prevout.hash);
                     pfrom->AddInventoryKnown(_inv);
-                    if (!AlreadyHave(_inv)) RequestTx(State(pfrom->GetId()), _inv.hash, nNow);
+                    // SYSCOIN
+                    if (!AlreadyHave(_inv)) RequestTx(State(pfrom->GetId()), _inv, nNow);
                 }
                 AddOrphanTx(ptx, pfrom->GetId());

@@ -4123,8 +4127,9 @@
         //
         auto& tx_process_time = state.m_tx_download.m_tx_process_time;
         while (!tx_process_time.empty() && tx_process_time.begin()->first <= nNow && state.m_tx_download.m_tx_in_flight.size() < MAX_PEER_TX_IN_FLIGHT) {
-            const uint256& txid = tx_process_time.begin()->second;
-            CInv inv(MSG_TX | GetFetchFlags(pto), txid);
+            // SYSCOIN
+            const CInv& inv = tx_process_time.begin()->second;
+            //CInv inv(MSG_TX | GetFetchFlags(pto), txid);
             if (!AlreadyHave(inv)) {
                 // If this transaction was last requested more than 1 minute ago,
                 // then request.
@@ -4143,7 +4148,8 @@
                     // up processing to happen after the download times out
                     // (with a slight delay for inbound peers, to prefer
                     // requests to outbound peers).
-                    RequestTx(&state, txid, nNow);
+                    // SYSCOIN
+                    RequestTx(&state, inv, nNow);
                 }
             } else {
                 // We have already seen this transaction, no need to download.


glViewer: exit when the window is closed

--- examples/glViewer/viewer.cpp
+++ examples/glViewer/viewer.cpp
@@ -1469,6 +1469,16 @@
 }

 //------------------------------------------------------------------------------
+#if GLFW_VERSION_MAJOR>=3
+int windowClose(GLFWwindow*) {
+#else
+int windowClose() {
+#endif
+    g_running = false;
+    return GL_TRUE;
+}
+
+//------------------------------------------------------------------------------
 static void
 toggleFullScreen() {
     // XXXX manuelk : to re-implement from glut
@@ -1800,6 +1810,9 @@
     glfwSetWindowSizeCallback(reshape);
 #endif

+    // kill the app when the window is closed
+    glfwSetWindowCloseCallback(windowClose);
+
 #if not defined(__APPLE__)
 #ifdef CORE_PROFILE
     // this is the only way to initialize glew correctly under core profile context.


[core#19724 6/9][refactor] Simplify check for block-relay-only connection.

Summary:
Previously we deduced it was a block-relay-only based on presence of the
m_tx_relay structure. Now we have the ability to identify it directly via a
connection type accessor function.

This is a backport of [[https://github.com/bitcoin/bitcoin/pull/19724 | core#19724]] [6/9]
https://github.com/bitcoin/bitcoin/pull/19724/commits/1e563aed785565af6b7aed7f7399c52205d8f19c

Depends on D9774

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, majcosta, Fabien

Reviewed By: #bitcoin_abc, majcosta, Fabien

Subscribers: majcosta

Differential Revision: https://reviews.bitcoinabc.org/D9775

--- src/net_processing.cpp
+++ src/net_processing.cpp
@@ -2464,9 +2464,8 @@
             }
         }

-        if (!pfrom.fDisconnect && pfrom.IsOutboundOrBlockRelayConn() &&
-            nodestate->pindexBestKnownBlock != nullptr &&
-            pfrom.m_tx_relay != nullptr) {
+        if (!pfrom.fDisconnect && pfrom.IsFullOutboundConn() &&
+            nodestate->pindexBestKnownBlock != nullptr) {
             // If this is an outbound full-relay peer, check to see if we should
             // protect it from the bad/lagging chain logic. Note that
             // block-relay-only peers are already implicitly protected, so we


Don't attempt to load with an empty filename

--- player.cpp
+++ player.cpp
@@ -90,6 +90,8 @@

 bool Player::Load(const std::string &filename)
 {
+	if (filename.length() == 0) return false;
+
 	try
 	{
 		this->au = std::unique_ptr<AudioOutput>(


Update NegativeBinomialRand.cpp

Update NegativeBinomialRand.cpp

--- variables/discrete/NegativeBinomialRand.cpp
+++ variables/discrete/NegativeBinomialRand.cpp
@@ -85,6 +85,15 @@
 }

 template< typename T >
+std::complex<double> NegativeBinomialRand<T>::CF(double t) const
+{
+    double numerator = 1 - p;
+    std::complex denominator(0, t);
+    denominator = 1 - p * std::exp(denominator);
+    return std::pow(numerator / denominator, r);
+}
+
+template< typename T >
 double NegativeBinomialRand<T>::Mode() const
 {
     return (r > 1) ? std::floor((r - 1) * p / (1 - p)) : 0;


Improve TRCs in timeout estimation

Improve TRCs in timeout estimation

--- Dpa/DpaTransaction2.cpp
+++ Dpa/DpaTransaction2.cpp
@@ -455,7 +455,7 @@
   // we will need other network structure info for FRC evaluation
 int32_t DpaTransaction2::EstimateStdTimeout( uint8_t hopsRequest, uint8_t timeslotReq, uint8_t hopsResponse, int8_t responseDataLength )
 {
-  TRC_FUNCTION_ENTER( "" );
+  TRC_FUNCTION_ENTER( PAR((int)hopsRequest) << PAR((int)timeslotReq) << PAR((int)hopsResponse) << PAR((int)responseDataLength) );
   int32_t responseTimeSlotLengthMs;

   auto estimatedTimeoutMs = ( hopsRequest + 1 ) * timeslotReq * 10;
@@ -501,7 +501,7 @@

 int32_t DpaTransaction2::EstimateLpTimeout( uint8_t hopsRequest, uint8_t timeslotReq, uint8_t hopsResponse, int8_t responseDataLength )
 {
-  TRC_FUNCTION_ENTER( "" );
+  TRC_FUNCTION_ENTER( PAR((int)hopsRequest) << PAR((int)timeslotReq) << PAR((int)hopsResponse) << PAR((int)responseDataLength) );
   int32_t responseTimeSlotLengthMs;

   auto estimatedTimeoutMs = ( hopsRequest + 1 ) * timeslotReq * 10;


refactor: Use Mutex type for g_cs_recent_confirmed_transactions

Summary: This is a backport of [[https://github.com/bitcoin/bitcoin/pull/19378 | core#19378]]

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, deadalnix, majcosta

Reviewed By: #bitcoin_abc, deadalnix, majcosta

Differential Revision: https://reviews.bitcoinabc.org/D9448

--- src/net_processing.cpp
+++ src/net_processing.cpp
@@ -296,7 +296,7 @@
  * We use this to avoid requesting transactions that have already been
  * confirmed.
  */
-RecursiveMutex g_cs_recent_confirmed_transactions;
+Mutex g_cs_recent_confirmed_transactions;
 std::unique_ptr<CRollingBloomFilter> g_recent_confirmed_transactions
     GUARDED_BY(g_cs_recent_confirmed_transactions);


fix missing parameter check

fix missing parameter check

--- playpen.cc
+++ playpen.cc
@@ -217,7 +217,7 @@
         }
     }

-    if (optind == 1) {
+    if (optind == argc) {
         usage(stderr);
     }


Print ObjC methods of ObjC classes.

Print ObjC methods of ObjC classes.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@50779 91177308-0d34-0410-b5e6-96231b3b80d8

--- Driver/ASTConsumers.cpp
+++ Driver/ASTConsumers.cpp
@@ -273,6 +273,14 @@
   for (ObjCInterfaceDecl::classprop_iterator I = OID->classprop_begin(),
        E = OID->classprop_end(); I != E; ++I)
     PrintObjCPropertyDecl(*I);
+
+  for (ObjCInterfaceDecl::classmeth_iterator I = OID->classmeth_begin(),
+       E = OID->classmeth_end(); I != E; ++I)
+    PrintObjCMethodDecl(*I);
+
+  for (ObjCInterfaceDecl::instmeth_iterator I = OID->instmeth_begin(),
+       E = OID->instmeth_end(); I != E; ++I)
+    PrintObjCMethodDecl(*I);

   Out << "@end\n";
   // FIXME: implement the rest...


Fixed bad whitespace

Fixed bad whitespace

Change-Id: I1518bb843be6f20bc5f3dc5a55777ca5319335c8

--- Rendering/Core/vtkRenderWindow.cxx
+++ Rendering/Core/vtkRenderWindow.cxx
@@ -1341,12 +1341,12 @@
             *left++ = *leftTemp++;
             *left++ = *leftTemp++;
             }
-        }
+        }

       for (int y = 0; y <= (size[1] - 1); y = y + 1)
         {
           for (int x = 0; x < midX; x = x + 1)
-            {
+            {
             left = sleft + (x + offsetX) * 3 + y * size[0] * 3;
             right = sright + (2 * x) * 3 + y * size[0] * 3;
             *left++ = *right++;


[#2436] incorrect keyword for xmsg port

[#2436] incorrect keyword for xmsg port

--- iRODS/lib/core/src/irods_server_properties.cpp
+++ iRODS/lib/core/src/irods_server_properties.cpp
@@ -587,7 +587,7 @@

         if( 0 != env.xmsgPort ) {
             result = config_props_.set<int>(
-                         irods::CFG_ZONE_PORT,
+                         irods::CFG_XMSG_PORT,
                          env.xmsgPort );
             if( !result.ok() ) {
                 irods::log( PASS( result ) );


Track orphan by prev COutPoint rather than prev hash

--- src/net_processing.cpp
+++ src/net_processing.cpp
@@ -22,13 +22,22 @@

 static const uint64_t RANDOMIZER_ID_ADDRESS_RELAY = 0x3cac0035b5866b90ULL; // SHA256("main address relay")[0:8]

+struct IteratorComparator
+{
+    template<typename I>
+    bool operator()(const I& a, const I& b) const
+    {
+        return &(*a) < &(*b);
+    }
+};
+
 struct COrphanTx {
     CTransactionRef tx;
     NodeId fromPeer;
 };

 std::map<uint256, COrphanTx> mapOrphanTransactions GUARDED_BY(cs_main);
-std::map<uint256, std::set<uint256> > mapOrphanTransactionsByPrev GUARDED_BY(cs_main);
+std::map<COutPoint, std::set<std::map<uint256, COrphanTx>::iterator, IteratorComparator>> mapOrphanTransactionsByPrev GUARDED_BY(cs_main);

 void EraseOrphansFor(NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(cs_main);

@@ -511,28 +520,30 @@

     auto ret = mapOrphanTransactions.emplace(hash, COrphanTx{tx, peer});
     assert(ret.second);
-    for (const CTxIn& txin : tx->vin)
-        mapOrphanTransactionsByPrev[txin.prevout.hash].insert(hash);
-
-    LogPrint(BCLog::MEMPOOL, "stored orphan tx %s (mapsz %u prevsz %u)\n", hash.ToString(),
+    for (const CTxIn& txin : tx->vin) {
+        mapOrphanTransactionsByPrev[txin.prevout].insert(ret.first);
+    }
+
+    LogPrint(BCLog::MEMPOOL, "stored orphan tx %s (mapsz %u outsz %u)\n", hash.ToString(),
         mapOrphanTransactions.size(), mapOrphanTransactionsByPrev.size());
     return true;
 }

-void static EraseOrphanTx(uint256 hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
+int static EraseOrphanTx(uint256 hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 {
     std::map<uint256, COrphanTx>::iterator it = mapOrphanTransactions.find(hash);
     if (it == mapOrphanTransactions.end())
-        return;
+        return 0;
     for (const CTxIn& txin : it->second.tx->vin) {
-        std::map<uint256, std::set<uint256> >::iterator itPrev = mapOrphanTransactionsByPrev.find(txin.prevout.hash);
+        auto itPrev = mapOrphanTransactionsByPrev.find(txin.prevout);
         if (itPrev == mapOrphanTransactionsByPrev.end())
             continue;
-        itPrev->second.erase(hash);
+        itPrev->second.erase(it);
         if (itPrev->second.empty())
             mapOrphanTransactionsByPrev.erase(itPrev);
     }
     mapOrphanTransactions.erase(it);
+    return 1;
 }

 void EraseOrphansFor(NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
@@ -542,8 +553,7 @@
     while (iter != mapOrphanTransactions.end()) {
         std::map<uint256, COrphanTx>::iterator maybeErase = iter++; // increment to avoid iterator becoming invalid
         if (maybeErase->second.fromPeer == peer) {
-            EraseOrphanTx(maybeErase->second.tx->GetHash());
-            ++nErased;
+            nErased += EraseOrphanTx(maybeErase->second.tx->GetHash());
         }
     }
     if (nErased > 0) LogPrint(BCLog::MEMPOOL, "Erased %d orphan tx from peer %d\n", nErased, peer);
@@ -1413,7 +1423,7 @@

     else if (strCommand == NetMsgType::TX) {
-        std::vector<uint256> vWorkQueue;
+        std::deque<COutPoint> vWorkQueue;
         std::vector<uint256> vEraseQueue;
         CTransaction tx(deserialize, vRecv);
         CTransactionRef ptx = MakeTransactionRef(tx);
@@ -1433,7 +1443,9 @@
         if (!tx.HasZerocoinSpendInputs() && AcceptToMemoryPool(mempool, state, ptx, true, &fMissingInputs, false, ignoreFees)) {
             mempool.check(pcoinsTip);
             RelayTransaction(tx, connman);
-            vWorkQueue.push_back(inv.hash);
+            for (unsigned int i = 0; i < tx.vout.size(); i++) {
+                vWorkQueue.emplace_back(inv.hash, i);
+            }

             LogPrint(BCLog::MEMPOOL, "%s : peer=%d %s : accepted %s (poolsz %u txn, %u kB)\n",
                     __func__, pfrom->id, pfrom->cleanSubVer, tx.GetHash().ToString(),
@@ -1441,16 +1453,17 @@

             // Recursively process any orphan transactions that depended on this one
             std::set<NodeId> setMisbehaving;
-            for(unsigned int i = 0; i < vWorkQueue.size(); i++) {
-                std::map<uint256, std::set<uint256> >::iterator itByPrev = mapOrphanTransactionsByPrev.find(vWorkQueue[i]);
+            while (!vWorkQueue.empty()) {
+                auto itByPrev = mapOrphanTransactionsByPrev.find(vWorkQueue.front());
+                vWorkQueue.pop_front();
                 if(itByPrev == mapOrphanTransactionsByPrev.end())
                     continue;
-                for(std::set<uint256>::iterator mi = itByPrev->second.begin();
+                for (auto mi = itByPrev->second.begin();
                     mi != itByPrev->second.end();
                     ++mi) {
-                    const uint256 &orphanHash = *mi;
-                    const auto &orphanTx = mapOrphanTransactions[orphanHash].tx;
-                    NodeId fromPeer = mapOrphanTransactions[orphanHash].fromPeer;
+                    const CTransactionRef& orphanTx = (*mi)->second.tx;
+                    const uint256& orphanHash = orphanTx->GetHash();
+                    NodeId fromPeer = (*mi)->second.fromPeer;
                     bool fMissingInputs2 = false;
                     // Use a dummy CValidationState so someone can't setup nodes to counter-DoS based on orphan
                     // resolution (that is, feeding people an invalid transaction based on LegitTxX in order to get
@@ -1463,7 +1476,9 @@
                     if(AcceptToMemoryPool(mempool, stateDummy, orphanTx, true, &fMissingInputs2)) {
                         LogPrint(BCLog::MEMPOOL, "   accepted orphan tx %s\n", orphanHash.ToString());
                         RelayTransaction(*orphanTx, connman);
-                        vWorkQueue.push_back(orphanHash);
+                        for (unsigned int i = 0; i < orphanTx->vout.size(); i++) {
+                            vWorkQueue.emplace_back(orphanHash, i);
+                        }
                         vEraseQueue.push_back(orphanHash);
                     } else if(!fMissingInputs2) {
                         int nDos = 0;


INTEGRATION: CWS dr4 (1.23.8); FILE MERGED 2003/06/02 10:18:18 dr 1.23.8.1: #i9134# fixed BESSEL J and I calculation

--- scaddins/source/analysis/analysishelper.hxx
+++ scaddins/source/analysis/analysishelper.hxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: analysishelper.hxx,v $
  *
- *  $Revision: 1.23 $
- *
- *  last change: $Author: hr $ $Date: 2003-04-28 15:14:40 $
+ *  $Revision: 1.24 $
+ *
+ *  last change: $Author: vg $ $Date: 2003-06-04 10:31:56 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -151,13 +151,6 @@
 double              GammaHelp( double& x, sal_Bool& bReflect );
 double              Gamma( double f );
 double              GammaN( double f, sal_uInt32 nIter );
-double              Bessel( double fNum, sal_Int32 nOrder, sal_Bool bModfied ) THROWDEF_RTE_IAE;
-double              Besselk0( double fNum );
-double              Besselk1( double fNum );
-double              Besselk( double fNum, sal_Int32 nOrder );
-double              Bessely0( double fNum );
-double              Bessely1( double fNum );
-double              Bessely( double fNum, sal_Int32 nOrder );
 double              ConvertToDec( const STRING& rFromNum, sal_uInt16 nBaseFrom, sal_uInt16 nCharLim ) THROWDEF_RTE_IAE;
 STRING              ConvertFromDec(
                         sal_Int64 nNum, sal_Int64 nMin, sal_Int64 nMax, sal_uInt16 nBase,
@@ -703,7 +696,7 @@

 inline sal_Int16 GetDayOfWeek( sal_Int32 n )
 {   // monday = 0, ..., sunday = 6
-    return ( n - 1 ) % 7;
+    return static_cast< sal_Int16 >( ( n - 1 ) % 7 );
 }


Clear m_addr_known before our periodic self-advertisement

This behavior was apparently inadvertently broken in 5400ef6; without this
change our daily self-announcements frequently go unsent, because our
address is still in the peer's rolling bloom filter (for potentially many
days, depending on addr traffic).

--- src/net_processing.cpp
+++ src/net_processing.cpp
@@ -4074,6 +4074,15 @@
         auto current_time = GetTime<std::chrono::microseconds>();

         if (pto->RelayAddrsWithConn() && !::ChainstateActive().IsInitialBlockDownload() && pto->m_next_local_addr_send < current_time) {
+            // If we've sent before, clear the bloom filter for the peer, so that our
+            // self-announcement will actually go out.
+            // This might be unnecessary if the bloom filter has already rolled
+            // over since our last self-announcement, but there is only a small
+            // bandwidth cost that we can incur by doing this (which happens
+            // once a day on average).
+            if (pto->m_next_local_addr_send != std::chrono::microseconds::zero()) {
+                pto->m_addr_known->reset();
+            }
             AdvertiseLocal(pto);
             pto->m_next_local_addr_send = PoissonNextSend(current_time, AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL);
         }


(new:minor) Improved doc for bsearch_find method

--- inc/dcs/math/curvefit/interpolation/base1d.hpp
+++ inc/dcs/math/curvefit/interpolation/base1d.hpp
@@ -259,7 +259,25 @@
 		return n_-1;
 	}

-	/// Locate a given value by binary search
+	/**
+	 * Locate a given value by binary search
+	 *
+	 * The resulting index \c j is guaranteed to be strictly less than the max
+	 * number of nodes and greater than or equal to 0, so that the implicit bracket
+	 * <code>[j,j+1]</code> always corresponds to a region within the implicit value
+	 * range of the value array.
+	 *
+	 * Specifically, suppose the node array is
+	 * \f$k=\{k_0, k_1, \ldots, k_m\}\f$, the index returned by this
+	 * function is:
+	 * \f{equation}
+	 * \begin{cases}
+	 * 0, & x \le k_0,\\
+	 * j, & x > k_{j-1} && x \le k_j,\\
+	 * m-1, & x \ge k_m,\\
+	 * \end{cases}
+	 * \f}
+	 */
 	protected: ::std::size_t bsearch_find(real_type x) const
 	{
 		// Handle out-of-domain points


Resolve references across model boundaries by looking in libraries

--- ModelBase/src/nodes/Node.cpp
+++ ModelBase/src/nodes/Node.cpp
@@ -31,6 +31,7 @@
 #include "ModelException.h"
 #include "Reference.h"
 #include "Core/src/AdapterManager.h"
+#include "UsedLibrary.h"

 using namespace Logger;

@@ -201,6 +202,15 @@

 		if ((exhaustAllScopes || !found) && parent_)
 			found = parent_->findSymbols(result, matcher, source, SEARCH_UP, symbolTypes, exhaustAllScopes) || found;
+
+		// Search in libraries. This is only valid for root nodes
+		if ((exhaustAllScopes || !found) && !parent_)
+			for(auto l : usedLibraries())
+			{
+				auto libRoot = l->libraryRoot();
+				Q_ASSERT(libRoot);
+				found = libRoot->findSymbols(result, matcher, libRoot, SEARCH_DOWN, symbolTypes, exhaustAllScopes) || found;
+			}
 	}

 	return found;


Update pluse input

Update pluse input

--- PLUSE_OUT_LCD/main.cpp
+++ PLUSE_OUT_LCD/main.cpp
@@ -123,7 +123,7 @@

 		reinterpret_cast<void*>(null_task_),	nullptr,	// (20)
 		reinterpret_cast<void*>(null_task_),	nullptr,	// (21) /INT2
-		reinterpret_cast<void*>(timer_j_.itask_out),nullptr,	// (22) タイマＲＪ２
+		reinterpret_cast<void*>(timer_j_.iout),	nullptr,	// (22) タイマＲＪ２
 		reinterpret_cast<void*>(null_task_),	nullptr,	// (23) 周期タイマ

 		reinterpret_cast<void*>(timer_b_.itask),nullptr,	// (24) タイマＲＢ２


Partial layout for auto_reflection_class

--- include/asmith/reflection/reflection_class.hpp
+++ include/asmith/reflection/reflection_class.hpp
@@ -14,6 +14,8 @@
 #include <type_traits>
 #include <cstdint>
 #include <string>
+#include <memory>
+#include <vector>

 #ifndef ASMITH_REFLECTION_CLASS_HPP
 #define ASMITH_REFLECTION_CLASS_HPP
@@ -42,7 +44,75 @@
 		virtual const reflection_class& get_parent_class(size_t) const = 0;
 	};

-	template<class C, class T>
-	using reflection_variable_ptr = T C::*;
+	class auto_reflection_class : public reflection_class {
+	private:
+		std::vector<std::shared_ptr<reflection_class>> mParents;
+		std::vector<std::shared_ptr<reflection_constructor>> mConstructors;
+		std::vector<std::shared_ptr<reflection_variable>> mVariables;
+		std::vector<std::shared_ptr<reflection_function>> mFunctions;
+		std::shared_ptr<reflection_destructor> mDestructor;
+		const std::string mName;
+		const size_t mSize;
+	public:
+		auto_reflection_class(const std::string& aName, const size_t aSize) :
+			mName(aName),
+			mSize(aSize)
+		{}
+
+		//! \todo Add parent_classes, constructors, variables and destructor
+
+		template<class CLASS, class RETURN, class... PARAMS>
+		auto_reflection_class& function(const std::string& aName, RETURN(CLASS::*aPtr)(PARAMS...), const size_t aModifiers) {
+			mFunctions.push_back(std::shared_ptr<reflection_function>(
+				new typedef auto_reflection_function<CLASS, RETURN, PARAMS...>(aName, aPtr, aModifiers);
+			));
+			return *this;
+		}
+
+		// Inherited from reflection_class
+		const char* get_name() const override {
+			mName.c_str();
+		}
+
+		size_t get_size() const override {
+			return mSize;
+		}
+
+		size_t get_variable_count() const override {
+			return mVariables.size();
+		}
+
+		const reflection_variable& get_variable(size_t aIndex) const override {
+			return *mVariables[aIndex];
+		}
+
+		size_t get_function_count() const override {
+			return mFunctions.size();
+		}
+
+		const reflection_function& get_function(size_t aIndex) const override {
+			return *mFunctions[aIndex];
+		}
+
+		size_t get_constructor_count() const override {
+			return mConstructors.size();
+		}
+
+		const reflection_constructor& get_constructor(size_t aIndex) const override {
+			return *mConstructors[aIndex];
+		}
+
+		const reflection_destructor& get_destructor() const override {
+			return *mDestructor;
+		}
+
+		size_t get_parent_count() const override {
+			return mParents.size();
+		}
+
+		const reflection_class& get_parent_class(size_t aIndex) const override {
+			return *mParents[aIndex];
+		}
+	};
 }
 #endif


C'est bon on peut cliquer partout sur le QListItemWidget sans problèmes ! Note à moi même : pour les QListView, pressed >>>>> clicked !

--- fenetre.cpp
+++ fenetre.cpp
@@ -1,7 +1,7 @@
 #include "fenetre.h"
 #include "ui_fenetre.h"
 #include "fileManagement.h"
-//#include <QMessageBox>
+#include <QMessageBox>

 Fenetre::Fenetre(QWidget *parent) : QMainWindow(parent), ui(new Ui::Fenetre)
 {
@@ -49,13 +49,13 @@
         ui->DRunelist->setItemWidget(item,wi);
     }

-    connect(ui->DRunelist,SIGNAL(clicked(QModelIndex)),this,SLOT(ajouteBonneList(QModelIndex))); //on connecte pour que quand on clique on ajoute la rune.
+    connect(ui->DRunelist,SIGNAL(pressed(QModelIndex)),this,SLOT(ajouteBonneList(QModelIndex))); //on connecte pour que quand on clique on ajoute la rune.

     //on connecte pour qu'on pouisse supprimer les runes des petites listes
-    connect(ui->MarquesList,SIGNAL(clicked(QModelIndex)),this,SLOT(supprimerMarque(QModelIndex)));
-    connect(ui->SceauxList,SIGNAL(clicked(QModelIndex)),this,SLOT(supprimerSceau(QModelIndex)));
-    connect(ui->GlyphesList,SIGNAL(clicked(QModelIndex)),this,SLOT(supprimerGlyphe(QModelIndex)));
-    connect(ui->QuintList,SIGNAL(clicked(QModelIndex)),this,SLOT(supprimerQuint(QModelIndex)));
+    connect(ui->MarquesList,SIGNAL(pressed(QModelIndex)),this,SLOT(supprimerMarque(QModelIndex)));
+    connect(ui->SceauxList,SIGNAL(pressed(QModelIndex)),this,SLOT(supprimerSceau(QModelIndex)));
+    connect(ui->GlyphesList,SIGNAL(pressed(QModelIndex)),this,SLOT(supprimerGlyphe(QModelIndex)));
+    connect(ui->QuintList,SIGNAL(pressed(QModelIndex)),this,SLOT(supprimerQuint(QModelIndex)));
 }

 Fenetre::~Fenetre()


nl_bond: update configured vlans when changing bond members

Make sure that any bond members added or removed get configured
according to the configured vlan interfaces on top of the bond.

Signed-off-by: Jonas Gorski <9712c064bde5a52658fc87d6454b4956f9bf286b@bisdn.de>

--- src/netlink/nl_bond.cc
+++ src/netlink/nl_bond.cc
@@ -269,6 +269,14 @@
       LOG(ERROR) << __FUNCTION__
                  << ": failed to set egress TPID entry for port "
                  << OBJ_CAST(link);
+  } else {
+    std::deque<uint16_t> vlans;
+
+    nl->get_vlans(rtnl_link_get_ifindex(bond), &vlans);
+    for (auto vid : vlans) {
+      swi->ingress_port_vlan_add(port_id, vid, false);
+      swi->egress_port_vlan_add(port_id, vid, false);
+    }
   }

   // XXX FIXME check for vlan interfaces
@@ -326,13 +334,22 @@
       LOG(ERROR) << __FUNCTION__
                  << ": failed to set egress TPID entry for port "
                  << OBJ_CAST(link);
-  }
+  } else {
+    std::deque<uint16_t> vlans;
+
+    nl->get_vlans(rtnl_link_get_ifindex(bond), &vlans);

   if (lm_rv->second.empty())
     remove_l3_address(bond);

   if (nl->is_bridge_interface(bond))
     swi->ofdpa_stg_state_port_set(port_id, "forward");
+
+    for (auto vid : vlans) {
+      swi->ingress_port_vlan_remove(port_id, vid, false);
+      swi->egress_port_vlan_remove(port_id, vid);
+    }
+  }
 #endif

   return rv;


fixed

fixed

--- tests/test_ringBuffer.cpp
+++ tests/test_ringBuffer.cpp
@@ -21,7 +21,7 @@

 bool g_bExitRead = false;
 bool g_bExitWrite = false;
-RingBuffer<string>::Ptr g_ringBuf(new RingBuffer<string>(48));
+RingBuffer<string>::Ptr g_ringBuf(new RingBuffer<string>());

 void onReadEvent(const string &str){
@@ -31,23 +31,11 @@
 void onDetachEvent(){
 	WarnL;
 }
-void doRead(int threadNum){
-	//主动读模式采用轮训机制 效率比较差，可以加入条件变量机制改造
-	auto reader = g_ringBuf->attach();
-	while(!g_bExitRead){
-		auto ptr = reader->read();
-		if(ptr){
-			InfoL << "thread " << threadNum << ":" << *ptr;
-		}else{
-			InfoL << "thread " << threadNum << ": read nullptr!";
-			usleep(100 * 1000);
-		}
-	}
-}
+
 void doWrite(){
 	int i = 0;
 	while(!g_bExitWrite){
-		g_ringBuf->write(to_string(++i));
+		g_ringBuf->write(to_string(++i),true);
 		usleep(100 * 1000);
 	}

@@ -65,14 +53,7 @@
 		onDetachEvent();
 	});

-	//主动读取线程
 	thread_group group;
-	for(int i = 0 ;i < 4 ; ++i){
-		group.create_thread([i](){
-			doRead(i);
-		});
-	}
-
 	//写线程
 	group.create_thread([](){
 		doWrite();


Add new central and semicentral triggers (Cynthia)

--- PWG3/muon/PlotMuonQA.C
+++ PWG3/muon/PlotMuonQA.C
@@ -66,6 +66,7 @@
 TCanvas *ProcessCanvasAsymMatched(TObjArray *triggersB, TH1 **hPosMatchedB, TH1 **hNegMatchedB, TH1 **hAllMatchedB, Int_t indTrigger, TString canvasName,TString legendHeader="");
 TCanvas *ProcessCanvasHighPtMuons(TObjArray *triggersB, TH1 **hB, TH1 **hMatchedLowPtB, TH1 **hAllMatchedHightPtB, Int_t indTrigger, TString canvasName,TString legendHeader="");
 Bool_t IsTrigger(TObjArray *array, Int_t index, TString name);
+Bool_t IsTriggerSelectedForMuonPhysics(TObjArray *array, Int_t index);
 Bool_t IsHeavyIonCollision(AliCounterCollection *eventCounters);

 //--------------------------------------------------------------------------
@@ -188,6 +189,8 @@
   TString CanvasName = "cAll";
   TCanvas *cAll = new TCanvas(CanvasName.Data(),CanvasName.Data());
   cAll->SetLeftMargin(0.18);
+	cAll->SetRightMargin(0.18);
+	cAll->SetLogz(1);
   cAll->cd();
   //TH2* hAll = (TH2*) ProcessHisto2D(eventCounters, "trigger", "run", Form("run:any/%s",select.Data()) , "");
   TH2* hAll = (TH2*) ProcessHisto2D(eventCounters, "trigger", "run", "run:any" , "");
@@ -200,7 +203,7 @@
     hAll->GetYaxis()->SetBinLabel(ibin, newLabel.Data());
     delete labelArray;
   }
-  hAll->Draw("TEXT");
+  hAll->Draw("COLZ");

   //declare a default canvas c1
@@ -219,8 +222,7 @@
   TString centLegendName[centBinMax] ={"All collisions","[0-80%] from V0 amplitude","low mult. [60-80%] from V0 amplitude","high mult. [0-10%] from V0 amplitude"};
   TString centLegendNameShort[centBinMax] ={"All","[0-80%]","[60-80%]","[0-10%]"};
   TString selectionCent;
-
-
+
   TH1* hBNoPS[centBinMax][10]={};
   TH1* hBWithPS[centBinMax][10]={};
   TH1* hB[centBinMax][10]={};
@@ -236,9 +238,7 @@
     cout<<"Too many triggers = "<<triggersB->GetEntriesFast()<<endl;
     return;
   }
-
-
-
+
   //loop on centrality
   for(centBin = 0; centBin < centBinMaxLoop; centBin++){
     selectionCent = centBinName[centBin];
@@ -281,7 +281,7 @@
       hACWithPS[centBin][i] =  (TH1*) ProcessHisto(eventCounters, "run", selection, histoName);

       TString triggerNameE = ( (TObjString*) triggersE->At(i) )->GetString();
-			// Histo trigger without Phys. Sel. E
+      // Histo trigger without Phys. Sel. E
       selection = selectionCent; selection += Form("trigger:%s/%s", triggerNameE.Data(), selectRuns.Data());
       histoName = histoNameBase;
       histoName += "ENoPS";
@@ -354,7 +354,6 @@
       NumOfEWithPS[centBin][i] = hEWithPS[centBin][i]->Integral();
     }
   }
-
   centBin = 0;

   cout<<"//==================================================================================="<<endl;
@@ -413,7 +412,7 @@
       //skip sum of all triggers
       if(k == (triggersB->GetEntriesFast()-1)) continue;
       //skip some triggers
-      if( !IsTrigger(triggersB,k,"CMB")&&!IsTrigger(triggersB, k, "CPBI")&&!IsTrigger(triggersB, k, "CVHN")&&!IsTrigger(triggersB, k, "CVLN") ) continue;
+      if ( !IsTriggerSelectedForMuonPhysics(triggersB,k) ) continue;

       canvasName = "PhysSel_trigger";
       canvasName +=k;
@@ -444,8 +443,8 @@
       //skip sum of all triggers
       if(k == (triggersB->GetEntriesFast()-1)) continue;
       //skip some triggers
-      if( !IsTrigger(triggersB,k,"CMB")&&!IsTrigger(triggersB, k, "CPBI")&&!IsTrigger(triggersB, k, "CVHN")&&!IsTrigger(triggersB, k, "CVLN")) continue;
-
+      if ( !IsTriggerSelectedForMuonPhysics(triggersB,k) ) continue;
+
       canvasName = "CentralityCheck_trigger";
       canvasName +=k;

@@ -482,8 +481,8 @@
       //skip sum of all triggers
       if(k == (triggersB->GetEntriesFast()-1)) continue;
       //skip some triggers
-      if( !IsTrigger(triggersB, k, "INT") && !IsTrigger(triggersB, k, "MUS" ) && !IsTrigger(triggersB, k, "ANY") && !IsTrigger(triggersB,k,"CMB")&&!IsTrigger(triggersB, k, "CPBI")&&!IsTrigger(triggersB, k, "CVHN")&&!IsTrigger(triggersB, k, "CVLN") ) continue;
-
+      if ( !IsTriggerSelectedForMuonPhysics(triggersB,k) ) continue;
+
       canvasName = "RatioTrackTypes_cent";
       canvasName += centBin;
       canvasName +="trigger";
@@ -528,13 +527,13 @@
       //skip sum of all triggers
       if(k == (triggersB->GetEntriesFast()-1)) continue;
       //skip some triggers
-      if( !(IsTrigger(triggersB, k, "INT") || IsTrigger(triggersB, k, "MUS" ) || IsTrigger(triggersB,k,"CMB")|| IsTrigger(triggersB, k, "CPBI") || IsTrigger(triggersB, k, "CVHN") || IsTrigger(triggersB, k, "CVLN") ) ) continue;
-
-			canvasName = "AsymMatched";
-			canvasName += centBin;
-			canvasName +="trigger";
-			canvasName +=k;
-			cAsymMatched[centBin][k]= ProcessCanvasAsymMatched(triggersB, hPosMatchedB[centBin], hNegMatchedB[centBin], hAllMatchedB[centBin], k, canvasName,legendHeader);
+      if ( !IsTriggerSelectedForMuonPhysics(triggersB,k) ) continue;
+
+      canvasName = "AsymMatched";
+      canvasName += centBin;
+      canvasName +="trigger";
+      canvasName +=k;
+      cAsymMatched[centBin][k]= ProcessCanvasAsymMatched(triggersB, hPosMatchedB[centBin], hNegMatchedB[centBin], hAllMatchedB[centBin], k, canvasName,legendHeader);
       cAsymMatched[centBin][k]->Draw();
       cAsymMatched[centBin][k]->Print(OutFileNamePDF.Data());
       cAsymMatched[centBin][k]->Write();
@@ -555,12 +554,12 @@
       //skip sum of all triggers
       if(k == (triggersB->GetEntriesFast()-1)) continue;
       //skip some triggers
-      if( !(IsTrigger(triggersB, k, "INT") || IsTrigger(triggersB, k, "MUS" ) || IsTrigger(triggersB,k,"CMB") || IsTrigger(triggersB, k, "CPBI") || IsTrigger(triggersB, k, "CVHN") || IsTrigger(triggersB, k, "CVLN") ) ) continue;
-
-			canvasName = "HighPtMuons";
-			canvasName += centBin;
-			canvasName +="trigger";
-			canvasName +=k;
+      if ( !IsTriggerSelectedForMuonPhysics(triggersB,k) ) continue;
+
+      canvasName = "HighPtMuons";
+      canvasName += centBin;
+      canvasName +="trigger";
+      canvasName +=k;

       cHighPtMuons[centBin][k]= ProcessCanvasHighPtMuons(triggersB, hB[centBin], hMatchedLowPtB[centBin], hMatchedHighPtB[centBin], k, canvasName,legendHeader);
       cHighPtMuons[centBin][k]->Draw();
@@ -747,7 +746,7 @@
       run.Remove(TString::kLeading, '/');
       run.Remove(TString::kLeading, '0');

-			if ( ! selectRuns.Contains(run.Data()) ) continue;
+      if ( ! selectRuns.Contains(run.Data()) ) continue;

       // open the outfile for this run
       TFile *runFile = TFile::Open(objs->GetString());
@@ -1128,6 +1127,16 @@
   return process;
 }

+Bool_t IsTriggerSelectedForMuonPhysics(TObjArray *triggersB, Int_t k){
+
+  if ( !triggersB ) return kFALSE;
+  Bool_t selected;
+  selected =  (IsTrigger(triggersB,k,"CMB") || IsTrigger(triggersB, k, "CPBI") || IsTrigger(triggersB, k, "CVHN") || IsTrigger(triggersB, k, "CVLN") || IsTrigger(triggersB, k, "CCENT") || IsTrigger(triggersB, k, "CSEMI") );
+
+  return selected;
+}
+
+
 Bool_t IsHeavyIonCollision(AliCounterCollection *eventCounters){

   if(!eventCounters) return kFALSE;
@@ -1199,7 +1208,7 @@

   TString hName, hTriggerName;
   Int_t indAllTrig = triggersB->GetEntriesFast()-1;
-  cout<<indAllTrig<<endl;
+
   for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){
     hName = "ratio";
     hName += ( (TObjString*) triggersB->At(i) )->GetString();
@@ -1287,7 +1296,7 @@
     hName = "ratioENoPS";
     hName += ( (TObjString*) triggersE->At(i) )->GetString();
     ratioENoPS[i] = static_cast<TH1*> (hENoPS[i]->Clone(hName));
-		if ( ratioENoPS[i]->GetEntries() > 0 ) ratioENoPS[i]->Divide(hBNoPS[i]);
+    if ( ratioENoPS[i]->GetEntries() > 0 ) ratioENoPS[i]->Divide(hBNoPS[i]);
     ratioENoPS[i]->SetLineWidth(0);
     ratioENoPS[i]->SetLineStyle(3);
     ratioENoPS[i]->SetMarkerStyle(24+i);
@@ -1803,7 +1812,7 @@
   TH1* h1 = 0x0;
   if( !counter ) return h1;

-	//cout<<"ProcessHisto selection "<<hSelection<<endl;
+  //cout<<"ProcessHisto selection "<<hSelection<<endl;

   if ( !hSelection.Contains("trigger: /") && !hSelection.Contains("trigger:/") ) h1 = (TH1*) counter->Draw(hVariable,hSelection);
   if ( !h1 ) h1 = new TH1D(hName,"",10,0,10);
@@ -1922,7 +1931,7 @@
 	isBadTrig = kTRUE;
 	while ( ( trigName = static_cast<TObjString*>(nextTrigger()) ) ) {
 	  if ( currTrigName.Contains(trigName->GetString()) ){
-			 isBadTrig = kFALSE;
+	    isBadTrig = kFALSE;
 	  }
 	}
 	if ( isBadTrig == kTRUE ){
@@ -1986,7 +1995,7 @@
     if(runs2) runs2->AddLast(new TObjString("*"));
   }

-	printf("selected runs from runlist %s: %s\n",runList, selectRuns.Data());
+  printf("selected runs from runlist %s: %s\n",runList, selectRuns.Data());

   return selectRuns;
 }


Removed 'options' from NodeIoInfo

Removed 'options' from NodeIoInfo

--- include/depthai-shared/pipeline/NodeIoInfo.hpp
+++ include/depthai-shared/pipeline/NodeIoInfo.hpp
@@ -13,13 +13,9 @@
     Type type = Type::SReceiver;
     bool blocking = true;
     int queueSize = 8;
-
-    struct Options {
-        bool waitForMessage = false;
-    } options;
+    bool waitForMessage = false;
 };

-NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(NodeIoInfo::Options, waitForMessage);
-NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(NodeIoInfo, group, name, type, blocking, queueSize, options);
+NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(NodeIoInfo, group, name, type, blocking, queueSize, waitForMessage);

 }  // namespace dai


Cyphers/topkmax (#4512)

Cyphers/topkmax (#4512)

* Interval-base dimension

* define statics

* fix constexpr

* Better interval handling at endpoints

* Convenience methods, Nishant's test

* Use -1s for unbounded in dimensions, bug-fixes

* Intervals are non-negative

* Compute maximum value a node might have
Add a generic partial evaluator

* merge

* Avoid narrowing

* Review comments

* Add intersection

* topk merge

* Get range right

* Fix &, -1 in Dimension

* cleanup

* Simplify

Co-authored-by: Sang Ik Lee <aa6563a7b56e5ef7f7ffa08e0bc60e65c5df68a1@intel.com>
Co-authored-by: Robert Kimball <f8f4fb0160c4e961c3d6afdbdcc40cfc21344ca8@intel.com>

--- src/ngraph/op/topk.cpp
+++ src/ngraph/op/topk.cpp
@@ -295,7 +295,22 @@
     if (output_shape.rank().is_static())
     {
         m_normalized_axis = ngraph::normalize_axis(this, m_axis, output_shape.rank());
-        output_shape[m_normalized_axis] = (k == 0) ? -1 : k;
+        if (k != 0)
+        {
+            output_shape[m_normalized_axis] = k;
+        }
+        else
+        {
+            auto max_k = maximum_value(input_value(1));
+            if (max_k.first)
+            {
+                output_shape[m_normalized_axis] &= Dimension(0, max_k.second);
+            }
+            else
+            {
+                output_shape[m_normalized_axis] = -1;
+            }
+        }
     }

     set_output_size(2);


Test computation of discrete state space matrices


add "IsGameEnd()"

add "IsGameEnd()"

--- I401/main.cpp
+++ I401/main.cpp
@@ -98,6 +98,97 @@
 			cout << endl;
 		}
 	}
+	// Check GameEnd
+	bool IsGameEnd(const Stone turn) {
+		// Row()
+		for (size_t i = 0; i < kBoardSize; ++i) {
+			size_t len = 0;
+			for (size_t j = 0; j < kBoardSize; ++j) {
+				size_t p = ToPosition(j, i);
+				if (board_[p] == turn) {
+					++len;
+					if (len == 5) return true;
+				}else{
+					len = 0;
+				}
+			}
+		}
+		// Column()
+		for (size_t i = 0; i < kBoardSize; ++i) {
+			size_t len = 0;
+			for (size_t j = 0; j < kBoardSize; ++j) {
+				size_t p = ToPosition(i, j);
+				if (board_[p] == turn) {
+					++len;
+					if (len == 5) return true;
+				}
+				else {
+					len = 0;
+				}
+			}
+		}
+		// Diagonally right(^)
+		for (size_t i = 4; i < kBoardSize; ++i) {
+			size_t len = 0;
+			for (size_t j = 0; j <= i; ++j) {
+				size_t p = ToPosition(i - j, j);
+				if (board_[p] == turn) {
+					++len;
+					if (len == 5) return true;
+				}
+				else {
+					len = 0;
+				}
+			}
+		}
+		for (size_t i = 1; i < kBoardSize - 4; ++i) {
+			size_t len = 0;
+			for (size_t j = 0; j < kBoardSize - i; ++j) {
+				size_t p = ToPosition(kBoardSize - 1 - j, i + j);
+				if (board_[p] == turn) {
+					++len;
+					if (len == 5) return true;
+				}
+				else {
+					len = 0;
+				}
+			}
+		}
+		// Diagonally left(_)
+		for (size_t i = 0; i < kBoardSize - 4; ++i) {
+			size_t len = 0;
+			for (size_t j = 0; j < kBoardSize - i; ++j) {
+				size_t p = ToPosition(i + j, j);
+				if (board_[p] == turn) {
+					++len;
+					if (len == 5) return true;
+				}
+				else {
+					len = 0;
+				}
+			}
+		}
+		for (size_t i = 1; i < kBoardSize - 4; ++i) {
+			size_t len = 0;
+			for (size_t j = 0; j < kBoardSize - i; ++j) {
+				size_t p = ToPosition(j, i + j);
+				if (board_[p] != Stone::None) continue;
+				if (board_[p] == turn) {
+					++len;
+					if (len == 5) return true;
+				}
+				else {
+					len = 0;
+				}
+			}
+		}
+		return false;
+	}
+	bool IsGameEnd() {
+		if (IsGameEnd(Stone::Black)) return true;
+		if (IsGameEnd(Stone::White)) return true;
+		return false;
+	}
 	// Count stone
 	size_t CountStone() {
 		size_t sum = 0;
@@ -338,7 +429,7 @@
 		return pattern;
 	}
 	// Check Cho-ren
-	bool HasChorenB(const Pattern &pattern) {
+	bool IsChorenB(const Pattern &pattern) {
 		if (pattern[Side::Right][4] == PackPattern(Stone::Black, Stone::Black, Stone::Black, Stone::Black, Stone::Black)) return true;
 		if (pattern[Side::Right][3] == PackPattern(Stone::Black, Stone::Black, Stone::Black, Stone::Black)
 			&& pattern[Side::Left][0] == Stone::Black) return true;
@@ -619,7 +710,7 @@
 		size_t sum_4_strong = 0, sum_4_normal = 0, sum_3 = 0;
 		for (uint8_t dir = 0; dir < Direction::Directions; ++dir) {
 			auto move_pattern = GetPatternB(p, static_cast<Direction>(dir));
-			if (HasChorenB(move_pattern)) return false;
+			if (IsChorenB(move_pattern)) return false;
 			size_t s4s, s4n, s3;
 			std::tie(s4s, s4n, s3) = CountRenB(move_pattern, p, static_cast<Direction>(dir));
 			sum_4_strong += s4s;
@@ -638,8 +729,6 @@
 		vector<Score> position_list;
 		for (size_t p = 0; p < kBoardSize * kBoardSize; ++p) {
 			if (board_[p] != Stone::None) {
-/*				std::cerr << "";
-				if (p % kBoardSize == kBoardSize - 1) std::cerr << endl;*/
 				continue;
 			}
 			if (turn_ == Stone::Black) {
@@ -647,7 +736,7 @@
 				size_t sum_4_strong = 0, sum_4_normal = 0, sum_3 = 0;
 				for (uint8_t dir = 0; dir < Direction::Directions; ++dir) {
 					auto move_pattern = GetPatternB(p, static_cast<Direction>(dir));
-					if (HasChorenB(move_pattern)) {
+					if (IsChorenB(move_pattern)) {
 						cho_ren_flg = true;
 						break;
 					}
@@ -657,18 +746,8 @@
 					sum_4_normal += s4n;
 					sum_3 += s3;
 				}
-				/*if (cho_ren_flg || sum_4_strong + sum_4_normal >= 2 || sum_3 >= 2) {
-					std::cerr << "~";
-				}else if(sum_4_strong + sum_4_normal + sum_3 >= 1){
-					std::cerr << "";
-				}else{
-					std::cerr << "";
-				}*/
 				if (cho_ren_flg || sum_4_strong + sum_4_normal >= 2 || sum_3 >= 2) continue;
-			}/*else{
-				std::cerr << "";
-			}
-			if (p % kBoardSize == kBoardSize - 1) std::cerr << endl;*/
+			}
 			position_list.push_back(Score(p, 0));
 		}
 		if (position_list.size() > 0) return Result(position_list[RandInt(position_list.size())].first, true);
@@ -717,6 +796,8 @@
 	}
 	// Thinking next move
 	int NextMove(const size_t depth, bool debug_flg = false) {
+		// If the game is end, you don't move.
+		if (IsGameEnd()) return -1;
 		// Opening move
 		auto result = GetOpeningMove(turn_);
 		if (result.second) return result.first;


silence msvc warning

silence msvc warning

--- include/libtorrent/http_tracker_connection.hpp
+++ include/libtorrent/http_tracker_connection.hpp
@@ -56,7 +56,7 @@
 	class entry;
 	class http_parser;
 	class connection_queue;
-	class session_settings;
+	struct session_settings;

 	class TORRENT_EXPORT http_tracker_connection
 		: public tracker_connection


fixed wrong scaling factors being used while exporting

git-svn-id: 353be9ac11a1e711854a13efcc2fc17d9d6b83e7@1287 c36c8488-0289-0348-9b64-b301f74bd9a7

--- IOManager.cpp
+++ IOManager.cpp
@@ -926,7 +926,7 @@
                                 pSourceData->GetIsSigned(),
                                 pSourceData->GetIsFloat(),
                                 pSourceData->GetDomainSize(iLODlevel),
-                                FLOATVECTOR3(pSourceData->GetRescaleFactors()),
+                                FLOATVECTOR3(pSourceData->GetScale()),
                                 false,false);

   remove(strTempFilename.c_str());


Add empty line for better reading

Add empty line for better reading

--- include/simulation/openmp/OpenMPSimulation.hpp
+++ include/simulation/openmp/OpenMPSimulation.hpp
@@ -28,6 +28,7 @@
          */
         //OpenMPSimulation(vector<Solver::AbstractSolverSPtr> solvers, const string_type & scheduleKind = "auto");
         OpenMPSimulation(const Initialization::SimulationPlan & in, const vector<std::shared_ptr<Solver::ISolver>> & solver);
+
         /**
          * Destructor. Destroys OpenMP simulation object and frees allocates resources.
          */


Fixed problem with bit manipulation.  I think, maybe.

--- LEDMatrix.cpp
+++ LEDMatrix.cpp
@@ -210,7 +210,7 @@
 	if( red == LED_COLOR_ON ) {
 		this->m_data[ offsetByte ] |= 1 << offsetBit ;
 	} else {
-		this->m_data[ offsetByte ] &= 0 << offsetBit ;
+		this->m_data[ offsetByte ] &= ~(1 << offsetBit) ;
 	}

 	return true ;
@@ -226,7 +226,7 @@
 	if( green == LED_COLOR_ON ) {
 		this->m_data[ offsetByte ] |= 1 << offsetBit ;
 	} else {
-		this->m_data[ offsetByte  ] &= 0 << offsetBit ;
+		this->m_data[ offsetByte  ] &= ~(1 << offsetBit) ;
 	}

 	return true ;


Add command::root convenience function

Add command::root convenience function

--- libvast/vast/command.hpp
+++ libvast/vast/command.hpp
@@ -120,6 +120,11 @@

   /// Queries whether this command has no parent.
   bool is_root() const noexcept;
+
+  /// Queries whether this command has no parent.
+  command& root() noexcept {
+    return is_root() ? *this : parent_->root();
+  }

   inline const std::string_view& name() const noexcept {
     return name_;


Move code to work around a BCC bug

Move code to work around a BCC bug

For an unknown reason, BCC reports this error:
  [C++ Error] Standard_ErrorHandler.cpp(48): E2092 Storage class 'static' is not allowed here
which disappears when GetThreadID() is defined before static members.

--- ros/src/Standard/Standard_ErrorHandler.cxx
+++ ros/src/Standard/Standard_ErrorHandler.cxx
@@ -23,14 +23,7 @@
 // request will be ignored. If the abort request do a raise during a setjmp
 // or a longjmp, there will be a "terminating SEGV" impossible to handle.

-//==== The top of the Errors Stack ===========================================
-static Standard_ErrorHandler* Top = 0;
-
-// A mutex to protect from concurrent access to Top
-// Note that we should NOT use Sentry while in this class, as Sentry
-// would register mutex as callback in the current exception handler
-static Standard_Mutex theMutex;
-
+//Somehow borland needs this inline global function to be declared first ... ??
 static inline Standard_ThreadId GetThreadID()
 {
 #ifndef WNT
@@ -39,6 +32,14 @@
   return GetCurrentThreadId();
 #endif
 }
+
+//==== The top of the Errors Stack ===========================================
+static Standard_ErrorHandler* Top = 0;
+
+// A mutex to protect from concurrent access to Top
+// Note that we should NOT use Sentry while in this class, as Sentry
+// would register mutex as callback in the current exception handler
+static Standard_Mutex theMutex;

 //============================================================================
 //====  Constructor : Create a ErrorHandler structure. And add it at the


Fix warning

Fix warning

--- src/os/async_thread.cc
+++ src/os/async_thread.cc
@@ -34,7 +34,6 @@

 int swAio_callback(swReactor *reactor, swEvent *_event)
 {
-    int i;
     async_event *events[SW_AIO_EVENT_NUM];
     ssize_t n = read(_event->fd, events, sizeof(async_event*) * SW_AIO_EVENT_NUM);
     if (n < 0)
@@ -42,7 +41,7 @@
         swSysWarn("read() failed");
         return SW_ERR;
     }
-    for (i = 0; i < n / (int) sizeof(async_event*); i++)
+    for (size_t i = 0; i < n / sizeof(async_event *); i++)
     {
         if (!events[i]->canceled)
         {
@@ -308,7 +307,7 @@
     queue<thread_context> threads;
     async_event_queue _queue;
     bool running;
-    atomic<int> n_waiting;
+    atomic<size_t> n_waiting;
     mutex _mutex;
     condition_variable _cv;
 };


ovr: Exit application on Esc.

ovr: Exit application on Esc.

Signed-off-by: Squareys <0f6a03d4883e012ba4cb2c581a68f35544703cd6@googlemail.com>

--- src/ovr/OvrExample.cpp
+++ src/ovr/OvrExample.cpp
@@ -265,6 +265,8 @@
         if(!_hmd->isDebugHmd()) {
             _hmd->setPerformanceHudMode(_curPerfHudMode);
         }
+    } else if(event.key() == KeyEvent::Key::Esc) {
+        exit();
     }
 }


From Gerri:
- Add quotes around the path string while exporting ROOTINCLUDEPATH

git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@18385 27541ba8-7e3a-0410-8455-c3a389f83636

--- proof/src/TProofServ.cxx
+++ proof/src/TProofServ.cxx
@@ -1,4 +1,4 @@
-// @(#)root/proof:$Name:  $:$Id: TProofServ.cxx,v 1.169 2007/03/20 07:51:58 brun Exp $
+// @(#)root/proof:$Name:  $:$Id: TProofServ.cxx,v 1.170 2007/03/20 16:16:04 rdm Exp $
 // Author: Fons Rademakers   16/02/97

 /*************************************************************************
@@ -3855,8 +3855,8 @@
                // (impatient) client. Note that this operation will block, so
                // the messages from builds on the workers will reach the client
                // shortly after the master ones.
-               TString cmd = Form("export ROOTINCLUDEPATH=%s ; PROOF-INF/BUILD.sh",
-                                  gSystem->GetIncludePath());
+               TString cmd = Form("export ROOTINCLUDEPATH=\"%s\" ; PROOF-INF/BUILD.sh",
+                                    gSystem->GetIncludePath());
                {
                   TProofServLogHandlerGuard hg(cmd, fSocket);
                }


use half millisecond step

use half millisecond step


Fixes https://github.com/jasp-stats/INTERNAL-jasp/issues/326 (Cannot build jaspResults for jaspTools)

--- JASP-R-Interface/jaspResults/src/jaspColumn.cpp
+++ JASP-R-Interface/jaspResults/src/jaspColumn.cpp
@@ -1,3 +1,5 @@
+
+#include "jaspColumn.h"

 #ifdef JASP_R_INTERFACE_LIBRARY
 #include "jasprcpp.h"
@@ -7,8 +9,6 @@
 bool jaspRCPP_setColumnDataAsNominal(		std::string, Rcpp::RObject) { jaspPrint("jaspColumn does nothing in R stand-alone!"); return false; };
 bool jaspRCPP_setColumnDataAsNominalText(	std::string, Rcpp::RObject) { jaspPrint("jaspColumn does nothing in R stand-alone!"); return false; };
 #endif
-
-#include "jaspColumn.h"

 Json::Value jaspColumn::convertToJSON()


comdllwrapper: LockServer

comdllwrapper: LockServer

- lock and unlock the class factory
- detach the class factory smart pointer before unlocking (Release'ing it
  could have unintended consequences because the factory can destroy
  itself when ref count is non-zero)

Change-Id: If2dc084cb5a23ed7e65b28dcfbfe3a3aa2e70af0

--- common/comdllwrapper.cpp
+++ common/comdllwrapper.cpp
@@ -34,8 +34,8 @@
 {
     if (ptr_class_factory_)
     {
-        //ptr_class_factory_->LockServer(FALSE);
-        ptr_class_factory_ = 0;
+        IClassFactory* ptr_class_factory = ptr_class_factory_.Detach();
+        ptr_class_factory->LockServer(FALSE);
     }
     if (NULL != dll_module_)
     {
@@ -107,12 +107,12 @@
         }
         if (SUCCEEDED(hr) && ptr_class_factory_)
         {
-            //hr = ptr_class_factory_->LockServer(TRUE);
-            //if (FAILED(hr))
-            //{
-            //    DBGLOG("LockServer failed" << HRTEXT(hr));
-            //    return hr;
-            //}
+            hr = ptr_class_factory_->LockServer(TRUE);
+            if (FAILED(hr))
+            {
+                DBGLOG("LockServer failed" << HRLOG(hr));
+                return hr;
+            }
         }
     }
     return hr;


RF: sensor TX power increased to 12 dBm

RF: sensor TX power increased to 12 dBm

--- common/include/radio.hpp
+++ common/include/radio.hpp
@@ -67,7 +67,7 @@
 	cc1101::template set<CC1101::MCSM0>(0x38);

 	// PATABLE
-	cc1101::template set<CC1101::PATABLE>(0x60);
+	cc1101::template set<CC1101::PATABLE>(0xc0);

 	cc1101::release();
 }


radio tuned

radio tuned

- GFSK
- 30/32 bit sync word
- 115.89 kBaud
  These are calculated for a 2.41 modulation index:
  - 69.823 kHz deviation
  - 464.285 kHz rx bw filter


updates

updates

--- tutorials/viewer_anim/viewer_anim_device.cpp
+++ tutorials/viewer_anim/viewer_anim_device.cpp
@@ -17,7 +17,7 @@
 /* hack to quickly enable use 8-wide ray initialization and rtcIntersectNM */

 #define VECTOR_MODE 0
-#define ENABLE_ANIM 1
+#define ENABLE_ANIM 0

 #if VECTOR_MODE  == 1
 #define __SSE4_2__
@@ -61,6 +61,14 @@
   float *shadowDistanceMap = NULL;
   float *zBuffer = NULL;

+  /* shadow rays */
+
+  static const size_t numShadowSamples = 64;
+  static const size_t numShadowPackets = numShadowSamples/8;
+  struct SampleSet {
+    float u[numShadowSamples];
+    float v[numShadowSamples];
+  } sampleSet;

   void dumpBuildAndRenderTimes();

@@ -271,6 +279,11 @@
   }

 #if VECTOR_MODE  == 1
+
+  const Vec3<vfloat8> ls_origin(vfloat8(-1.513921618),vfloat8(13.41725254),vfloat8(-8.156237602));
+  const static float LS_SIZE = 10.0f;
+  const Vec3<vfloat8> ls_dir_u(vfloat8(LS_SIZE),vfloat8(0.0f),vfloat8(0.0f));
+  const Vec3<vfloat8> ls_dir_v(vfloat8(0.0f),vfloat8(0.0f),vfloat8(LS_SIZE));

   template<bool fillDistanceMap>
   void renderTile8x8(int taskIndex,
@@ -318,7 +331,9 @@

     /* trace stream of rays */
     rtcIntersectNM(g_scene,&context,(RTCRayN *)rays,8,8,sizeof(RTCRay8));
-
+    //rtcOccludedNM(g_scene,&context,(RTCRayN *)rays,8,8,sizeof(RTCRay8));
+
+#if 1
     /* shade stream of rays */
     for (unsigned int i=0; i<TILE_SIZE_Y; i++)
       {
@@ -337,8 +352,6 @@
     if (fillDistanceMap)
     {
       // -vp -1.513921618 13.41725254 -8.156237602 -vi -0.3423615694 3.748182058 -3.199102163 -vu 0 1 0 -fov 90
-      const Vec3<vfloat8> shadow_org(vfloat8(-1.513921618),vfloat8(13.41725254),vfloat8(-8.156237602));
-
       for (unsigned int i=0; i<TILE_SIZE_Y; i++)
       {
         const Vec3<vfloat8> ray_dir(vfloat8::load(rays[i].dirx),vfloat8::load(rays[i].diry),vfloat8::load(rays[i].dirz));
@@ -348,15 +361,15 @@
         vfloat8::storeu(&zBuffer[(y0+i)*width+x0],ray_dist);

         const Vec3<vfloat8> pos = ray_org + ray_dir * ray_dist;
-        const Vec3<vfloat8> shadow_dir = pos - shadow_org;
+        const Vec3<vfloat8> shadow_dir = pos - ls_origin;

         const vfloat8 shadow_dist(0.99f);

         const vbool8 mask = vint8::load(rays[i].geomID) != vint8(RTC_INVALID_GEOMETRY_ID);

-        vfloat8::store(rays[i].orgx,shadow_org.x);
-        vfloat8::store(rays[i].orgy,shadow_org.y);
-        vfloat8::store(rays[i].orgz,shadow_org.z);
+        vfloat8::store(rays[i].orgx,ls_origin.x);
+        vfloat8::store(rays[i].orgy,ls_origin.y);
+        vfloat8::store(rays[i].orgz,ls_origin.z);
         vfloat8::store(rays[i].dirx,shadow_dir.x);
         vfloat8::store(rays[i].diry,shadow_dir.y);
         vfloat8::store(rays[i].dirz,shadow_dir.z);
@@ -378,6 +391,7 @@
         vfloat8::storeu(&shadowDistanceMap[(y0+i)*width+x0],select(mask,1.0f,vfloat8::load(rays[i].tfar)));
       }
     }
+#endif
   }

@@ -409,6 +423,7 @@
       factor[i] = select(factor[i] < 1.0f, vfloat8(0.0f), vfloat8(1.0f));
     }

+#if 1
     for (unsigned int x=x0;x<x1;x++)
       for (unsigned int y=y0;y<y1;y++)
       {
@@ -489,6 +504,7 @@
         }
 #endif
       }
+#endif

     for (unsigned int i=0; i<TILE_SIZE_Y; i++)
     {
@@ -500,6 +516,130 @@
     }

   }
+
+  float getLSOcclusion(const Vec3fa& origin)
+  {
+    RTCRay8 rays[numShadowPackets];
+
+    const Vec3<vfloat8> ray_org(vfloat8(origin.x),vfloat8(origin.y),vfloat8(origin.z));
+
+    RTCIntersectContext context;
+    context.flags = RAYN_FLAGS;
+
+    for (unsigned int i=0; i<TILE_SIZE_Y; i++)
+      {
+        vfloat8 rnd_u = vfloat8::load(&sampleSet.u[i*8]);
+        vfloat8 rnd_v = vfloat8::load(&sampleSet.v[i*8]);
+
+        const Vec3<vfloat8> ls_pnt = ls_origin + rnd_u * ls_dir_u + rnd_v * ls_dir_v;
+        const Vec3<vfloat8> ray_dir = ls_pnt - ray_org;
+        vfloat8::store(rays[i].orgx,ray_org.x);
+        vfloat8::store(rays[i].orgy,ray_org.y);
+        vfloat8::store(rays[i].orgz,ray_org.z);
+        vfloat8::store(rays[i].dirx,ray_dir.x);
+        vfloat8::store(rays[i].diry,ray_dir.y);
+        vfloat8::store(rays[i].dirz,ray_dir.z);
+        vfloat8::store(rays[i].tnear,1E-4f);
+        vfloat8::store(rays[i].tfar,vfloat8(1.0f));
+        vfloat8::store(rays[i].time,0.0f);
+        vint8::store(rays[i].mask,-1);
+        vint8::store(rays[i].geomID,RTC_INVALID_GEOMETRY_ID);
+        vint8::store(rays[i].primID,RTC_INVALID_GEOMETRY_ID);
+      }
+
+    rtcOccludedNM(g_scene,&context,(RTCRayN *)rays,8,8,sizeof(RTCRay8));
+    vfloat8 acc(zero);
+    for (unsigned int i=0; i<TILE_SIZE_Y; i++)
+      {
+        const vbool8 occ_mask = vint8::load(rays[i].geomID) == vint8(RTC_INVALID_GEOMETRY_ID);
+        acc += select(occ_mask,vfloat8(1.0f),vfloat8(0.0f));
+      }
+    PRINT(reduce_add(acc) * 1.0f/64.0f);
+    return reduce_add(acc) * 1.0f/64.0f;
+  }
+
+  void retraceShadowDistanceMap8x8(int taskIndex,
+                                   int* pixels,
+                                   const unsigned int width,
+                                   const unsigned int height,
+                                   const float time,
+                                   const ISPCCamera& camera,
+                                   const int numTilesX,
+                                   const int numTilesY)
+  {
+    assert(TILE_SIZE_X == 8);
+    assert(TILE_SIZE_Y == 8);
+
+
+    const unsigned int tileY = taskIndex / numTilesX;
+    const unsigned int tileX = taskIndex - tileY * numTilesX;
+    const unsigned int x0 = tileX * TILE_SIZE_X;
+    const unsigned int x1 = min(x0+TILE_SIZE_X,width);
+    const unsigned int y0 = tileY * TILE_SIZE_Y;
+    const unsigned int y1 = min(y0+TILE_SIZE_Y,height);
+
+    vfloat8 factor[TILE_SIZE_Y];
+    for (size_t i=0;i<TILE_SIZE_Y;i++)
+    {
+      factor[i] = vfloat8::load(&shadowDistanceMap[(y0+i)*width+x0]);
+      //factor[i] = select(factor[i] < 1.0f, vfloat8(0.0f), factor[i]);
+      factor[i] = select(factor[i] < 1.0f, vfloat8(0.0f), vfloat8(1.0f));
+    }
+
+    const Vec3fa ray_org(camera.xfm.p);
+
+    for (unsigned int x=x0;x<x1;x++)
+      for (unsigned int y=y0;y<y1;y++)
+      {
+
+        const int x_p1 = min((int)x+1,(int)width);
+        const int x_m1 = max((int)x-1,0);
+
+        const int y_p1 = min((int)y+1,(int)height);
+        const int y_m1 = max((int)y-1,0);
+
+        if (shadowDistanceMap[y*width+x] < 1.0f)
+        {
+          int FILTER_WIDTH = max((int)( (1.0f - shadowDistanceMap[y*width+x]) * 0.5f / zBuffer[y*width+x]),1);
+          FILTER_WIDTH = min(FILTER_WIDTH,8);
+
+
+          const int min_x = max((int)x-FILTER_WIDTH,0);
+          const int max_x = min((int)x+FILTER_WIDTH,(int)width);
+          const int min_y = max((int)y-FILTER_WIDTH,0);
+          const int max_y = min((int)y+FILTER_WIDTH,(int)height);
+
+          bool found = false;
+
+          for (int mx=min_x;mx<max_x;mx++)
+            for (int my=min_y;my<max_y;my++)
+              if (shadowDistanceMap[my*width+mx] == 1.0f)
+              {
+                found = true;
+                break;
+              }
+          if (found) {
+            const Vec3fa hit = ray_org + x * camera.xfm.l.vx + y * camera.xfm.l.vy + camera.xfm.l.vz;
+            const float occ = getLSOcclusion(hit);
+            factor[y-y0][x-x0] = occ;
+          }
+
+        }
+
+
+      }
+
+    for (unsigned int i=0; i<TILE_SIZE_Y; i++)
+    {
+      const vint8 rgb = vint8::load(&pixels[(y0+i)*width+x0]);
+      const vint8 r = vint8(max(vfloat8((rgb >>  0) & 0xff) * factor[i],vfloat8(1.0f)));
+      const vint8 g = vint8(max(vfloat8((rgb >>  8) & 0xff) * factor[i],vfloat8(1.0f)));
+      const vint8 b = vint8(max(vfloat8((rgb >> 16) & 0xff) * factor[i],vfloat8(1.0f)));
+      vint8::storeu(&pixels[(y0+i)*width+x0],(b << 16) + (g << 8) + r);
+    }
+
+  }
+
 #endif

 /* renders a single screen tile */
@@ -592,6 +732,17 @@
     /* set error handler */
     rtcDeviceSetErrorFunction(g_device,error_handler);

+    /* generate rnd numbers */
+
+    RandomSampler sampler;
+    RandomSampler_init(sampler, 0);
+
+    for (size_t i=0;i<numShadowSamples;i++)
+    {
+      const Vec2f uv = RandomSampler_get2D(sampler);
+      sampleSet.u[i] = uv.x;
+      sampleSet.v[i] = uv.y;
+    }

     /* create scene */
     g_scene = createScene(g_ispc_scene,true);
@@ -695,12 +846,12 @@
       });

     /* filter shadow distance buffer and update framebuffer */
-
     parallel_for(size_t(0),size_t(numTilesX*numTilesY),[&](const range<size_t>& range) {
         for (size_t i=range.begin(); i<range.end(); i++)
-          filterShadowDistanceMap8x8((int)i,pixels,width,height,time,camera,numTilesX,numTilesY);
+          //filterShadowDistanceMap8x8((int)i,pixels,width,height,time,camera,numTilesX,numTilesY);
+          retraceShadowDistanceMap8x8((int)i,pixels,width,height,time,camera,numTilesX,numTilesY);
+
       });
-

 #endif

@@ -716,14 +867,12 @@
     /* update geometry */
     /* =============== */

+#if ENABLE_ANIM == 1
+
     double vertexUpdateTime0 = getSeconds();

     if (animTime < 0.0f) animTime = getSeconds();
-#if ENABLE_ANIM == 0
-    const double atime = 0.0;
-#else
     const double atime = (getSeconds() - animTime) * ANIM_FPS;
-#endif
     double intpart, fracpart;
     fracpart = modf(atime,&intpart);
     const size_t keyFrameID = ((size_t)intpart) % numProfileFrames;
@@ -748,6 +897,7 @@
     updateTimeLog(buildTime,buildTimeDelta);

     if (unlikely(printStats)) std::cout << "bvh rebuild in :     " << buildTimeDelta << " ms" << std::endl;
+#endif

     frameID = (frameID + 1) % numProfileFrames;
   }


Fix comment

Fix comment

svn path=/branches/KDE/3.5/kdepim/; revision=830094

--- kalarm/karecurrence.cpp
+++ kalarm/karecurrence.cpp
@@ -712,7 +712,7 @@
 				return freq * 1440;

 			// It recurs only on certain days of the week, so the maximum interval
-			// will be greater than the frequency.
+			// may be greater than the frequency.
 			bool ds[7] = { false, false, false, false, false, false, false };
 			for (QValueList<RecurrenceRule::WDayPos>::ConstIterator it = days.begin();  it != days.end();  ++it)
 				if ((*it).pos() == 0)


Delete unnecessary comments

Delete unnecessary comments

--- plugin.cpp
+++ plugin.cpp
@@ -56,14 +56,12 @@
 	}
 }

-// This implementation of amx_GetAddr can accept ANY amx_addr, even out of the data section.
 static int AMXAPI amx_GetAddr_JIT(AMX *amx, cell amx_addr, cell **phys_addr) {
 	AMX_HEADER *hdr = reinterpret_cast<AMX_HEADER*>(amx->base);
 	*phys_addr = reinterpret_cast<cell*>(amx->base + hdr->dat + amx_addr);
 	return AMX_ERR_NONE;
 }

-// amx_Exec_JIT compiles a public function (if needed) and runs the generated JIT code.
 static int AMXAPI amx_Exec_JIT(AMX *amx, cell *retval, int index) {
 	if (index != AMX_EXEC_CONT) {
 		return GetJIT(amx)->CallPublicFunction(index, retval);


prototypes: impulse-based friction.

prototypes: impulse-based friction.

Does not work properly in large speeds, because spring forces cause near
zero normal velocity and thus friction is 0 in that case. Need to work
around that later.

--- prototypes/forces-2d.cpp
+++ prototypes/forces-2d.cpp
@@ -96,7 +96,7 @@
             Float massInverted,
                 powerArm,
                 restitution,
-                friction,
+                staticFriction, dynamicFriction,
                 springConstant,
                 momentOfInertiaInverted;

@@ -146,8 +146,6 @@
     /* Debug draw setup */
     debugResourceManager.set("primaryForces", (new DebugTools::ForceRendererOptions)
         ->setSize(0.00025f)->setColor(Color4::fromHSV(Deg(190.0f), 0.75f, 0.9f, 0.5f)));
-    debugResourceManager.set("friction", (new DebugTools::ForceRendererOptions)
-        ->setSize(0.00025f)->setColor(Color4::fromHSV(Deg(115.0f), 0.75f, 0.9f, 0.5f)));
     debugResourceManager.set("spring", (new DebugTools::ForceRendererOptions)
         ->setSize(0.000025f)->setColor(Color4(1.0f, 1.0f)));
     debugResourceManager.set("collision", (new DebugTools::ShapeRendererOptions)
@@ -168,7 +166,8 @@
     parameters.massInverted = 1.0f/(massBody + 2*massArm);
     parameters.powerArm = 2500.0f;
     parameters.restitution = 0.6f;
-    parameters.friction = 0.16f;
+    parameters.staticFriction = 0.16f;
+    parameters.dynamicFriction = 0.1f;
     parameters.springConstant = 1000000; /** @todo Is this in sane range? */

     /* Object initialization */
@@ -246,8 +245,6 @@
     /* Engine, friction and spring forces visualization */
     new DebugTools::ForceRenderer2D(engineLeft, {}, &forces.engineLeftArm, "primaryForces", &drawables);
     new DebugTools::ForceRenderer2D(engineRight, {}, &forces.engineRightArm, "primaryForces", &drawables);
-    new DebugTools::ForceRenderer2D(engineLeft, {}, &forces.frictionLeftArm, "friction", &drawables);
-    new DebugTools::ForceRenderer2D(engineRight, {}, &forces.frictionRightArm, "friction", &drawables);
     for(std::size_t i = 0; i != 3; ++i)
         new DebugTools::ForceRenderer2D(vehicle, shapes.vehicle->shape().get<Shapes::Point2D>(i).position(),
             &forces.spring[i], "spring", &drawables);
@@ -338,16 +335,32 @@
                 const Vector2 position = absolutePosition - vehicle->absoluteTransformation().translation();
                 const Vector2 velocity = state.linearVelocity + state.angularSpeed*position.perpendicular();

-                /* Impulse in direction of the normal, don't allow it to go in
-                   wrong direction (i.e. when the spring forces are already
-                   doing the collision response */
-                const Vector2 impulse = Math::max(0.0f,
+                /* Collision impulse in direction of the normal, don't allow it
+                   to go in wrong direction (i.e. when the spring forces are
+                   already doing the collision response)e */
+                const Float collisionImpulseMagnitude = Math::max(0.0f,
                     -(parameters.restitution + 1.0f)*Vector2::dot(velocity, normal)/(
                         parameters.massInverted*normal.dot() +
                         parameters.momentOfInertiaInverted*Math::pow<2>(Vector2::cross(position, normal))
-                    ))*normal;
-
-                applyImpulse(absolutePosition, impulse);
+                    ));
+                const Vector2 collisionImpulse = collisionImpulseMagnitude*normal;
+
+                /* Neither normal nor tangent are normalized, the impulses are
+                   computed in a way to avoid any need for that */
+                const Vector2 tangent = normal.perpendicular()*Math::sign(Vector2::dot(velocity, normal.perpendicular()));
+
+                /* Friction impulse in direction of tangent */
+                const Float frictionImpulseMagnitude = -Vector2::dot(velocity, tangent)/(
+                    parameters.massInverted*tangent.dot() +
+                    parameters.momentOfInertiaInverted*Math::pow<2>(Vector2::cross(position, tangent))
+                );
+                const Vector2 frictionImpulse = Math::abs(frictionImpulseMagnitude) < collisionImpulse.length()*parameters.staticFriction ?
+                    frictionImpulseMagnitude*tangent : -collisionImpulse.length()*tangent*parameters.dynamicFriction;
+
+                /* Apply impulses */
+                applyImpulse(absolutePosition, frictionImpulse);
+                applyImpulse(absolutePosition, collisionImpulse);
+
             }; break;

             /* Three collisions shouldn't happen */


prototypes: removed unneeded "total force" visualization.

Only engine force is applied, so having it visualized twice is useless.

--- prototypes/forces-2d.cpp
+++ prototypes/forces-2d.cpp
@@ -87,12 +87,9 @@
         } shapes;

         struct {
-            Vector2 weight,
-                engineLeftArm, engineRightArm,
-                frictionLeftArm, frictionRightArm,
-                totalLeftArm, totalRightArm;
-
+            Vector2 weight, engineLeftArm, engineRightArm;
             Vector2 spring[3];
+            Vector2 friction[3];
         } forces;

         struct {
@@ -147,16 +144,12 @@
         ->setProjection(Vector2(3.0f));

     /* Debug draw setup */
-    debugResourceManager.set("weight", (new DebugTools::ForceRendererOptions)
+    debugResourceManager.set("primaryForces", (new DebugTools::ForceRendererOptions)
         ->setSize(0.00025f)->setColor(Color4::fromHSV(Deg(190.0f), 0.75f, 0.9f, 0.5f)));
-    debugResourceManager.set("engines", (new DebugTools::ForceRendererOptions)
-        ->setSize(0.00025f)->setColor(Color4::fromHSV(Deg(50.0f), 0.75f, 0.9f, 0.5f)));
     debugResourceManager.set("friction", (new DebugTools::ForceRendererOptions)
         ->setSize(0.00025f)->setColor(Color4::fromHSV(Deg(115.0f), 0.75f, 0.9f, 0.5f)));
     debugResourceManager.set("spring", (new DebugTools::ForceRendererOptions)
         ->setSize(0.000025f)->setColor(Color4(1.0f, 1.0f)));
-    debugResourceManager.set("total", (new DebugTools::ForceRendererOptions)
-        ->setSize(0.00025f)->setColor(Color4::fromHSV(Deg(245.0f), 0.75f, 0.9f, 0.75f)));
     debugResourceManager.set("collision", (new DebugTools::ShapeRendererOptions)
         ->setPointSize(0.1f)->setColor(Color4::fromHSV(Deg(25.0f), 0.75f, 0.9f, 0.75f)));
     debugResourceManager.set("vehicle", (new DebugTools::ShapeRendererOptions)
@@ -248,20 +241,16 @@
     new DebugTools::ObjectRenderer2D(vehicle, "parameters", &drawables);

     /* Gravity force visualization */
-    new DebugTools::ForceRenderer2D(vehicle, {}, &forces.weight, "weight", &drawables);
+    new DebugTools::ForceRenderer2D(vehicle, {}, &forces.weight, "primaryForces", &drawables);

     /* Engine, friction and spring forces visualization */
-    new DebugTools::ForceRenderer2D(engineLeft, {}, &forces.engineLeftArm, "engines", &drawables);
-    new DebugTools::ForceRenderer2D(engineRight, {}, &forces.engineRightArm, "engines", &drawables);
+    new DebugTools::ForceRenderer2D(engineLeft, {}, &forces.engineLeftArm, "primaryForces", &drawables);
+    new DebugTools::ForceRenderer2D(engineRight, {}, &forces.engineRightArm, "primaryForces", &drawables);
     new DebugTools::ForceRenderer2D(engineLeft, {}, &forces.frictionLeftArm, "friction", &drawables);
     new DebugTools::ForceRenderer2D(engineRight, {}, &forces.frictionRightArm, "friction", &drawables);
     for(std::size_t i = 0; i != 3; ++i)
         new DebugTools::ForceRenderer2D(vehicle, shapes.vehicle->shape().get<Shapes::Point2D>(i).position(),
             &forces.spring[i], "spring", &drawables);
-
-    /* Total forces visualization */
-    new DebugTools::ForceRenderer2D(engineLeft, {}, &forces.totalLeftArm, "total", &drawables);
-    new DebugTools::ForceRenderer2D(engineRight, {}, &forces.totalRightArm, "total", &drawables);

     /* Zero-time physics step */
     timeline.start();
@@ -386,8 +375,8 @@

 void Forces2D::physicsStep(const Float, const Float) {
     /* Reset forces */
-    forces.totalLeftArm = forces.totalRightArm =
-        forces.frictionLeftArm = forces.frictionRightArm =
+    forces.engineLeftArm = forces.engineRightArm =
+        forces.friction[0] = forces.friction[1] = forces.friction[2] =
             forces.spring[0] = forces.spring[1] = forces.spring[2] = {};

     /* Get engine force direction from transformations */
@@ -397,13 +386,11 @@
     /* Add engine forces */
     forces.engineLeftArm = engineDirectionLeft*state.currentPowerLeftArm;
     forces.engineRightArm = -engineDirectionRight*state.currentPowerRightArm;
-    forces.totalLeftArm += forces.engineLeftArm;
-    forces.totalRightArm += forces.engineRightArm;

     /* Apply forces */
     applyForce(vehicle->absoluteTransformation().translation(), forces.weight);
-    applyForce(engineLeft->absoluteTransformation().translation(), forces.totalLeftArm);
-    applyForce(engineRight->absoluteTransformation().translation(), forces.totalRightArm);
+    applyForce(engineLeft->absoluteTransformation().translation(), forces.engineLeftArm);
+    applyForce(engineRight->absoluteTransformation().translation(), forces.engineRightArm);

     /* Apply spring forces for all penetrations */
     collisionShapes.setClean();


Fixed half carry after logical operation.s

--- Processors/Z80/Z80.hpp
+++ Processors/Z80/Z80.hpp
@@ -595,6 +595,7 @@

 					case MicroOp::And:
 						a_ &= *(uint8_t *)operation->source;
+						half_carry_flag_ = Flag::HalfCarry;
 						sign_result_ = zero_result_ = bit5_result_ = bit3_result_ = a_;
 						parity_overflow_flag_ = 0;
 						set_parity(a_);
@@ -602,6 +603,7 @@

 					case MicroOp::Or:
 						a_ |= *(uint8_t *)operation->source;
+						half_carry_flag_ = 0;
 						sign_result_ = zero_result_ = bit5_result_ = bit3_result_ = a_;
 						parity_overflow_flag_ = 0;
 						set_parity(a_);
@@ -609,6 +611,7 @@

 					case MicroOp::Xor:
 						a_ ^= *(uint8_t *)operation->source;
+						half_carry_flag_ = 0;
 						sign_result_ = zero_result_ = bit5_result_ = bit3_result_ = a_;
 						parity_overflow_flag_ = 0;
 						set_parity(a_);


slow progress - not yet usable

slow progress - not yet usable

--- iOS/G3MiOSSDK/Commons/Rendererers/HUDQuadWidget.cpp
+++ iOS/G3MiOSSDK/Commons/Rendererers/HUDQuadWidget.cpp
@@ -19,7 +19,9 @@
 #include "DirectMesh.hpp"
 #include "TexturedMesh.hpp"

+
 class HUDQuadWidget_ImageDownloadListener : public IImageDownloadListener {
+private:
   HUDQuadWidget* _quadWidget;

 public:


Option for null context in n-gram query, use tab for delimiter

git-svn-id: f5d636078e73450abf2183305c5e43efec2a5605@3871 1f5c12ca-751b-0410-a591-d2e778427230

--- kenlm/lm/ngram_query.cc
+++ kenlm/lm/ngram_query.cc
@@ -35,14 +35,14 @@
   }
 }

-template <class Model> void Query(const Model &model) {
+template <class Model> void Query(const Model &model, bool sentence_context) {
   PrintUsage("Loading statistics:\n");
   typename Model::State state, out;
   lm::FullScoreReturn ret;
   std::string word;

   while (std::cin) {
-    state = model.BeginSentenceState();
+    state = sentence_context ? model.BeginSentenceState() : model.NullContextState();
     float total = 0.0;
     bool got = false;
     unsigned int oov = 0;
@@ -52,7 +52,7 @@
       if (vocab == 0) ++oov;
       ret = model.FullScore(state, vocab, out);
       total += ret.prob;
-      std::cout << word << '=' << vocab << ' ' << static_cast<unsigned int>(ret.ngram_length)  << ' ' << ret.prob << '\n';
+      std::cout << word << '=' << vocab << ' ' << static_cast<unsigned int>(ret.ngram_length)  << ' ' << ret.prob << '\t';
       state = out;
       char c;
       while (true) {
@@ -67,9 +67,11 @@
       if (c == '\n') break;
     }
     if (!got && !std::cin) break;
-    ret = model.FullScore(state, model.GetVocabulary().EndSentence(), out);
-    total += ret.prob;
-    std::cout << "</s>=" << model.GetVocabulary().EndSentence() << ' ' << static_cast<unsigned int>(ret.ngram_length)  << ' ' << ret.prob << '\n';
+    if (sentence_context) {
+      ret = model.FullScore(state, model.GetVocabulary().EndSentence(), out);
+      total += ret.prob;
+      std::cout << "</s>=" << model.GetVocabulary().EndSentence() << ' ' << static_cast<unsigned int>(ret.ngram_length)  << ' ' << ret.prob << '\t';
+    }
     std::cout << "Total: " << total << " OOV: " << oov << '\n';
   }
   PrintUsage("After queries:\n");
@@ -82,29 +84,30 @@
 }

 int main(int argc, char *argv[]) {
-  if (argc < 2) {
-    std::cerr << "Pass language model name." << std::endl;
-    return 0;
+  if (!(argc == 2 || (argc == 3 && !strcmp(argv[2], "null")))) {
+    std::cerr << "Usage: " << argv[0] << " lm_file [null]" << std::endl;
+    std::cerr << "Input is wrapped in <s> and </s> unless null is passed." << std::endl;
+    return 1;
   }
+  bool sentence_context = (argc == 2);
   lm::ngram::ModelType model_type;
   if (lm::ngram::RecognizeBinary(argv[1], model_type)) {
     switch(model_type) {
       case lm::ngram::HASH_PROBING:
-        Query<lm::ngram::ProbingModel>(argv[1]);
+        Query<lm::ngram::ProbingModel>(argv[1], sentence_context);
+        break;
+      case lm::ngram::TRIE_SORTED:
+        Query<lm::ngram::TrieModel>(argv[1], sentence_context);
         break;
       case lm::ngram::HASH_SORTED:
-        Query<lm::ngram::SortedModel>(argv[1]);
-        break;
-      case lm::ngram::TRIE_SORTED:
-        Query<lm::ngram::TrieModel>(argv[1]);
-        break;
       default:
         std::cerr << "Unrecognized kenlm model type " << model_type << std::endl;
         abort();
     }
   } else {
-    Query<lm::ngram::ProbingModel>(argv[1]);
+    Query<lm::ngram::ProbingModel>(argv[1], sentence_context);
   }

   PrintUsage("Total time including destruction:\n");
+  return 0;
 }


Add utility for converting std::vector types

--- include/chaiscript/dispatchkit/type_conversions.hpp
+++ include/chaiscript/dispatchkit/type_conversions.hpp
@@ -575,6 +575,25 @@
       return chaiscript::make_shared<detail::Type_Conversion_Base, detail::Type_Conversion_Impl<decltype(func)>>(user_type<From>(), user_type<To>(), func);
     }

+  template<typename To>
+    Type_Conversion vector_conversion()
+    {
+      auto func = [](const Boxed_Value &t_bv) -> Boxed_Value {
+        const std::vector<Boxed_Value> &from_vec = detail::Cast_Helper<const std::vector<Boxed_Value> &>::cast(t_bv, nullptr);
+
+
+        To vec;
+
+        for (const Boxed_Value &bv : from_vec) {
+          vec.push_back(detail::Cast_Helper<typename To::value_type>::cast(bv, nullptr));
+        }
+
+        return Boxed_Value(std::move(vec));
+      };
+
+      return chaiscript::make_shared<detail::Type_Conversion_Base, detail::Type_Conversion_Impl<decltype(func)>>(user_type<std::vector<Boxed_Value>>(), user_type<To>(), func);
+    }
+
 }


Fix pattern search

Fix pattern search

positions need to be cleared before the function returns.

--- src/pattern_search.cpp
+++ src/pattern_search.cpp
@@ -3,11 +3,11 @@
 void findPattern(const string& pattern, const string& text,
   vector<int> *ppositions) {

+  auto& positions = *ppositions;
+  positions.clear();
+
   if (pattern.empty())
     return;
-
-  auto& positions = *ppositions;
-  positions.clear();

   for (size_t i = 0; i < text.size(); i++) {
     bool found = true;


Bug fix in SkPDFImage.

Bug fix in SkPDFImage.

Need to lock the pixels to make sure they are there.

Review URL: http://codereview.appspot.com/2717041

git-svn-id: e8541e15acce502a64c929015570ad1648e548cd@615 2bbb7eff-a529-9590-31e7-b0007b416f81

--- src/pdf/SkPDFImage.cpp
+++ src/pdf/SkPDFImage.cpp
@@ -31,6 +31,7 @@
 SkMemoryStream* extractImageData(const SkBitmap& bitmap) {
     SkMemoryStream* result;

+    bitmap.lockPixels();
     switch (bitmap.getConfig()) {
         case SkBitmap::kIndex8_Config:
             result = new SkMemoryStream(bitmap.getPixels(), bitmap.getSize(),
@@ -110,6 +111,7 @@
         default:
             SkASSERT(false);
     }
+    bitmap.unlockPixels();
     return result;
 }


Fixed a bug for BST implementation.

Fixed a bug for BST implementation.

--- MITCourses/MITCourses/BinarySearchTree/main.cpp
+++ MITCourses/MITCourses/BinarySearchTree/main.cpp
@@ -86,12 +86,12 @@

 void insert(Node** root, Node* newNode)
 {
-	if (newNode == nullptr)
+	if (newNode == nullptr || root == nullptr)
 	{
 		return;
 	}

-	if (root == nullptr || *root == nullptr)
+	if (*root == nullptr)
 	{
 		*root = newNode;
 		newNode->p = nullptr;