Remove extraneous return value from insertValue and getOrCreateSlot.  Since
getOrCreateSlot no longer gets the slot, rename it to CreateSlot.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@33035 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/VMCore/AsmWriter.cpp
+++ lib/VMCore/AsmWriter.cpp
@@ -102,15 +102,12 @@
   /// This function does the actual initialization.
   inline void initialize();

-  /// Values can be crammed into here at will. If they haven't
-  /// been inserted already, they get inserted, otherwise they are ignored.
-  /// Either way, the slot number for the Value* is returned.
-  unsigned getOrCreateSlot(const Value *V);
-
-  /// Insert a value into the value table. Return the slot number
-  /// that it now occupies.  BadThings(TM) will happen if you insert a
-  /// Value that's already been inserted.
-  unsigned insertValue(const Value *V);
+  /// CreateSlot - If the specified Value* doesn't have a name, assign it a slot
+  /// number.
+  void CreateSlot(const Value *V);
+
+  /// Insert a value into the value table.
+  void insertValue(const Value *V);

   /// Add all of the module level global variables (and their initializers)
   /// and function declarations, but not the contents of those functions.
@@ -1427,13 +1424,13 @@
   for (Module::const_global_iterator I = TheModule->global_begin(),
        E = TheModule->global_end(); I != E; ++I)
     if (!I->hasName())
-      getOrCreateSlot(I);
+      CreateSlot(I);

   // Add all the unnamed functions to the table.
   for (Module::const_iterator I = TheModule->begin(), E = TheModule->end();
        I != E; ++I)
     if (!I->hasName())
-      getOrCreateSlot(I);
+      CreateSlot(I);

   SC_DEBUG("end processModule!\n");
 }
@@ -1447,7 +1444,7 @@
   for(Function::const_arg_iterator AI = TheFunction->arg_begin(),
       AE = TheFunction->arg_end(); AI != AE; ++AI)
     if (!AI->hasName())
-      getOrCreateSlot(AI);
+      CreateSlot(AI);

   SC_DEBUG("Inserting Instructions:\n");

@@ -1455,10 +1452,10 @@
   for (Function::const_iterator BB = TheFunction->begin(),
        E = TheFunction->end(); BB != E; ++BB) {
     if (!BB->hasName())
-      getOrCreateSlot(BB);
+      CreateSlot(BB);
     for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I)
       if (I->getType() != Type::VoidTy && !I->hasName())
-        getOrCreateSlot(I);
+        CreateSlot(I);
   }

   FunctionProcessed = true;
@@ -1467,9 +1464,8 @@
 }

 /// Clean up after incorporating a function. This is the only way to get out of
-/// the function incorporation state that affects the
-/// getSlot/getOrCreateSlot lock. Function incorporation state is indicated
-/// by TheFunction != 0.
+/// the function incorporation state that affects getSlot/CreateSlot. Function
+/// incorporation state is indicated by TheFunction != 0.
 void SlotMachine::purgeFunction() {
   SC_DEBUG("begin purgeFunction!\n");
   fMap.clear(); // Simply discard the function level map
@@ -1479,8 +1475,7 @@
 }

 /// Get the slot number for a value. This function will assert if you
-/// ask for a Value that hasn't previously been inserted with getOrCreateSlot.
-/// Types are forbidden because Type does not inherit from Value (any more).
+/// ask for a Value that hasn't previously been inserted with CreateSlot.
 int SlotMachine::getSlot(const Value *V) {
   assert(V && "Can't get slot for null Value");
   assert(!isa<Constant>(V) || isa<GlobalValue>(V) &&
@@ -1540,10 +1535,8 @@
 }

-// Create a new slot, or return the existing slot if it is already
-// inserted. Note that the logic here parallels getSlot but instead
-// of asserting when the Value* isn't found, it inserts the value.
-unsigned SlotMachine::getOrCreateSlot(const Value *V) {
+/// CreateSlot - Create a new slot for the specified value if it has no name.
+void SlotMachine::CreateSlot(const Value *V) {
   const Type* VTy = V->getType();
   assert(VTy != Type::VoidTy && !V->hasName() && "Doesn't need a slot!");
   assert(!isa<Constant>(V) || isa<GlobalValue>(V) &&
@@ -1557,32 +1550,21 @@
     TypedPlanes::const_iterator FI = fMap.find(VTy);
     // If there is a corresponding type plane in the function map
     if (FI != fMap.end()) {
-      // Lookup the Value in the function map
+      // Lookup the Value in the function map.
       ValueMap::const_iterator FVI = FI->second.map.find(V);
-      // If the value doesn't exist in the function map
-      if (FVI == FI->second.map.end()) {
-        // If there is no corresponding type plane in the module map
-        if (MI == mMap.end())
-          return insertValue(V);
-        // Look up the value in the module map
-        ValueMap::const_iterator MVI = MI->second.map.find(V);
-        // If we didn't find it, it wasn't inserted
-        if (MVI == MI->second.map.end())
-          return insertValue(V);
-        else
-          // We found it only at the module level
-          return MVI->second;
-
-      // else the value exists in the function map
-      } else {
-        if (MI == mMap.end())
-          return FVI->second;
-        else
-          // Return the slot number as the module's contribution to
-          // the type plane plus the index in the function's contribution
-          // to the type plane.
-          return MI->second.next_slot + FVI->second;
-      }
+      // If the value exists in the function map, we're done.
+      if (FVI != FI->second.map.end())
+        return;
+
+      // If there is no corresponding type plane in the module map
+      if (MI == mMap.end())
+        return insertValue(V);
+      // Look up the value in the module map
+      ValueMap::const_iterator MVI = MI->second.map.find(V);
+      // If we found it, it was already inserted
+      if (MVI != MI->second.map.end())
+        return;
+      return insertValue(V);

     // else there is not a corresponding type plane in the function map
     } else {
@@ -1597,9 +1579,9 @@
         if (MVI == MI->second.map.end())
           // Return the slot number as the module's contribution to
           // the type plane plus the index of the function map insertion.
-          return MI->second.next_slot + insertValue(V);
+          return insertValue(V);
         else
-          return MVI->second;
+          return;
       }
     }
   }
@@ -1611,7 +1593,7 @@
     // Lookup the value in the module's map
     ValueMap::const_iterator MVI = MI->second.map.find(V);
     if (MVI != MI->second.map.end())
-      return MVI->second;
+      return;
   }

   return insertValue(V);
@@ -1619,8 +1601,8 @@

 // Low level insert function. Minimal checking is done. This
-// function is just for the convenience of getOrCreateSlot (above).
-unsigned SlotMachine::insertValue(const Value *V) {
+// function is just for the convenience of CreateSlot (above).
+void SlotMachine::insertValue(const Value *V) {
   assert(V && "Can't insert a null Value into SlotMachine!");
   assert(!isa<Constant>(V) || isa<GlobalValue>(V) &&
          "Can't insert a non-GlobalValue Constant into SlotMachine");
@@ -1646,5 +1628,4 @@
   // G = Global, F = Function, o = other
   SC_DEBUG((isa<GlobalVariable>(V) ? 'G' : (isa<Function>(V) ? 'F' : 'o')));
   SC_DEBUG("]\n");
-  return DestSlot;
-}
+}


Fix reseting bug

Fix reseting bug

--- libtatum/graph_visitors/CommonAnalysisOps.hpp
+++ libtatum/graph_visitors/CommonAnalysisOps.hpp
@@ -18,8 +18,8 @@
     public:
         CommonAnalysisOps(size_t num_tags)
             : data_tags_(num_tags, NUM_DATA_TAGS_RESERVE)
-            , clock_launch_tags_(num_tags, NUM_CLK_TAGS_RESERVE)
-            , clock_capture_tags_(num_tags, NUM_CLK_TAGS_RESERVE) {}
+            , clock_launch_tags_(num_tags, NUM_CLOCK_TAGS_RESERVE)
+            , clock_capture_tags_(num_tags, NUM_CLOCK_TAGS_RESERVE) {}

         TimingTags& get_data_tags(const NodeId node_id) { return data_tags_[node_id]; }
         TimingTags& get_launch_clock_tags(const NodeId node_id) { return clock_launch_tags_[node_id]; }
@@ -29,14 +29,14 @@
         const TimingTags& get_capture_clock_tags(const NodeId node_id) const { return clock_capture_tags_[node_id]; }

         void reset() {
-            data_tags_.clear();
-            clock_launch_tags_.clear();
-            clock_capture_tags_.clear();
+            data_tags_ = tatum::util::linear_map<NodeId,TimingTags>(data_tags_.size(), NUM_DATA_TAGS_RESERVE);
+            clock_launch_tags_ = tatum::util::linear_map<NodeId,TimingTags>(clock_launch_tags_.size(), NUM_CLOCK_TAGS_RESERVE);
+            clock_capture_tags_ = tatum::util::linear_map<NodeId,TimingTags>(clock_capture_tags_.size(), NUM_CLOCK_TAGS_RESERVE);
         }

     private:
         constexpr static size_t NUM_DATA_TAGS_RESERVE = 1;
-        constexpr static size_t NUM_CLK_TAGS_RESERVE = 0;
+        constexpr static size_t NUM_CLOCK_TAGS_RESERVE = 0;
         tatum::util::linear_map<NodeId,TimingTags> data_tags_;
         tatum::util::linear_map<NodeId,TimingTags> clock_launch_tags_;
         tatum::util::linear_map<NodeId,TimingTags> clock_capture_tags_;


Trivial change to save intel-12.0 from itself.

Seriously, this fixes a new issue:

  CXX    src/fe/libmesh_opt_la-fe_hierarchic.lo
src/error_estimation/kelly_error_estimator.C(140) (col. 45): internal error: 0_1451

compilation aborted for src/error_estimation/kelly_error_estimator.C (code 4)
make[1]: *** [src/error_estimation/libmesh_opt_la-kelly_error_estimator.lo] Error 1
make[1]: *** Waiting for unfinished jobs....

which must have been triggered by changes in the underlying header files,
as this file has not changed in ages.

--- src/error_estimation/kelly_error_estimator.C
+++ src/error_estimation/kelly_error_estimator.C
@@ -100,6 +100,7 @@
 KellyErrorEstimator::boundary_side_integration ()
 {
   const std::string &var_name = my_system->variable_name(var);
+  const unsigned int n_fine_dofs = Ufine.size();

   std::vector<std::vector<RealGradient> > dphi_fine = fe_fine->get_dphi();
   std::vector<Point> face_normals = fe_fine->get_normals();
@@ -137,7 +138,7 @@
           Gradient grad_fine;

           // Compute the solution gradient on element e
-          for (unsigned int i=0; i != Ufine.size(); i++)
+          for (unsigned int i=0; i != n_fine_dofs; i++)
             grad_fine.add_scaled (dphi_fine[i][qp], Ufine(i));

           // The difference between the desired BC and the approximate solution.


Signed-off-by: mrlitong <litongtongxue@gmail.com>

--- ActorBash.cpp
+++ ActorBash.cpp
@@ -87,3 +87,7 @@
 {
 	return m_nEnable;
 }
+void CActorBase::Update(float ifps)
+{
+
+}


Add a space to the PHI node output code to make it look nicer

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@53 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/VMCore/AsmWriter.cpp
+++ lib/VMCore/AsmWriter.cpp
@@ -182,10 +182,10 @@
     Out << " " << Operand->getType();

     Out << " [";  writeOperand(Operand, false); Out << ",";
-    writeOperand(I->getOperand(1), false); Out << "]";
+    writeOperand(I->getOperand(1), false); Out << " ]";
     for (unsigned op = 2; (Operand = I->getOperand(op)); op += 2) {
       Out << ", [";  writeOperand(Operand, false); Out << ",";
-      writeOperand(I->getOperand(op+1), false); Out << "]";
+      writeOperand(I->getOperand(op+1), false); Out << " ]";
     }
   } else if (I->getInstType() == Instruction::Ret && !Operand) {
     Out << " void";


Fixed compilation issue

Fixed compilation issue

--- src/examples/01_Platform/03_WindowEvents.cpp
+++ src/examples/01_Platform/03_WindowEvents.cpp
@@ -55,12 +55,12 @@

     // This method is called when key is pressed.
     virtual void handleKeyDown( Window* window, Key key ) {
-        platform::log::msg( "handleKeyDown : %d\n", key );
+        platform::log::msg( "handleKeyDown : %d\n", (int)key );
     }

     // This method is called when key is released.
     virtual void handleKeyUp( Window* window, Key key ) {
-        platform::log::msg( "handleKeyUp : %d\n", key );
+        platform::log::msg( "handleKeyUp : %d\n", (int)key );
     }

     // This method is called each frame


Wrap mode affects NPOT texture completeness

TRAC #11861

If mipmapping is enabled, then each side of a texture must be a power-of-two or using CLAMP_TO_EDGE wrapping in that direction.
Correct the mipmap size calculation to match the spec.

Signed-off-by: Shannon Woods
Signed-off-by: Daniel Koch

Author:    Andrew Lewycky

git-svn-id: 947ae547afacb859f3991e003b9d6feb04be57d7@179 736b8ea6-26fd-11df-bfd4-992fa37f6226

--- src/libGLESv2/Texture.cpp
+++ src/libGLESv2/Texture.cpp
@@ -630,6 +630,12 @@

     if (mipmapping)
     {
+        if ((getWrapS() != GL_CLAMP_TO_EDGE && !isPow2(width))
+            || (getWrapT() != GL_CLAMP_TO_EDGE && !isPow2(height)))
+        {
+            return false;
+        }
+
         int q = log2(std::max(width, height));

         for (int level = 1; level <= q; level++)
@@ -639,12 +645,12 @@
                 return false;
             }

-            if (mImageArray[level].width != (mImageArray[level - 1].width + 1) / 2)
+            if (mImageArray[level].width != std::max(1, width >> level))
             {
                 return false;
             }

-            if (mImageArray[level].height != (mImageArray[level - 1].height + 1) / 2)
+            if (mImageArray[level].height != std::max(1, height >> level))
             {
                 return false;
             }
@@ -998,6 +1004,11 @@

     if (mipmapping)
     {
+        if (!isPow2(size) && (getWrapS() != GL_CLAMP_TO_EDGE || getWrapT() != GL_CLAMP_TO_EDGE))
+        {
+            return false;
+        }
+
         int q = log2(size);

         for (int face = 0; face < 6; face++)
@@ -1009,15 +1020,12 @@
                     return false;
                 }

-                if (mImageArray[face][level].width != (mImageArray[0][level - 1].width + 1) / 2)
+                if (mImageArray[face][level].width != std::max(1, size >> level))
                 {
                     return false;
                 }

-                if (mImageArray[face][level].height != (mImageArray[0][level - 1].height + 1) / 2)
-                {
-                    return false;
-                }
+                ASSERT(mImageArray[face][level].height == mImageArray[face][level].width);
             }
         }
     }


--- ActorBash.cpp
+++ ActorBash.cpp
@@ -1,6 +1,9 @@
 #include "Engine.h"
 #include "Game.h"
 #include "ObjectDummy.h"
+#include "BodyRigid.h"
+#include "BodyDummy.h"
+

 #ifdef MEMORY_INFO
@@ -25,4 +28,5 @@
 		m_pStates[i] = 0;
 		m_pTimes[i] = 0.0f;
 	}
+
 }


Fix a typo in an assertion comment.
Patch contributed by Vladimir Merzliakov.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@20529 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/VMCore/Constants.cpp
+++ lib/VMCore/Constants.cpp
@@ -221,7 +221,7 @@

 ConstantSInt::ConstantSInt(const Type *Ty, int64_t V) : ConstantInt(Ty, V) {
   assert(Ty->isInteger() && Ty->isSigned() &&
-         "Illegal type for unsigned integer constant!");
+         "Illegal type for signed integer constant!");
   assert(isValueValidForType(Ty, V) && "Value too large for type!");
 }


(swirl) Add clawpack vtable

(swirl) Add clawpack vtable

--- applications/advection/2d/swirl/swirl_user.cpp
+++ applications/advection/2d/swirl/swirl_user.cpp
@@ -35,6 +35,17 @@
 #endif
 #endif

+static const fc2d_clawpack46_vtable_t classic_user =
+{
+    setprob_,
+    NULL,  /* bc2 */
+    qinit_,
+    setaux_,
+    b4step2_,
+    NULL  /* src2 */
+};
+
+
 void swirl_link_solvers(fclaw2d_domain_t *domain)
 {
     fclaw2d_solver_functions_t* sf = get_solver_functions(domain);
@@ -51,12 +62,14 @@
     of->f_patch_write_header = &swirl_parallel_write_header;
     of->f_patch_write_output = &swirl_parallel_write_output;

+    fc2d_clawpack46_set_vtable(&classic_user);
+
     fc2d_clawpack46_link_to_clawpatch();
 }

 void swirl_problem_setup(fclaw2d_domain_t* domain)
 {
-    fc2d_clawpack46_setprob(domain);
+    fc2d_clawpack46_setprob();
 }

@@ -77,7 +90,6 @@
 {
     fc2d_clawpack46_qinit(domain,this_patch,this_block_idx,this_patch_idx);
 }
-

 void swirl_patch_physical_bc(fclaw2d_domain *domain,
                              fclaw2d_patch_t *this_patch,


Normalize raw_lemmas case using form casing in GazetteersEnhanced.

--- src/features/feature_processor_instances.cpp
+++ src/features/feature_processor_instances.cpp
@@ -449,6 +449,10 @@
     vector<unsigned> nodes, new_nodes;
     vector<vector<ner_feature>> features(sentence.size);

+    vector<vector<string>> recased_raw_lemmas(sentence.size);
+    for (unsigned i = 0; i < sentence.size; i++)
+      recase_raw_lemmas(sentence.words[i].form, sentence.words[i].raw_lemmas_all, recased_raw_lemmas[i]);
+
     for (unsigned i = 0; i < sentence.size; i++) {
       unsigned hard_pre_length = 0, hard_pre_node = -1;
       bool hard_pre_possible = true;
@@ -457,7 +461,7 @@
         new_nodes.clear();
         for (auto&& node : nodes)
           if (!gazetteers_trie[node].children.empty())
-            for (auto&& raw_lemma : sentence.words[j].raw_lemmas_all) {
+            for (auto&& raw_lemma : recased_raw_lemmas[j]) {
               auto range = gazetteers_trie[node].children.equal_range(raw_lemma);
               for (auto&& it = range.first; it != range.second; it++)
                 append_unless_exists(new_nodes, it->second);
@@ -505,8 +509,11 @@
   virtual void process_entities(ner_sentence& sentence, vector<named_entity>& entities, vector<named_entity>& buffer) const override {
     vector<unsigned> nodes, new_nodes;

+    vector<vector<string>> recased_raw_lemmas(sentence.size);
+    for (unsigned i = 0; i < sentence.size; i++)
+      recase_raw_lemmas(sentence.words[i].form, sentence.words[i].raw_lemmas_all, recased_raw_lemmas[i]);
+
     buffer.clear();
-
     unsigned entity_until = 0;
     for (unsigned i = 0, e = 0; i < sentence.size; i++) {
       while (e < entities.size() && entities[e].start == i) {
@@ -525,7 +532,7 @@
           new_nodes.clear();
           for (auto&& node : nodes)
             if (!gazetteers_trie[node].children.empty())
-              for (auto&& raw_lemma : sentence.words[j].raw_lemmas_all) {
+              for (auto&& raw_lemma : recased_raw_lemmas[j]) {
                 auto range = gazetteers_trie[node].children.equal_range(raw_lemma);
                 for (auto&& it = range.first; it != range.second; it++)
                   append_unless_exists(new_nodes, it->second);
@@ -539,8 +546,10 @@
           nodes.swap(new_nodes);
         }

-        if (hard_post_length)
+        if (hard_post_length) {
           buffer.emplace_back(i, hard_post_length, entity_list[gazetteers_trie[hard_post_node].entity]);
+          entity_until = i + hard_post_length;
+        }
       }
     }

@@ -624,6 +633,7 @@
     unordered_map<string, int> gazetteer_prefixes;
     vector<string_piece> gazetteer_tokens, gazetteer_tokens_additional, gazetteer_token(1);
     ner_sentence gazetteer_token_tagged;
+    vector<string> gazetteer_recased_raw_lemmas;

     gazetteers_trie.clear();
     gazetteers_trie.emplace_back();
@@ -647,7 +657,9 @@

             gazetteer_token[0] = string_piece(gazetteer_tokens[token]);
             pipeline.tagger->tag(gazetteer_token, gazetteer_token_tagged);
-            for (auto&& raw_lemma : gazetteer_token_tagged.words[0].raw_lemmas_all)
+            recase_raw_lemmas(gazetteer_token[0], gazetteer_token_tagged.words[0].raw_lemmas_all,
+                              gazetteer_recased_raw_lemmas);
+            for (auto&& raw_lemma : gazetteer_recased_raw_lemmas)
               gazetteers_trie[node].children.emplace(raw_lemma, new_node);

             node = new_node;
@@ -665,6 +677,30 @@
       }

     return true;
+  }
+
+  static void recase_raw_lemmas(string_piece form, const vector<string>& raw_lemmas, vector<string>& recased_raw_lemmas) {
+    using namespace unilib;
+
+    bool any_lower = false, first_uc = false, first = true;
+    for (auto&& chr : utf8::decoder(form.str, form.len)) {
+      any_lower = any_lower || (unicode::category(chr) & unicode::Ll);
+      if (first) first_uc = unicode::category(chr) & unicode::Lut;
+      first = false;
+    }
+
+    recased_raw_lemmas.clear();
+    recased_raw_lemmas.reserve(raw_lemmas.size());
+    for (auto&& raw_lemma : raw_lemmas) {
+      recased_raw_lemmas.emplace_back();
+
+      first = true;
+      for (auto&& chr : utf8::decoder(raw_lemma)) {
+        utf8::append(recased_raw_lemmas.back(),
+                     (first_uc && (first || !any_lower)) ? unicode::uppercase(chr) : unicode::lowercase(chr));
+        first = false;
+      }
+    }
   }
 };
 const vector<string> gazetteers_enhanced::basename_suffixes = {".txt", ".hard_pre.txt", ".hard_post.txt"};


Use CAN write queue when acting as a transmitter.

--- src/cantranslator.cpp
+++ src/cantranslator.cpp
@@ -18,7 +18,6 @@
 void receiveCan(CanBus*);
 void initializeAllCan();
 bool receiveWriteRequest(uint8_t*);
-bool receiveCANWriteRequest(uint8_t*);

 void setup() {
     initializeLogging();
@@ -32,16 +31,11 @@
         receiveCan(&getCanBuses()[i]);
     }
     processListenerQueues(&listener);
-#ifdef TRANSMITTER
-    readFromHost(&USB_DEVICE, &receiveCANWriteRequest);
-    readFromSerial(&SERIAL_DEVICE, &receiveCANWriteRequest);
-#else
     readFromHost(&USB_DEVICE, &receiveWriteRequest);
     readFromSerial(&SERIAL_DEVICE, &receiveWriteRequest);
     for(int i = 0; i < getCanBusCount(); i++) {
         processCanWriteQueue(&getCanBuses()[i]);
     }
-#endif
 }

 void initializeAllCan() {
@@ -49,52 +43,6 @@
         initializeCan(&(getCanBuses()[i]));
     }
 }
-#ifdef TRANSMITTER
-bool receiveCANWriteRequest(uint8_t* message) {
-    int index=0;
-    int packetLength = 15;
-
-    while(true) {
-      if(message[index] == '!') {
-        return true;
-      }
-
-      if (index + packetLength >= 64) {
-          debug("!");
-      }
-
-      if(message[index] != '{' || message[index+5] != '|'
-              || message[index+14] != '}') {
-          debug("Received a corrupted CAN message.\r\n");
-          for(int i = 0; i < 16; i++) {
-              debug("%02x ", message[index+i] );
-          }
-          debug("\r\n");
-          return false;
-      }
-
-      CanMessage outGoing = {0, 0};
-
-      memcpy((uint8_t*)&outGoing.id, &message[index+1], 4);
-
-      for(int i = 0; i < 8; i++) {
-          ((uint8_t*)&(outGoing.data))[i] = message[index+i+6];
-      }
-
-      //    debug("Sending CAN message id = 0x%02x, data = 0x", outGoing.id);
-      //for(int i = 0; i < 8; i++) {
-      //    debug("%02x ", ((uint8_t*)&(outGoing.data))[i] );
-      //}
-      //debug("\r\n");
-
-      sendCanMessage(&(getCanBuses()[0]), outGoing);
-      index += packetLength;
-    }
-
-    return true;
-}
-
-#else    //ifdef TRANSMITTER

 bool receiveRawWriteRequest(cJSON* idObject, cJSON* root) {
     int id = idObject->valueint;
@@ -110,7 +58,34 @@
 }

 bool receiveWriteRequest(uint8_t* message) {
+#ifdef TRANSMITTER
+    int index = 0;
+    const int BINARY_CAN_WRITE_PACKET_LENGTH = 15;

+    while(message[index] != '!') {
+        if (index + BINARY_CAN_WRITE_PACKET_LENGTH >= 64) {
+            debug("!");
+        }
+
+        if(message[index] != '{' || message[index+5] != '|'
+                || message[index+14] != '}') {
+            debug("Received a corrupted CAN message.\r\n");
+            for(int i = 0; i < 16; i++) {
+                debug("%02x ", message[index+i] );
+            }
+            debug("\r\n");
+            return false;
+        }
+
+        CanMessage outgoing = {0, 0};
+        memcpy((uint8_t*)&outgoing.id, &message[index+1], 4);
+        for(int i = 0; i < 8; i++) {
+            ((uint8_t*)&(outgoing.data))[i] = message[index+i+6];
+        }
+        QUEUE_PUSH(CanMessage, &getCanBuses()[0].sendQueue, outgoing);
+    }
+    return true;
+#else
     cJSON *root = cJSON_Parse((char*)message);
     if(root != NULL) {
         cJSON* nameObject = cJSON_GetObjectItem(root, "name");
@@ -147,8 +122,9 @@
         return true;
     }
     return false;
+#endif
 }
-#endif
+
 /*
  * Check to see if a packet has been received. If so, read the packet and print
  * the packet payload to the serial monitor.


Handle isolated and double dollar sign properly

--- src/libmare/Namespace.cpp
+++ src/libmare/Namespace.cpp
@@ -22,43 +22,55 @@
     static void handle(Engine& engine, const char*& input, String& output, const char* endchars, bool evaluate = true)
     {
       while(*input && !strchr(endchars, *input))
-        if(*input == '$' && input[1] == '(')
+      {
+        if(*input == '$')
         {
-          input += 2;
-          String varOrCommand;
-          handle(engine, input, varOrCommand, " )", evaluate);
-          if(*input == ' ')
+          if(input[1] == '(')
           {
-            ++input;
+            input += 2;
+            String varOrCommand;
+            handle(engine, input, varOrCommand, " )", evaluate);
+            if(*input == ' ')
+            {
+              ++input;
+              if(evaluate)
+                handleCommand(engine, varOrCommand, input, output);
+
+              // skip further arguements
+              if(*input && *input != ')')
+                for(;;)
+                {
+                  handle(engine, input, output, ",)", false);
+                  if(*input != ',')
+                    break;
+                  ++input;
+                }
+            }
+            else
+            {
+              if(evaluate)
+                handleVariable(engine, varOrCommand, output);
+            }
+            if(*input == ')')
+              ++input;
+          }
+          else if(input[1] == '$')
+          {
+            input += 2;
             if(evaluate)
-              handleCommand(engine, varOrCommand, input, output);
-
-            // skip further arguements
-            if(*input && *input != ')')
-              for(;;)
-              {
-                handle(engine, input, output, ",)", false);
-                if(*input != ',')
-                  break;
-                ++input;
-              }
+              output.append('$');;
           }
           else
-          {
-            if(evaluate)
-              handleVariable(engine, varOrCommand, output);
-          }
-          if(*input == ')')
-            ++input;
+            ++input; // ignore isolated $ sign
+          continue;
         }
-        else
-        {
-          const char* str = input++;
-          while(*input && *input != '$' && !strchr(endchars, *input))
-            ++input;
-          if(evaluate)
-            output.append(str, input - str);
-        }
+
+        const char* str = input++;
+        while(*input && *input != '$' && !strchr(endchars, *input))
+          ++input;
+        if(evaluate)
+          output.append(str, input - str);
+      }
     }
     static void handleCommand(Engine& engine, const String& cmd, const char*& input, String& output)
     {


Fixed the segfault. Water now exists and simulates in real time, but the physics are wrong.

--- the_decomposition_of_the_world_into_blocks.cpp
+++ the_decomposition_of_the_world_into_blocks.cpp
@@ -30,12 +30,12 @@
   location worldblock::get_neighboring_loc(vector3<location_coordinate> const& old_coords, cardinal_direction dir) {
     // this could be made more effecient, but I'm not sure how
     vector3<location_coordinate> new_coords = old_coords + dir.v;
-    if (new_coords.x < global_position.x) return location(new_coords, neighbors[cdir_xminus]);
-    if (new_coords.y < global_position.y) return location(new_coords, neighbors[cdir_yminus]);
-    if (new_coords.z < global_position.z) return location(new_coords, neighbors[cdir_zminus]);
-    if (new_coords.x >= global_position.x + worldblock_dimension) return location(new_coords, neighbors[cdir_xplus]);
-    if (new_coords.y >= global_position.y + worldblock_dimension) return location(new_coords, neighbors[cdir_yplus]);
-    if (new_coords.z >= global_position.z + worldblock_dimension) return location(new_coords, neighbors[cdir_zplus]);
+    if (new_coords.x < global_position.x) return get_loc_across_boundary(new_coords, cdir_xminus);
+    if (new_coords.y < global_position.y) return get_loc_across_boundary(new_coords, cdir_yminus);
+    if (new_coords.z < global_position.z) return get_loc_across_boundary(new_coords, cdir_zminus);
+    if (new_coords.x >= global_position.x + worldblock_dimension) return get_loc_across_boundary(new_coords, cdir_xplus);
+    if (new_coords.y >= global_position.y + worldblock_dimension) return get_loc_across_boundary(new_coords, cdir_yplus);
+    if (new_coords.z >= global_position.z + worldblock_dimension) return get_loc_across_boundary(new_coords, cdir_zplus);
     return location(new_coords, this);
   }


worldblock: add useful comment from tile_physics

--- the_decomposition_of_the_world_into_blocks.cpp
+++ the_decomposition_of_the_world_into_blocks.cpp
@@ -96,6 +96,10 @@

       caller_error_if(is_busy_realizing_, "Referring to a realization level currently being computed");
       is_busy_realizing_ = true;
+
+      // Per world_building_gun, tiles start out marked interior
+      // (usually the common case, and also permits the algorithms here)
+      // and don't need to be changed if they actually are interior.

       const tile_contents estimated_most_frequent_tile_contents_type = this->estimate_most_frequent_tile_contents_type();


feat(frontends/lean/parse_tactic_location): validate occurrence index

--- src/frontends/lean/parse_tactic_location.cpp
+++ src/frontends/lean/parse_tactic_location.cpp
@@ -22,10 +22,17 @@
                     throw parser_error("invalid tactic location, cannot mix positive and negative occurrences", p.pos());
                 has_neg = true;
                 p.next();
-                occs.push_back(p.parse_small_nat());
+                auto pos   = p.pos();
+                unsigned i = p.parse_small_nat();
+                if (i == 0)
+                    throw parser_error("invalid tactic location, first occurrence is 1", pos);
+                occs.push_back(i);
             } else {
-                auto pos = p.pos();
-                occs.push_back(p.parse_small_nat());
+                auto pos   = p.pos();
+                unsigned i = p.parse_small_nat();
+                if (i == 0)
+                    throw parser_error("invalid tactic location, first occurrence is 1", pos);
+                occs.push_back(i);
                 if (has_neg)
                     throw parser_error("invalid tactic location, cannot mix positive and negative occurrences", pos);
                 has_pos = true;


Meta server: unify code in replay enqueue and set replay state methods, by moving common logic into enqueue self method.

--- src/cc/meta/Replay.cc
+++ src/cc/meta/Replay.cc
@@ -422,26 +422,11 @@
         mSubEntryCount       = 0;
         MetaRequest* next = commitQueue;
         while (next) {
-            mCurOp = next;
-            next = mCurOp->next;
-            mCurOp->next = 0;
-            if (mCurOp->replayBypassFlag ||
-                    IsMetaLogWriteOrVrError(mCurOp->status)) {
-                MetaRequest* req = mCurOp;
-                mCurOp = 0;
-                submit_request(req);
-                continue;
-            }
-            MetaVrLogSeq const nextSeq = mCurOp->logseq;
-            if (nextSeq.IsValid() && ! IsCurOpLogSeqValid()) {
-                panic("replay: set replay state invalid log sequence");
-            }
-            if (handle()) {
-                if (mLastLogAheadSeq < nextSeq) {
-                    mLastLogAheadSeq = nextSeq;
-                }
-            } else {
-                panic("replay: set replay state invalid handle completion");
+            MetaRequest& op = *next;
+            next = op.next;
+            op.next = 0;
+            if (! enqueueSelf(op)) {
+                submit_request(&op);
             }
         }
         if (! runCommitQueue(committed, seed, status, errChecksum)) {
@@ -450,14 +435,22 @@
     }
     bool enqueue(MetaRequest& req)
     {
+        if (! mReplayer) {
+            panic("replay: invalid enqueue attempt");
+            return false;
+        }
+        if (mViewStart <= mLastCommitted && mCommitQueue.empty()) {
+            return false;
+        }
+        return enqueueSelf(req);
+    }
+    bool enqueueSelf(MetaRequest& req)
+    {
+        if (mCurOp) {
+            panic("replay: invalid enqueue attempt: has pending op");
+            return false;
+        }
         if (req.replayBypassFlag || IsMetaLogWriteOrVrError(req.status)) {
-            return false;
-        }
-        if (mCurOp || ! mReplayer) {
-            panic("replay: invalid enqueue attempt");
-            return false;
-        }
-        if (mViewStart <= mLastCommitted && mCommitQueue.empty()) {
             return false;
         }
         mCurOp = &req;


MAPPING: fix the practice map as well

MAPPING: fix the practice map as well

--- src/game/server/swarm/asw_campaign_fixes.cpp
+++ src/game/server/swarm/asw_campaign_fixes.cpp
@@ -24,12 +24,14 @@
 		const char *pszMap = STRING(gpGlobals->mapname);

 		// Fixes cargo elevator leaving without all the marines if at least 4 marines are already on the elevator.
-		if (!V_stricmp(pszMap, "asi-jac1-landingbay_02"))
+		if (!V_stricmp(pszMap, "asi-jac1-landingbay_02") || !V_stricmp(pszMap, "asi-jac1-landingbay_pract"))
 		{
 			CASW_Door_Area *pMarinesPast = dynamic_cast<CASW_Door_Area *>(gEntList.FindEntityByName(NULL, "trigger_lift_marine_check"));
 			Assert(pMarinesPast);
 			if (pMarinesPast)
+			{
 				pMarinesPast->m_nPlayersRequired = ASW_MAX_MARINE_RESOURCES;
+			}
 		}

 		// Fixes the last segment of a bridge on deima being extended before the marines get there.


fixed a bug in coupling, perturbation is still a little low

--- src/libxtp/bsecoupling.cc
+++ src/libxtp/bsecoupling.cc
@@ -139,7 +139,7 @@
         for (int stateA = 0; stateA < _levA ; ++stateA ) {
            for (int stateB = 0; stateB <_levB ; ++stateB ) {
                real_gwbse JAB = getSingletCouplingElement( stateA , stateB );
-               //real_gwbse energyAD = getSingletDimerEnergy( stateA  );
+               //real_gwbse_gwbse energyAD = getSingletDimerEnergy( stateA  );
                //real_gwbse energyBD = getSingletDimerEnergy( stateB  );
                Property *_coupling_summary = &_singlet_summary->add("coupling", boost::lexical_cast<string>(JAB));
                real_gwbse energyA = _orbitalsA->BSESingletEnergies()(stateA)*conv::ryd2ev_f;
@@ -628,7 +628,8 @@
     int _levelsA = _orbitalsA->getNumberOfLevels();
     int _levelsB = _orbitalsB->getNumberOfLevels();

-
+    boost::timer t; // start timing
+    //double _st = t.elapsed();

     // get exciton information of molecule A
     int _bseA_cmax        = _orbitalsA->getBSEcmax();
@@ -797,13 +798,13 @@

     // psi_AxB * S_AB * psi_AB
     LOG(logDEBUG, *_pLog) << TimeStamp()  << "   projecting monomer onto dimer orbitals" << flush;
-    ub::matrix<double> _orbitalsAB_Transposed= ub::trans( _orbitalsAB->MOCoefficients() );
+    ub::matrix<double> _orbitalsAB_Transposed = ub::trans( *_orbitalsAB->getOrbitals() );
     if ( (*_orbitalsAB->getOverlap()).size1() == 0 ) {
             LOG(logERROR,*_pLog) << "Overlap matrix is not stored";
             return false;
     }

-    ub::matrix<double> _psi_AB = ub::prod( _orbitalsAB->AOOverlap(), _orbitalsAB_Transposed );
+    ub::matrix<double> _psi_AB = ub::prod( *_orbitalsAB->getOverlap(), _orbitalsAB_Transposed );
     ub::matrix<double> _psi_AxB_dimer_basis = ub::prod( _psi_AxB, _psi_AB );
     _psi_AB.clear();
     //cout<< "_psi_AxB_dimer"<<endl;
@@ -987,6 +988,50 @@
         if ( _singlets ) {
             LOG(logDEBUG, *_pLog) << TimeStamp()   << "   calculated singlet couplings " << flush;
         }
+        /*
+        // diagonalize the effective Hamiltonian?
+        ub::vector<real_gwbse> _coupled_energies;
+        ub::matrix<real_gwbse> _coupled_coefficients;
+	std::vector< std::vector<double> >& _free_dipolesA = _orbitalsA->TransitionDipoles();
+	std::vector< std::vector<double> >& _free_dipolesB = _orbitalsB->TransitionDipoles();
+        linalg_eigenvalues(*_JAB_singlet, _coupled_energies, _coupled_coefficients,_JAB_singlet->size1() );
+        LOG(logDEBUG, *_pLog) << TimeStamp()   << "   calculated EVs of coupling matrix " << flush;
+	cout << "\n" << endl;
+        for ( int i =0 ; i< _JAB_singlet->size1(); i++){
+
+
+	    std::vector<double> tdipole(3,0.0);
+            for ( int j = 0; j < 50; j++){
+	      tdipole[0] += _coupled_coefficients(j,i)*_free_dipolesA[j][0] + _coupled_coefficients(j+50,i)*_free_dipolesB[j][0];
+	      tdipole[1] += _coupled_coefficients(j,i)*_free_dipolesA[j][1] + _coupled_coefficients(j+50,i)*_free_dipolesB[j][1];
+	      tdipole[2] += _coupled_coefficients(j,i)*_free_dipolesA[j][2] + _coupled_coefficients(j+50,i)*_free_dipolesB[j][2];
+	    }
+	    double tdipole_strength = tdipole[0]*tdipole[0] + tdipole[1]*tdipole[1] + tdipole[2]*tdipole[2];
+            double oscillator_strength = tdipole_strength * _coupled_energies(i) /3.0;
+
+	    LOG(logINFO, *_pLog) << (format("  S = %1$4d Omega = %2$+1.4f eV  lamdba = %3$+3.2f nm ") % (i + 1) % (13.6058 * _coupled_energies(i)) % (1240.0/(13.6058 * _coupled_energies(i))) ).str() << flush;
+	    LOG(logINFO, *_pLog) << (format("           TrDipole length gauge   dx = %1$+1.4f dy = %2$+1.4f dz = %3$+1.4f |d|^2 = %4$+1.4f f = %5$+1.4f") % (tdipole[0]) % (tdipole[1]) % (tdipole[2]) % (tdipole_strength) % (oscillator_strength)).str() << flush;
+	    for (int _i_bse = 0; _i_bse < _JAB_singlet->size1(); _i_bse++) {
+	      // if contribution is larger than 0.2, print
+	      double _weight = pow(_coupled_coefficients(_i_bse, i), 2);
+	      if (_weight > 0.2) {
+                if ( _i_bse < 50) {
+		LOG(logINFO, *_pLog) << (format("           EXCITON A %1$-3d : %2$3.1f%%") % _i_bse % (100.0 * _weight)).str() << flush;
+		} else
+		  {
+		    LOG(logINFO, *_pLog) << (format("           EXCITON B %1$-3d : %2$3.1f%%") % (_i_bse-50) % (100.0 * _weight)).str() << flush;
+		  }
+	      }
+	    }
+	    LOG(logINFO, *_pLog) << (format("   ")).str() << flush;
+
+
+
+
+            cout << " E" << i << " : " << _coupled_energies(i)*13.605 << " TD " << tdipole[0] << " " << tdipole[1] << " " << tdipole[2] << endl;
+	}
+        //LOG(logDEBUG, *_pLog) << TimeStamp()   << " singlet coupling: " << _JAB_singlet->at_element(0,_bseA_singlet_exc)*13.6058 << " and " <<  _JAB_singlet->at_element(_bseA_singlet_exc, 0) * 13.6058 << endl;
+	*/
     }

@@ -996,13 +1041,20 @@
         // get triplet BSE Hamiltonian from _orbitalsAB
         ub::matrix<real_gwbse> _Hamiltonian_AB = _eh_d;

+
+
+
+        //ub::matrix<real_gwbse>& _bseA= _orbitalsA->BSETripletCoefficients();
+

         const ub::matrix<real_gwbse>& _bseA = ub::project( _orbitalsA->BSETripletCoefficients(),
                 ub::range (0, _orbitalsA->BSETripletCoefficients().size1() ), ub::range ( 0, _FeA )  );
         const ub::matrix<real_gwbse>& _bseB = ub::project( _orbitalsB->BSETripletCoefficients(),
                 ub::range (0, _orbitalsB->BSETripletCoefficients().size1() ), ub::range ( 0, _FeB )  );
-
-
+        //ub::matrix<real_gwbse>& _bseB = _orbitalsB->BSETripletCoefficients();
+
+
+

         bool _triplets = ProjectExcitons( _kap, _kbp,ctAB,ctBA, _bseA, _bseB, _Hamiltonian_AB, JAB_triplet);
         if ( _triplets ) {
@@ -1051,31 +1103,27 @@
      unsigned _ct=_ctAB+_ctBA;
      unsigned nobasisfunc=_H.size1();

+
+
      ub::matrix<double> fe_states=ub::matrix<double>(_bse_exc,nobasisfunc);
      ub::project(fe_states, ub::range ( 0, _bseA_exc ),ub::range (0, nobasisfunc )  )=_proj_excA;
      ub::project(fe_states, ub::range ( _bseA_exc, _bse_exc ),ub::range (0, nobasisfunc )  )=_proj_excB;
-
+
      ub::matrix<double> ct_states=ub::matrix<double>(_ct,nobasisfunc);

     if(_ct>0){
      //orthogonalize ct-states with respect to the FE states.
        LOG(logDEBUG, *_pLog) << TimeStamp()  << " Orthogonalizing CT-states with respect to FE-states" << flush;
-
+
      if(_ctAB>0){
      ub::project(ct_states, ub::range ( 0 , _ctAB ) ,ub::range (0,nobasisfunc ) )=ctAB;
-     }
-     if(_ctBA>0){
+    }
+    if(_ctBA>0){
      ub::project(ct_states, ub::range ( _ctAB, _ct ),ub::range (0, nobasisfunc )  )=ctBA;
      }
-     //cout << _ctAB <<_ctBA<<endl;
-     //ub::matrix<double> _J_dimer = ub::zero_matrix<double>( _bse_exc +_ct, _bse_exc+_ct );
-     //ub::matrix<double> _S_dimer = ub::zero_matrix<double>( _bse_exc +_ct, _bse_exc +_ct);
-
-     //cout << _J_dimer.size1()<< " : "<<_J_dimer.size2()<<endl;
-     //cout << _S_dimer.size1()<< " : "<<_S_dimer.size2()<<endl;
-
-
-     //orthogonalize ct-states with respect to FE states
+
+
+        //orthogonalize ct-states with respect to FE states
      ub::matrix<double> overlaps=ub::prod(fe_states,ub::trans(ct_states));

      //cout << "overlap"<< overlaps.size1()<< "x"<<overlaps.size2()<<endl;
@@ -1110,8 +1158,16 @@
     //cout <<ub::prod(fe_states,ub::trans(ct_states))<<endl;
       */
     }
-
-
+
+
+
+     //cout << _ctAB <<_ctBA<<endl;
+     //ub::matrix<double> _J_dimer = ub::zero_matrix<double>( _bse_exc +_ct, _bse_exc+_ct );
+     //ub::matrix<double> _S_dimer = ub::zero_matrix<double>( _bse_exc +_ct, _bse_exc +_ct);
+
+     //cout << _J_dimer.size1()<< " : "<<_J_dimer.size2()<<endl;
+     //cout << _S_dimer.size1()<< " : "<<_S_dimer.size2()<<endl;
+
      #if (GWBSE_DOUBLE)
         ub::matrix<double>& Htemp=_H;
 #else
@@ -1120,16 +1176,16 @@

 #endif

+     ub::matrix<double> projection =ub::zero_matrix<double>(_bse_exc+_ct,nobasisfunc);

      LOG(logDEBUG, *_pLog) << TimeStamp()  << " merging projections into one vector  " << flush;
-    ub::matrix<double> projection =ub::zero_matrix<double>(_bse_exc+_ct,nobasisfunc);
-    ub::project(projection, ub::range (0 , _bse_exc) ,ub::range (0,nobasisfunc ) )=fe_states;
-
+
+  ub::project(projection, ub::range (0 , _bse_exc) ,ub::range (0,nobasisfunc ) )=fe_states;
+
      if(_ct>0){
-     ub::project(projection, ub::range ( _bse_exc , _bse_exc+_ct ) ,ub::range (0,nobasisfunc ) )=ct_states;
-     }
-
+    ub::project(projection, ub::range ( _bse_exc , _bse_exc+_ct ) ,ub::range (0,nobasisfunc ) )=ct_states;
+     }
       LOG(logDEBUG, *_pLog) << TimeStamp()  << "   Setting up coupling matrix size "<< _bse_exc +_ct<<"x"<<_bse_exc +_ct << flush;
      // matrix _J

@@ -1189,7 +1245,7 @@
      //Diagonalize ct states

      if(_do_perturbation){
-         bool _diag_ct=true;
+         bool _diag_ct=false;
      if (_ct > 0 && _diag_ct) {

@@ -1255,7 +1311,7 @@

      else if(_do_full_diag){

-
+
      ub::vector<double> _J_eigenvalues;

@@ -1398,17 +1454,7 @@

          }
      }
-
-
-         for (int stateA=0;stateA<_levA; stateA++){
-          for (int stateB=0;stateB<_levB; stateB++){
-                            int stateBd=stateB+_bseA_exc;
-
-         _J(stateA,stateBd)=_J_dimer(stateA,stateBd);
-     //_J(stateA,stateBd)=_J_small(0,0);
-    // _J(stateBd,stateBd)=_J_small(1,1);
-     _J(stateBd,stateA)=_J_dimer(stateBd,stateA);
-          }}
+
      }
        if(tools::globals::verbose){
      LOG(logDEBUG, *_pLog) << "---------------------------------------"<<flush;


remove exist keyword from gwbse #508

remove exist keyword from gwbse #508

--- src/libxtp/gwbse/gwbse.cc
+++ src/libxtp/gwbse/gwbse.cc
@@ -202,40 +202,36 @@
   }

   // eigensolver options
-  if (options.exists(key + ".eigensolver")) {
-    _bseopt.davidson = options.get(key + ".eigensolver.dodavidson").as<bool>();
-
-    if (_bseopt.davidson) {
-
-      _bseopt.matrixfree =
-          options.get(key + ".eigensolver.domatrixfree").as<bool>();
-
-      _bseopt.davidson_correction =
-          options.get(key + ".eigensolver.davidson_correction")
-              .as<std::string>();
-
-      _bseopt.davidson_ortho =
-          options.get(key + ".eigensolver.davidson_ortho").as<std::string>();
-
-      _bseopt.davidson_tolerance =
-          options.get(key + ".eigensolver.davidson_tolerance")
-              .as<std::string>();
-
-      _bseopt.davidson_update =
-          options.get(key + ".eigensolver.davidson_update").as<std::string>();
-
-      _bseopt.davidson_maxiter =
-          options.get(key + ".eigensolver.davidson_maxiter").as<Index>();
-
-      // check size
-      if (_bseopt.nmax > bse_size / 4) {
-        XTP_LOG(Log::error, *_pLog)
-            << TimeStamp()
-            << " Warning : Too many eigenvalues required for Davidson. Default "
-               "to Lapack diagonalization"
-            << flush;
-        _bseopt.davidson = false;
-      }
+  _bseopt.davidson = options.get(key + ".eigensolver.dodavidson").as<bool>();
+
+  if (_bseopt.davidson) {
+
+    _bseopt.matrixfree =
+        options.get(key + ".eigensolver.domatrixfree").as<bool>();
+
+    _bseopt.davidson_correction =
+        options.get(key + ".eigensolver.davidson_correction").as<std::string>();
+
+    _bseopt.davidson_ortho =
+        options.get(key + ".eigensolver.davidson_ortho").as<std::string>();
+
+    _bseopt.davidson_tolerance =
+        options.get(key + ".eigensolver.davidson_tolerance").as<std::string>();
+
+    _bseopt.davidson_update =
+        options.get(key + ".eigensolver.davidson_update").as<std::string>();
+
+    _bseopt.davidson_maxiter =
+        options.get(key + ".eigensolver.davidson_maxiter").as<Index>();
+
+    // check size
+    if (_bseopt.nmax > bse_size / 4) {
+      XTP_LOG(Log::error, *_pLog)
+          << TimeStamp()
+          << " Warning : Too many eigenvalues required for Davidson. Default "
+             "to Lapack diagonalization"
+          << flush;
+      _bseopt.davidson = false;
     }
   }

@@ -257,10 +253,8 @@
         << " BSE with Hqp offdiagonal elements" << flush;
   }

-  if (options.exists(key + ".vxc")) {
-    _functional = options.get(key + ".vxc.functional").as<std::string>();
-    _grid = options.get(key + ".vxc.grid").as<std::string>();
-  }
+  _functional = options.get(key + ".vxc.functional").as<std::string>();
+  _grid = options.get(key + ".vxc.grid").as<std::string>();

   _auxbasis_name = options.get(key + ".auxbasisset").as<std::string>();
   _dftbasis_name = options.get(key + ".basisset").as<std::string>();


get rid of unused constant

get rid of unused constant

--- src/lintilla_embedded.cpp
+++ src/lintilla_embedded.cpp
@@ -52,7 +52,6 @@
 #include <LcdKeypad.h>
 #include "LintillaMmiScreenFsm.h"

-#define DEBUG_RAM 1  //Printing free Ram space with serial monitor
 #define USE_WIFI 0
 #define USE_HARD_CODED_WIFI_CREDENTIALS 1
 #if USE_HARD_CODED_WIFI_CREDENTIALS


gst/src: Change default value for fps latency

--- src/gstreamer-1.0/tcamsrc/gsttcammainsrc.cpp
+++ src/gstreamer-1.0/tcamsrc/gsttcammainsrc.cpp
@@ -863,7 +863,11 @@
     gst_base_src_set_format(GST_BASE_SRC(self), GST_FORMAT_TIME);

     self->device = new device_state(self);
-    self->fps_denominator = 30;
+
+    // default to 1/1 fps as fallback
+    // these values are only used for GstQuery
+    // they should always be set in set_caps
+    self->fps_denominator = 1;
     self->fps_denominator = 1;

     GST_INFO_OBJECT(


Clear selected server, everytime the server-list is refreshed (to avoid dangling pointers)

--- src/listserverhandler.cpp
+++ src/listserverhandler.cpp
@@ -90,10 +90,12 @@
 }

 void ListServerHandler::ClearList() {
+	BZLauncherApp& app = wxGetApp();
+	app.SetSelectedServer(NULL);
+
 	ServerList::iterator i;
 	for(i = this->serverList.begin(); i != this->serverList.end(); ++i) {
 		Server*	current = *i;
-
 		delete current;
 	}


PSS llvm: add two asserts

PSS llvm: add two asserts

Signed-off-by: Marek Chalupa <a05df156a69ad59faa9af9b666ef78009594c145@gmail.com>

--- src/llvm/analysis/PSS.cpp
+++ src/llvm/analysis/PSS.cpp
@@ -1295,6 +1295,8 @@
     // Find the block that the instruction belongs and insert it
     // into it onto the right place
     for (std::pair<PSSNode *, PSSNode *> seq : unplacedInstructions) {
+        assert(seq.first && seq.second);
+
         // the last element contains the representant
         PSSNode *node = seq.second;
         const llvm::Value *val = node->getUserData<llvm::Value>();
@@ -1331,6 +1333,9 @@
                && "BUG: we should have this block created");
         std::pair<PSSNode *, PSSNode *>& blk = built_blocks[llvmBlk];
         if (blk.first) {
+            assert(blk.second
+                   && "Have beginning of the block, but not the end");
+
             auto I = llvmBlk->begin();
             // shift to our instruction
             while (&*I != val)


Increment total accesses with the number of distinct cache lines requested.

--- lib/byfl/cache-model.cpp
+++ lib/byfl/cache-model.cpp
@@ -59,7 +59,7 @@
   }

   // we've made all our accesses
-  ++accesses_;
+  accesses_ += num_accesses;
 }

 static Cache* cache = NULL;


fix build.h include

fix build.h include

Former-commit-id: afc550069accdc232495ef78f4b50e08d02e4f44

--- src/clientversion.cpp
+++ src/clientversion.cpp
@@ -39,7 +39,7 @@

 //! First, include build.h if requested
 #ifdef HAVE_BUILD_INFO
-#include "build.h"
+#include <obj/build.h>
 #endif

 //! git will put "#define GIT_ARCHIVE 1" on the next line inside archives. $Format:%n#define GIT_ARCHIVE 1$


enqueue all generations

enqueue all generations

--- src/cm-reportbuild.cc
+++ src/cm-reportbuild.cc
@@ -90,21 +90,16 @@
       strToLogLevel(flags.getString("loglevel")));

   fnord::fts::Analyzer analyzer(flags.getString("conf"));
-
   cm::ReportBuilder report_builder;

-  Set<uint64_t> generations { };
+  auto dir = flags.getString("artifacts");

-  /* find all generations */
-  auto dir = flags.getString("artifacts");
-  FileUtil::ls(dir, [&generations] (const String& file) -> bool {
-    String prefix = "dawanda_joined_queries.";
-    if (StringUtil::beginsWith(file, prefix)) {
-      generations.emplace(std::stoul(file.substr(prefix.length())));
-    }
-    return true;
-  });
-
+  Set<uint64_t> generations;
+  auto now = WallClock::unixMicros();
+  auto gen_window = kMicrosPerSecond * 3600 * 4;
+  for (uint64_t i = 0; i < kMicrosPerDay * 32; i += gen_window) {
+    generations.emplace((now - i) / gen_window);
+  }

   uint64_t min_gen = std::numeric_limits<uint64_t>::max();
   uint64_t max_gen = std::numeric_limits<uint64_t>::min();


implement workspace size for backward filter

--- src/cocl_dnn_gemm.cpp
+++ src/cocl_dnn_gemm.cpp
@@ -234,9 +234,24 @@
     cudnnTensorDescriptor_t outputDesc,
     cudnnConvolutionDescriptor_t convDesc,
     cudnnFilterDescriptor_t filterDesc,
-    CoclDnnSizeType *p_size
-) {
-    throw runtime_error("cudnnGetConvolutionBackwardFilterWorkspaceSize not implemented");
+    CoclDnnSizeType *p_size_bytes
+) {
+    // from torch/cltorch:
+    // // Resize temporary columns
+    // THClTensor_resize2d(state, columns, nOutputPlane*kW*kH, inputHeight*inputWidth);
+
+    CoclDnnGeometryType outC = outputDesc->C;
+
+    CoclDnnGeometryType kH = filterDesc->kH;
+    CoclDnnGeometryType kW = filterDesc->kW;
+
+    CoclDnnGeometryType inH = inputDesc->H;
+    CoclDnnGeometryType inW = inputDesc->W;
+
+    int rows = outC * kW * kH;
+    int cols = inH * inW;
+    *p_size_bytes = rows * cols * sizeof(float);
+    return 0;
 }
 size_t cudnnGetConvolutionBackwardDataWorkspaceSize(
     cudnnHandle_t handle,


clean trash dir after master garbage collection

--- src/master/master_impl.cc
+++ src/master/master_impl.cc
@@ -4985,9 +4985,6 @@
         }
     }

-    LOG(INFO) << "[gc] try clean trash dir.";
-    io::CleanTrashDir();
-
     bool need_gc = gc_strategy->PreQuery();

     MutexLock lock(&m_mutex);
@@ -5004,6 +5001,10 @@

 void MasterImpl::DoTabletNodeGcPhase2() {
     gc_strategy->PostQuery();
+
+    LOG(INFO) << "[gc] try clean trash dir.";
+    io::CleanTrashDir();
+
     MutexLock lock(&m_mutex);
     if (m_gc_enabled) {
         ScheduleTabletNodeGc();


update uuid generator

update uuid generator

--- src/master/master_util.cc
+++ src/master/master_util.cc
@@ -20,9 +20,9 @@

 namespace baidu {
 namespace galaxy {
-
+static boost::uuids::random_generator gen;
 std::string MasterUtil::UUID() {
-    boost::uuids::uuid uuid = boost::uuids::random_generator()();
+    boost::uuids::uuid uuid = gen();
     return boost::lexical_cast<std::string>(uuid);
 }


Prevented reserve/create with refined reservation on non-capable agents.

This patch makes it such that reserve / create operations involving
resources with refined reservations are invalid if they are attempted
on an agent without a RESERVATION_REFINEMENT capability. Such attempts
from an operator endpoint will result in a `BadRequest` response.
On the framework side, the operation will be dropped by the master.

Review: https://reviews.apache.org/r/60255

--- src/master/validation.cpp
+++ src/master/validation.cpp
@@ -1858,6 +1858,14 @@
           " capability");
     }

+    if (!agentCapabilities.reservationRefinement &&
+        Resources::hasRefinedReservations(resource)) {
+      return Error(
+          "Resource " + stringify(resource) +
+          " with reservation refinement cannot be reserved on"
+          " an agent without RESERVATION_REFINEMENT capability");
+    }
+
     if (principal.isSome()) {
       // We assume that `principal->value.isSome()` is true. The master's HTTP
       // handlers enforce this constraint, and V0 authenticators will only
@@ -2039,6 +2047,14 @@
           " '" + Resources::reservationRole(volume) + "'"
           " cannot be created on an agent without HIERARCHICAL_ROLE"
           " capability");
+    }
+
+    if (!agentCapabilities.reservationRefinement &&
+        Resources::hasRefinedReservations(volume)) {
+      return Error(
+          "Volume " + stringify(volume) +
+          " with reservation refinement cannot be created on"
+          " an agent without RESERVATION_REFINEMENT capability");
     }

     // Ensure that the provided principals match. If `principal` is `None`,


Remove blockEnd budget check

Remove blockEnd budget check

--- src/masternode-budget.cpp
+++ src/masternode-budget.cpp
@@ -1868,7 +1868,6 @@
     if(pindexPrev == NULL) return true;

     if(nBlockStart < pindexPrev->nHeight-100) {strError = "Older than current blockHeight"; return false;}
-    if(GetBlockEnd() < pindexPrev->nHeight - GetBudgetPaymentCycleBlocks()/2) {strError = "BlockEnd is older than blockHeight - cycle/2"; return false;}

     return true;
 }


Fixing indexing bugs in FluidFlow.C

Fixing indexing bugs in FluidFlow.C

r21217

--- src/materials/FluidFlow.C
+++ src/materials/FluidFlow.C
@@ -139,7 +139,7 @@
             mooseError("You forgot to provide a UserObject for the EOS fluid property calculations... water_steam_properties in the material block of your input file needs an entry");

       //Calling EOS function and assigning fluid properties (sat_fraction, density, visosity, ..., and their derivatives) to output material values
-        _water_steam_properties->waterAndSteamEquationOfStatePropertiesWithDerivativesPH (_enthalpy[qp], _pressure[qp], _temperature[_qp], temp_out, sat_fraction_out, dens_out, dens_water_out, dens_steam_out, enth_water_out, enth_steam_out, visc_water_out, visc_steam_out, d_enth_water_d_press, d_enth_steam_d_press, d_dens_d_press, d_temp_d_press, d_enth_water_d_enth, d_enth_steam_d_enth, d_dens_d_enth, d_temp_d_enth, d_sat_fraction_d_enth);
+        _water_steam_properties->waterAndSteamEquationOfStatePropertiesWithDerivativesPH (_enthalpy[qp], _pressure[qp], _temperature[qp], temp_out, sat_fraction_out, dens_out, dens_water_out, dens_steam_out, enth_water_out, enth_steam_out, visc_water_out, visc_steam_out, d_enth_water_d_press, d_enth_steam_d_press, d_dens_d_press, d_temp_d_press, d_enth_water_d_enth, d_enth_steam_d_enth, d_dens_d_enth, d_temp_d_enth, d_sat_fraction_d_enth);

       _temp_out[qp] = temp_out;
       _sat_fraction_out[qp] = sat_fraction_out;
@@ -170,7 +170,7 @@
         Real time_old_visc_water_out, time_old_visc_steam_out;
         Real var[7];

-        _water_steam_properties->waterAndSteamEquationOfStatePropertiesPH (_enthalpy_old[qp], _pressure_old[qp], _temperature_old[_qp], var[0], time_old_temp_out, var[1], var[2], time_old_dens_out, time_old_dens_water_out, time_old_dens_steam_out, var[3], var[4], time_old_visc_water_out, time_old_visc_steam_out, var[5], var[6]);
+        _water_steam_properties->waterAndSteamEquationOfStatePropertiesPH (_enthalpy_old[qp], _pressure_old[qp], _temperature_old[qp], var[0], time_old_temp_out, var[1], var[2], time_old_dens_out, time_old_dens_water_out, time_old_dens_steam_out, var[3], var[4], time_old_visc_water_out, time_old_visc_steam_out, var[5], var[6]);

         _time_old_temp_out[qp] = time_old_temp_out;
         _time_old_dens_out[qp] = time_old_dens_out;
@@ -191,7 +191,7 @@
       Real del_p=1.0, del_h=1e-7;

       //Obtaining properties to compute derivative of tau_water/steam w.r.t. a pressure step (enthalpy held constant)
-      _water_steam_properties->waterAndSteamEquationOfStatePropertiesPH (_enthalpy[qp], (_pressure[qp] + del_p), _temperature[_qp], _var[0], _var[1], _var[2], _sat_fraction, _var[3], _dens_water, _dens_steam, _var[4], _var[5], _visc_water, _visc_steam, _var[6], _var[7]);
+      _water_steam_properties->waterAndSteamEquationOfStatePropertiesPH (_enthalpy[qp], (_pressure[qp] + del_p), _temperature[qp], _var[0], _var[1], _var[2], _sat_fraction, _var[3], _dens_water, _dens_steam, _var[4], _var[5], _visc_water, _visc_steam, _var[6], _var[7]);

       FluidFlow::compute2PhProperties0( _permeability[qp], _sat_fraction, _dens_water, _dens_steam, _visc_water, _visc_steam, _tau_water[qp],_tau_steam[qp]);

@@ -200,7 +200,7 @@

       //Obtaining properties to compute derivative of tau_water/steam w.r.t. a enthalpy step (pressure held constant)
-      _water_steam_properties->waterAndSteamEquationOfStatePropertiesPH ((_enthalpy[qp] + del_h), _pressure[qp], _temperature[_qp], _var[0], _var[1], _var[2], _sat_fraction, _var[3], _dens_water, _dens_steam, _var[4], _var[5], _visc_water, _visc_steam, _var[6], _var[7]);
+      _water_steam_properties->waterAndSteamEquationOfStatePropertiesPH ((_enthalpy[qp] + del_h), _pressure[qp], _temperature[qp], _var[0], _var[1], _var[2], _sat_fraction, _var[3], _dens_water, _dens_steam, _var[4], _var[5], _visc_water, _visc_steam, _var[6], _var[7]);

       FluidFlow::compute2PhProperties0( _permeability[qp], _sat_fraction, _dens_water, _dens_steam, _visc_water, _visc_steam, _tau_water[qp],_tau_steam[qp]);


thief should shoot a lil shorter, with faster reload

--- src/common/global.cxx
+++ src/common/global.cxx
@@ -56,9 +56,9 @@
 	{ "_wideAngleAng",		"1.745329", 			false, StateDatabase::Locked},
 	{ "_thiefVelAd",		"1.67",				false, StateDatabase::Locked},
 	{ "_thiefTinyFactor",		"0.5",				false, StateDatabase::Locked},
-	{ "_thiefAdShotVel",		"10.0",				false, StateDatabase::Locked},
+	{ "_thiefAdShotVel",		"8.0",				false, StateDatabase::Locked},
 	{ "_thiefAdLife",               "0.05",				false, StateDatabase::Locked},
-	{ "_thiefAdRate",		"10.0",				false, StateDatabase::Locked},
+	{ "_thiefAdRate",		"12.0",				false, StateDatabase::Locked},
 	{ "_momentumLinAcc",		"1.0",				false, StateDatabase::Locked},
 	{ "_momentumAngAcc",		"1.0",				false, StateDatabase::Locked},
 	{ "_burrowDepth",		"-1.32",			false, StateDatabase::Locked},


Fixes: NB#206347 - Status indicator menu is opened on top of home, not the topmost application - don't accept menus as the current application

--- src/mcompositemanager.cpp
+++ src/mcompositemanager.cpp
@@ -1036,7 +1036,8 @@
             GTA("  has _MEEGOTOUCH_ALWAYS_MAPPED");
             continue;
         }
-        // NOTE: this WILL pass transient application window (this is intended!)
+        // NOTE: this WILL pass transient application window and non-transient
+        // menu (this is intended!)
         if ((pc->windowTypeAtom() == ATOM(_NET_WM_WINDOW_TYPE_MENU)
              && getLastVisibleParent(pc))
             || (pc->windowTypeAtom() != ATOM(_NET_WM_WINDOW_TYPE_MENU)
@@ -2017,13 +2018,17 @@
     for (int i = stacking_list.size() - 1; i >= 0; --i) {
          MCompositeWindow *cw;
          Window w = stacking_list.at(i);
-         if (w == stack[DESKTOP_LAYER])
+         if (w == stack[DESKTOP_LAYER]) {
+             set_as_current_app = w;
              break;
+         }
          if (!(cw = COMPOSITE_WINDOW(w)))
              continue;
-         if (cw->isMapped() && cw->isAppWindow(true)) {
+         if (cw->propertyCache() && cw->isMapped() && cw->isAppWindow(true)) {
              topmost = cw;
              top_i = i;
+             // topmost does not include menus, better suited as current app
+             set_as_current_app = topmost->propertyCache()->winId();
              break;
          }
     }


Adjust log levels in negotiate phase

Adjust log levels in negotiate phase

Change-Id: I2ebd550f73c6aeb8e478d10d75eb263198556624
Reviewed-on: http://review.couchbase.org/90228
Tested-by: Build Bot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Sergey Avseyev <87f6d5e4fd3644c3c20800cde7fd3ad1569370b3@gmail.com>

--- src/mcserver/negotiate.cc
+++ src/mcserver/negotiate.cc
@@ -292,11 +292,11 @@
         info->mech.assign(chosenmech);
         return MECH_OK;
     case SASL_NOMECH:
-        lcb_log(LOGARGS(this, INFO), LOGFMT "Server does not support SASL (no mechanisms supported)", LOGID(this));
+        lcb_log(LOGARGS(this, WARN), LOGFMT "Server does not support SASL (no mechanisms supported)", LOGID(this));
         return MECH_NOT_NEEDED;
         break;
     default:
-        lcb_log(LOGARGS(this, INFO), LOGFMT "cbsasl_client_start returned %d", LOGID(this), saslerr);
+        lcb_log(LOGARGS(this, ERROR), LOGFMT "cbsasl_client_start returned %d", LOGID(this), saslerr);
         set_error(LCB_EINTERNAL, "Couldn't start SASL client");
         return MECH_UNAVAILABLE;
     }
@@ -482,7 +482,7 @@
     }

     // send the SELECT_BUCKET command:
-    lcb_log(LOGARGS(this, INFO), LOGFMT "Sending SELECT_BUCKET", LOGID(this));
+    lcb_log(LOGARGS(this, DEBUG), LOGFMT "Sending SELECT_BUCKET", LOGID(this));
     lcb::MemcachedRequest req(PROTOCOL_BINARY_CMD_SELECT_BUCKET);
     req.sizes(0, strlen(settings->bucket), 0);
     lcbio_ctx_put(ctx, req.data(), req.size());
@@ -675,7 +675,7 @@
     if (settings->send_hello) {
         send_hello();
     } else {
-        lcb_log(LOGARGS(this, INFO), LOGFMT "HELLO negotiation disabled by user", LOGID(this));
+        lcb_log(LOGARGS(this, WARN), LOGFMT "HELLO negotiation disabled by user", LOGID(this));
         send_list_mechs();
     }
     LCBIO_CTX_RSCHEDULE(ctx, 24);


Minor changes due to the pheno_opt

Minor changes due to the pheno_opt

--- src/monica-parameters.cpp
+++ src/monica-parameters.cpp
@@ -4161,7 +4161,7 @@
     Monica::applySAChanges(std::vector<ProductionProcess> ff,
                            const CentralParameterProvider &centralParameterProvider)
 {
-  cout << "Apply SA values method" << endl;
+//  cout << "Apply SA values method" << endl;
   std::vector<ProductionProcess> new_ff;

   BOOST_FOREACH(ProductionProcess pp, ff)
@@ -4171,10 +4171,10 @@
     const SensitivityAnalysisParameters& saps =  centralParameterProvider.sensitivityAnalysisParameters;

     if (saps.sa_crop_id != crop->id() && saps.sa_crop_id>0){
-        cout << "Do not apply SA values" << endl;
+//        cout << "Do not apply SA values" << endl;
       continue;
     } else {
-        cout << "CropIds: SA:\t"<< saps.sa_crop_id << "\tMONICA:\t" << crop->id() << endl;
+//        cout << "CropIds: SA:\t"<< saps.sa_crop_id << "\tMONICA:\t" << crop->id() << endl;
     }

     CropParameters* cps = new CropParameters((*crop->cropParameters()));


cosmetic change

cosmetic change

--- src/core/ArrayOps.hpp
+++ src/core/ArrayOps.hpp
@@ -15,13 +15,6 @@

 namespace ovk {

-template <typename T, int Rank, array_layout Layout, OVK_FUNCTION_REQUIRES(!std::is_const<T>::value
-  )> void ArrayFill(const array_view<T, Rank, Layout> &View, const T &Value) {
-
-  View.Fill(Value);
-
-}
-
 template <typename ArrayType, OVK_FUNCTION_REQUIRES(core::IsArray<ArrayType>())> void ArrayFill(
   ArrayType &Array, const core::array_value_type<ArrayType> &Value) {

@@ -34,9 +27,9 @@
 }

 template <typename T, int Rank, array_layout Layout, OVK_FUNCTION_REQUIRES(!std::is_const<T>::value
-  )> void ArrayFill(const array_view<T, Rank, Layout> &View, std::initializer_list<T> ValuesList) {
+  )> void ArrayFill(const array_view<T, Rank, Layout> &View, const T &Value) {

-  View.Fill(ValuesList);
+  View.Fill(Value);

 }

@@ -52,12 +45,10 @@

 }

-template <typename T, int Rank, array_layout Layout, typename IterType, OVK_FUNCTION_REQUIRES(
-  !std::is_const<T>::value && core::IsInputIterator<IterType>() && std::is_convertible<
-  core::iterator_reference_type<IterType>, T>::value)> void ArrayFill(const array_view<T, Rank,
-  Layout> &View, IterType First) {
+template <typename T, int Rank, array_layout Layout, OVK_FUNCTION_REQUIRES(!std::is_const<T>::value
+  )> void ArrayFill(const array_view<T, Rank, Layout> &View, std::initializer_list<T> ValuesList) {

-  View.Fill(First);
+  View.Fill(ValuesList);

 }

@@ -74,12 +65,12 @@

 }

-template <typename T, typename U, int Rank, array_layout Layout, OVK_FUNCTION_REQUIRES(
-  !std::is_const<T>::value && std::is_convertible<typename std::remove_const<U>::type, T>::value)>
-  void ArrayFill(const array_view<T, Rank, Layout> &View, const array_view<U, Rank, Layout>
-  &SourceView) {
+template <typename T, int Rank, array_layout Layout, typename IterType, OVK_FUNCTION_REQUIRES(
+  !std::is_const<T>::value && core::IsInputIterator<IterType>() && std::is_convertible<
+  core::iterator_reference_type<IterType>, T>::value)> void ArrayFill(const array_view<T, Rank,
+  Layout> &View, IterType First) {

-  View.Fill(SourceView);
+  View.Fill(First);

 }

@@ -96,14 +87,12 @@

 }

-template <typename T, int Rank, array_layout Layout, typename SourceArrayRefType,
-  OVK_FUNCTION_REQUIRES(!std::is_const<T>::value && core::IsArray<core::remove_cvref<
-  SourceArrayRefType>>() && !core::IsIterator<typename std::decay<SourceArrayRefType>::type>()
-  && core::ArrayHasFootprint<core::remove_cvref<SourceArrayRefType>, Rank, Layout>() &&
-  std::is_convertible<core::array_access_type<SourceArrayRefType &&>, T>::value)> void ArrayFill(
-  const array_view<T, Rank, Layout> &View, SourceArrayRefType &&SourceArray) {
+template <typename T, typename U, int Rank, array_layout Layout, OVK_FUNCTION_REQUIRES(
+  !std::is_const<T>::value && std::is_convertible<typename std::remove_const<U>::type, T>::value)>
+  void ArrayFill(const array_view<T, Rank, Layout> &View, const array_view<U, Rank, Layout>
+  &SourceView) {

-  View.Fill(std::forward<SourceArrayRefType>(SourceArray));
+  View.Fill(SourceView);

 }

@@ -122,6 +111,17 @@

 }

+template <typename T, int Rank, array_layout Layout, typename SourceArrayRefType,
+  OVK_FUNCTION_REQUIRES(!std::is_const<T>::value && core::IsArray<core::remove_cvref<
+  SourceArrayRefType>>() && !core::IsIterator<typename std::decay<SourceArrayRefType>::type>()
+  && core::ArrayHasFootprint<core::remove_cvref<SourceArrayRefType>, Rank, Layout>() &&
+  std::is_convertible<core::array_access_type<SourceArrayRefType &&>, T>::value)> void ArrayFill(
+  const array_view<T, Rank, Layout> &View, SourceArrayRefType &&SourceArray) {
+
+  View.Fill(std::forward<SourceArrayRefType>(SourceArray));
+
+}
+
 }

 #endif


Draw properly

Draw properly

--- src/mugen/mugen_stage.cpp
+++ src/mugen/mugen_stage.cpp
@@ -604,14 +604,14 @@

     // Reset player positions
     for (vector<Object*>::iterator it = p1objects.begin(); it != p1objects.end(); it++){
-        (*it)->setX( xaxis + p1startx );
-	(*it)->setY( yaxis + p1starty );
+        (*it)->setX( p1startx );
+	(*it)->setY( p1starty );
 	(*it)->setZ( zoffset );
 	(*it)->setFacing( Object::FACING_RIGHT );
     }
     for (vector<Object*>::iterator it = p2objects.begin(); it != p2objects.end(); it++){
-        (*it)->setX( xaxis + p2startx );
-	(*it)->setY( yaxis + p2starty );
+        (*it)->setX( p2startx );
+	(*it)->setY( p2starty );
 	(*it)->setZ( zoffset );
 	(*it)->setFacing( Object::FACING_LEFT );
     }
@@ -627,10 +627,10 @@

     // Players go in here
     for (vector<Object*>::iterator it = p1objects.begin(); it != p1objects.end(); it++){
-        (*it)->draw( work, 0);
+        (*it)->draw( board, 0);
     }
     for (vector<Object*>::iterator it = p2objects.begin(); it != p2objects.end(); it++){
-        (*it)->draw( work, 0);
+        (*it)->draw( board, 0);
     }

     for( vector< MugenBackground *>::iterator i = foregrounds.begin(); i != foregrounds.end(); ++i ){
@@ -653,14 +653,14 @@

     // Reset player positions
     for (vector<Object*>::iterator it = p1objects.begin(); it != p1objects.end(); it++){
-        (*it)->setX( xaxis + p1startx );
-	(*it)->setY( yaxis + p1starty );
+        (*it)->setX( p1startx );
+	(*it)->setY( p1starty );
 	(*it)->setZ( zoffset );
 	(*it)->setFacing( Object::FACING_RIGHT );
     }
     for (vector<Object*>::iterator it = p2objects.begin(); it != p2objects.end(); it++){
-        (*it)->setX( xaxis + p2startx );
-	(*it)->setY( yaxis + p2starty );
+        (*it)->setX( p2startx );
+	(*it)->setY( p2starty );
 	(*it)->setZ( zoffset );
 	(*it)->setFacing( Object::FACING_LEFT );
     }
@@ -668,8 +668,8 @@

 // Add player1 people
 void MugenStage::addp1( Object * o ){
-    o->setX( xaxis + p1startx );
-    o->setY( yaxis + p1starty );
+    o->setX( p1startx );
+    o->setY( p1starty );
     o->setZ( zoffset );
     o->setFacing( Object::FACING_RIGHT );
     p1objects.push_back(o);
@@ -677,8 +677,8 @@

 // Add player2 people
 void MugenStage::addp2( Object * o ){
-    o->setX( xaxis + p2startx );
-    o->setY( yaxis + p2starty );
+    o->setX( p2startx );
+    o->setY( p2starty );
     o->setZ( zoffset );
     o->setFacing( Object::FACING_LEFT );
     p2objects.push_back(o);


mumble_pch.hpp: add missing networking headers to fix FreeBSD build.

--- src/mumble/mumble_pch.hpp
+++ src/mumble/mumble_pch.hpp
@@ -99,7 +99,11 @@
 #define ZeroMemory(ptr,len) memset(ptr, 0, len)
 #define __cdecl
 typedef WId HWND;
+#include <sys/socket.h>
+#include <sys/types.h>
 #include <arpa/inet.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
 #endif

 #if defined(__MMX__) || defined(Q_OS_WIN)


sync with gazebo now waits for timestamp to change

--- src/core/Executor.cpp
+++ src/core/Executor.cpp
@@ -274,8 +274,21 @@
 		log.trace() << "starting execution synced to gazebo";
 		useDefaultExecutor = false;

+		auto timeOld = ros::Time::now();
+		auto timeNew = ros::Time::now();
+		static bool first = true;
 		while (running) {
 			while (syncRosCallbackQueue->isEmpty() && running) usleep(1);
+
+			timeNew = ros::Time::now();
+			if (!first) {
+				while (timeOld == timeNew) {
+					usleep(1);	// waits for new rosTime beeing published
+					timeNew = ros::Time::now();
+				}
+			}
+			timeOld = timeNew;
+
 			syncRosCallbackQueue->callAvailable();
 			ros::getGlobalCallbackQueue()->callAvailable();


as11: fix incorrect footer partition offset calc

This reverts 1efcf6e0841f43c00de4d6b5376029ac157dc4cb

Calculation requires the file to be positioned at the start of
the first content package (or at the footer for duration 0).
Before this fix the file was positioned at the start of the
body partition for duration > 0.

--- src/mxf_op1a/OP1AFile.cpp
+++ src/mxf_op1a/OP1AFile.cpp
@@ -799,11 +799,6 @@
             if (!(mFlavour & OP1A_MIN_PARTITIONS_FLAVOUR))
                 start_ess_partition = true;
             mFirstWrite = false;
-
-            if (mMXFFile->isMemoryFileOpen()) {
-                UpdateFirstPartitions();
-                mMXFFile->closeMemoryFile();
-            }
         }
         else if (mPartitionInterval > 0 &&
                  mPartitionFrameCount >= mPartitionInterval && mIndexTable->CanStartPartition())
@@ -847,19 +842,24 @@
             ess_partition.write(mMXFFile);
         }

-        mCPManager->WriteNextContentPackage();
-
-        if (mPartitionInterval > 0)
-            mPartitionFrameCount++;
-    }
-
-    if (end_of_samples) {
-        mCPManager->CompleteWrite();
-
         if (mMXFFile->isMemoryFileOpen()) {
             UpdateFirstPartitions();
             mMXFFile->closeMemoryFile();
         }
+
+        mCPManager->WriteNextContentPackage();
+
+        if (mPartitionInterval > 0)
+            mPartitionFrameCount++;
+    }
+
+    if (end_of_samples) {
+        mCPManager->CompleteWrite();
+
+        if (mMXFFile->isMemoryFileOpen()) {
+            UpdateFirstPartitions();
+            mMXFFile->closeMemoryFile();
+        }
     }
 }


Don't use drawVertices for blur masks

Don't use drawVertices for blur masks

Total DMSAA Multisample Render Passes: 190 -> 110

Bug: skia:11396
Change-Id: I721de497f497c40e854d219829e853765e2dc778
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404856
Reviewed-by: Robert Phillips <95e8ac5504948c7bf91b22c16a8dbb7ae7c66bfd@google.com>
Commit-Queue: Chris Dalton <ef7fc3a08ada7d31f16e9a18b5f3c728256e041e@google.com>

--- src/core/SkBlurMF.cpp
+++ src/core/SkBlurMF.cpp
@@ -676,18 +676,8 @@
     if (!this->ignoreXform()) {
         SkRect srcProxyRect = srcRRect.rect();
         srcProxyRect.outset(3.0f*fSigma, 3.0f*fSigma);
-
-        SkVertices::Builder builder(SkVertices::kTriangles_VertexMode, 4, 6, 0);
-        srcProxyRect.toQuad(builder.positions());
-
-        static const uint16_t fullIndices[6] = { 0, 1, 2, 0, 2, 3 };
-        memcpy(builder.indices(), fullIndices, sizeof(fullIndices));
-        sk_sp<SkVertices> vertices = builder.detach();
-
         paint.setCoverageFragmentProcessor(std::move(fp));
-        SkSimpleMatrixProvider matrixProvider(viewMatrix);
-        surfaceDrawContext->drawVertices(clip, std::move(paint), matrixProvider,
-                                         std::move(vertices));
+        surfaceDrawContext->drawRect(clip, std::move(paint), GrAA::kNo, viewMatrix, srcProxyRect);
     } else {
         SkMatrix inverse;
         if (!viewMatrix.invert(&inverse)) {


Correctly initialize LayerIter's cached device origin.

Previously, LayerIter called the base device iterator's next() call
during initialization. However, its next() call should be called instead,
since it does both the base device iterator.next() AND caches the
device's reported origin.

Without calling this->next(), the first device's origin would never be
fetched and the layer would report an incorrect origin.

Bug: b/151328374
Change-Id: I889673e2e93e54618544d62333bd9d04438bea00
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279420
Commit-Queue: Michael Ludwig <cb1f3dd24de0f0b611b26bc28bec758a551d9b7d@google.com>
Reviewed-by: Derek Sollenberger <d9b232705cad36bae5cfccf14f9650bb292e6c71@google.com>

--- src/core/SkCanvas.cpp
+++ src/core/SkCanvas.cpp
@@ -2969,7 +2969,9 @@
     SkASSERT(canvas);

     fImpl = new (fStorage) SkDrawIter(canvas);
-    fDone = !fImpl->next();
+    // This advances the base iterator to the first device and caches its origin,
+    // correctly handling the case where there are no devices.
+    this->next();
 }

 SkCanvas::LayerIter::~LayerIter() {


balance sk_malloc with sk_free (instead of delete[]) in SkAutoUCS2

patch submitted by alean2...@gmail.com

--- src/core/SkString.cpp
+++ src/core/SkString.cpp
@@ -612,23 +612,21 @@

 /////////////////////////////////////////////////////////////////////////////////

-SkAutoUCS2::SkAutoUCS2(const char utf8[])
-{
+SkAutoUCS2::SkAutoUCS2(const char utf8[]) {
     size_t len = strlen(utf8);
     fUCS2 = (uint16_t*)sk_malloc_throw((len + 1) * sizeof(uint16_t));

     uint16_t* dst = fUCS2;
-    for (;;)
-    {
-        SkUnichar   uni = SkUTF8_NextUnichar(&utf8);
+    for (;;) {
+        SkUnichar uni = SkUTF8_NextUnichar(&utf8);
         *dst++ = SkToU16(uni);
-        if (uni == 0)
+        if (uni == 0) {
             break;
+        }
     }
     fCount = (int)(dst - fUCS2);
 }

-SkAutoUCS2::~SkAutoUCS2()
-{
-    delete[] fUCS2;
-}
+SkAutoUCS2::~SkAutoUCS2() {
+    sk_free(fUCS2);
+}


remove legacy switch

remove legacy switch

Chrome tests have been rebased
and legacy define has been removed,
so remove from Skia as well.

R=a8262bf13ea8c26821e91ea9bca6740a77c96dcd@chromium.org

Bug:843966
Change-Id: I3794b8457c581f71d4bd30eb81d6fa4c8a589cad
Reviewed-on: https://skia-review.googlesource.com/c/176224
Auto-Submit: Cary Clark <52792aa984ff6c4e9c802c7fa3093ed6a52a791f@skia.org>
Commit-Queue: Florin Malita <a8262bf13ea8c26821e91ea9bca6740a77c96dcd@chromium.org>
Reviewed-by: Florin Malita <a8262bf13ea8c26821e91ea9bca6740a77c96dcd@chromium.org>

--- src/core/SkStroke.cpp
+++ src/core/SkStroke.cpp
@@ -591,11 +591,7 @@
     SkASSERT(outer2 >= 1 && outer2 <= 2);
     SkASSERT(outer1 < outer2);
     int mid = outer1 ^ outer2 ^ 3;
-#ifdef SK_USE_LEGACY_CONIC_CURVATURE_SLOP
-    const float kCurvatureSlop = 0.00001f;
-#else
     const float kCurvatureSlop = 0.000005f;  // this multiplier is pulled out of the air
-#endif
     SkScalar lineSlop =  ptMax * ptMax * kCurvatureSlop;
     return pt_to_line(quad[mid], quad[outer1], quad[outer2]) <= lineSlop;
 }
@@ -656,16 +652,9 @@
     if (!conic_in_line(conic)) {
         return kQuad_ReductionType;
     }
-#ifdef SK_USE_LEGACY_CONIC_CURVATURE_SLOP
-    SkScalar xT = 0, yT = 0;
-    (void) conic.findXExtrema(&xT);
-    (void) conic.findYExtrema(&yT);
-    SkScalar t = SkTMax(xT, yT);
-#else
     // SkFindConicMaxCurvature would be a better solution, once we know how to
     // implement it. Quad curvature is a reasonable substitute
     SkScalar t = SkFindQuadMaxCurvature(conic.fPts);
-#endif
     if (0 == t) {
         return kLine_ReductionType;
     }


fix stream_select bug

fix stream_select bug

--- src/coroutine/hook.cc
+++ src/coroutine/hook.cc
@@ -859,9 +859,20 @@
 {
     coro_poll_task *task = coro_poll_task_map[fd];
     auto i = task->fds->find(fd);
-    if ((i->second.events & SW_EVENT_READ) && !(i->second.events & SW_EVENT_ERROR))
-    {
-        i->second.revents |= SW_EVENT_READ;
+    if (event == SW_EVENT_ERROR && !(i->second.events & SW_EVENT_ERROR))
+    {
+        if (i->second.events & SW_EVENT_READ)
+        {
+            i->second.revents |= SW_EVENT_READ;
+        }
+        else if (i->second.events & SW_EVENT_WRITE)
+        {
+            i->second.revents |= SW_EVENT_WRITE;
+        }
+        else
+        {
+            assert(0);
+        }
     }
     else
     {


Fix RemoteCar

Fix RemoteCar

It's working!

--- src/network/RemoteCar.cpp
+++ src/network/RemoteCar.cpp
@@ -33,7 +33,7 @@
 namespace Net
 {

-const int PASS_TIME = 500;
+const int PASS_TIME = 250;

 class RemoteCarImpl
 {
@@ -72,13 +72,8 @@
 void RemoteCar::update(unsigned int p_elapsedMS)
 {
 	Car::update(p_elapsedMS);
-
+	m_impl->m_phantomCar.update(p_elapsedMS);
 	m_impl->m_passFloat.update(p_elapsedMS);
-	const float newCarRatio = m_impl->m_passFloat.get();
-
-	if (fabs(newCarRatio - 1.0f) > 0.01) {
-		m_impl->m_phantomCar.update(p_elapsedMS);
-	}
 }

 void RemoteCar::deserialize(const CL_NetGameEvent &p_data)
@@ -115,16 +110,16 @@
 {
 	const CL_Angle &thisAngle = Car::getCorpseAngle();

-//	const float newCarRatio = m_impl->m_passFloat.get();
-//
-//	if (fabs(newCarRatio - 1.0f) > 0.01) {
-//		const CL_Angle &phanAngle = m_impl->m_phantomCar.getCorpseAngle();
-//
-//		const CL_Angle delta = (thisAngle - phanAngle) * newCarRatio;
-//		m_impl->m_rot = phanAngle + delta;
-//
-//		return m_impl->m_rot;
-//	}
+	const float newCarRatio = m_impl->m_passFloat.get();
+
+	if (fabs(newCarRatio - 1.0f) > 0.01) {
+		const CL_Angle &phanAngle = m_impl->m_phantomCar.getCorpseAngle();
+
+		const CL_Angle delta = (thisAngle - phanAngle) * newCarRatio;
+		m_impl->m_rot = phanAngle + delta;
+
+		return m_impl->m_rot;
+	}

 	return thisAngle;
 }


Create output directory.

Create output directory.

git-svn-id: bd2008fbba0f7d30fd6598b54f2cd88503fdd2e4@758 95f4ed2b-212e-0410-8b90-d31948207fce

--- src/nvtt/tests/stress.cpp
+++ src/nvtt/tests/stress.cpp
@@ -31,6 +31,7 @@
 #include <nvcore/StrLib.h>
 #include <nvcore/StdStream.h>
 #include <nvcore/TextWriter.h>
+#include <nvcore/FileSystem.h>

 #include <stdlib.h> // free
 #include <string.h> // memcpy
@@ -269,7 +270,7 @@
 	nvtt::Compressor compressor;
 	compressor.enableCudaAcceleration(!nocuda);

-    // @@ Create outPath.
+	FileSystem::createDirectory(outPath);

 	Path csvFileName("%s/result.csv", outPath);
 	StdOutputStream csvStream(csvFileName);
@@ -349,7 +350,7 @@
 			printf("  Diff: \t%.4f (%s)\n", diff, text);
 		}

-        fflush(stdout);
+		fflush(stdout);
 	}

 	totalRMS /= s_fileCount;


params defined in xml but not in code are saved across sessions

--- src/ofxRemoteUIServer.cpp
+++ src/ofxRemoteUIServer.cpp
@@ -310,13 +310,13 @@
 	switch (t.type) {
 		case REMOTEUI_PARAM_FLOAT:
 			if(verbose_) RLOG_NOTICE << "saving '" << key << "' (" <<  *t.floatValAddr <<") to XML" ;
-			s.addValue("P", *t.floatValAddr);
+			s.addValue("P", t.floatValAddr ? *t.floatValAddr : t.floatVal);
 			s.setTo(path);
 			s.setAttribute("type", "float");
 			break;
 		case REMOTEUI_PARAM_INT:
 			if(verbose_) RLOG_NOTICE << "saving '" << key << "' (" <<  *t.intValAddr <<") to XML" ;
-			s.addValue("P", *t.intValAddr);
+			s.addValue("P", t.intValAddr ? *t.intValAddr : t.intVal);
 			s.setTo(path);
 			s.setAttribute("type", "int");
 			break;
@@ -325,26 +325,26 @@
 			s.addChild("P");
 			s.setTo(path);
 			s.setAttribute("type", "color");
-			s.setAttribute("c0.red", ofToString((int)*t.redValAddr));
-			s.setAttribute("c1.green", ofToString((int)*(t.redValAddr + 1)));
-			s.setAttribute("c2.blue", ofToString((int)*(t.redValAddr + 2)));
-			s.setAttribute("c3.alpha", ofToString((int)*(t.redValAddr + 3)));
+			s.setAttribute("c0.red", ofToString((int)(t.redValAddr ? *t.redValAddr : t.redVal)));
+			s.setAttribute("c1.green", ofToString((int)(t.redValAddr ? *(t.redValAddr + 1) : t.greenVal)));
+			s.setAttribute("c2.blue", ofToString((int)(t.redValAddr ? *(t.redValAddr + 2) : t.blueVal)));
+			s.setAttribute("c3.alpha", ofToString((int)(t.redValAddr ? *(t.redValAddr + 3) : t.alphaVal)));
 			break;
 		case REMOTEUI_PARAM_ENUM:
 			if(verbose_) RLOG_NOTICE << "saving '" << key << "' (" <<  *t.intValAddr <<") to XML" ;
-			s.addValue("P", *t.intValAddr);
+			s.addValue("P", t.intValAddr ? *t.intValAddr : t.intVal);
 			s.setTo(path);
 			s.setAttribute("type", "enum");
 			break;
 		case REMOTEUI_PARAM_BOOL:
 			if(verbose_) RLOG_NOTICE << "saving '" << key << "' (" <<  *t.boolValAddr <<") to XML" ;
-			s.addValue("P", *t.boolValAddr);
+			s.addValue("P", t.boolValAddr ? *t.boolValAddr : t.boolVal);
 			s.setTo(path);
 			s.setAttribute("type", "bool");
 			break;
 		case REMOTEUI_PARAM_STRING:
 			if(verbose_) RLOG_NOTICE << "saving '" << key << "' (" <<  *t.stringValAddr <<") to XML" ;
-			s.addValue("P", *t.stringValAddr);
+			s.addValue("P", t.stringValAddr ? *t.stringValAddr : t.stringVal);
 			s.setTo(path);
 			s.setAttribute("type", "string");
 			break;
@@ -435,20 +435,26 @@

 	//save all params
 	int numSaved = 0;
+	vector<string> savedParams;
 	for(int i = 0; i < orderedKeys.size(); i++){
 		string key = orderedKeys[i];
 		RemoteUIParam &t = params[key];
-		bool save = false;
-		if(savingGroupOnly){
-			if( t.group != OFXREMOTEUI_DEFAULT_PARAM_GROUP && t.group == groupName ){
+		if(t.type != REMOTEUI_PARAM_UNKNOWN){
+			bool save = false;
+			if(savingGroupOnly){
+				if( t.group != OFXREMOTEUI_DEFAULT_PARAM_GROUP && t.group == groupName ){
+					save = true;
+				}
+			}else{
 				save = true;
 			}
+			if(save){
+				saveParamToXmlSettings(t, key, s, numSaved, true);
+				numSaved++;
+				savedParams.push_back(key);
+			}
 		}else{
-			save = true;
-		}
-		if(save){
-			saveParamToXmlSettings(t, key, s, numSaved, true);
-			numSaved++;
+			RLOG_WARNING << "param '" << key << "' not found in DB!";
 		}
 	}

@@ -456,14 +462,25 @@
 		//add comment separating enabled params from disabled params
 		if(orderedKeys_removed.size()){
 			Poco::XML::Element *el = s.getPocoElement();
-			Poco::XML::Comment *ce = s.getPocoDocument()->createComment(Poco::XML::toXMLString("############################## DISABLED PARAMS ################################# "));
+			Poco::XML::Comment *ce = s.getPocoDocument()->createComment(Poco::XML::toXMLString("                                                                                "));
 			el->appendChild((Poco::XML::Node*)ce);
+			ce = s.getPocoDocument()->createComment(Poco::XML::toXMLString(" ############################## DISABLED PARAMS ################################# "));
+			el->appendChild((Poco::XML::Node*)ce);
+			ce = s.getPocoDocument()->createComment(Poco::XML::toXMLString("                                                                                "));
+			el->appendChild((Poco::XML::Node*)ce);
 		}
 		//save removed params
+		int c = 0;
 		for(int i = 0; i < orderedKeys_removed.size(); i++){
 			string key = orderedKeys_removed[i];
-			RemoteUIParam &t = params_removed[key];
-			saveParamToXmlSettings(t, key, s, i + orderedKeys.size(), false);
+			if (find(savedParams.begin(), savedParams.end(), key) == savedParams.end()){
+				RemoteUIParam &t = params_removed[key];
+				saveParamToXmlSettings(t, key, s, numSaved + c, false);
+				c++;
+			}else{
+				//param is defined as both params_removed[] and params[], most likely we loaded XML b4 we finished defining all code params...
+				//we just make sure we dont save it twice in the XML, and we save the params[] version
+			}
 		}
 	}

@@ -526,87 +543,133 @@
 		unordered_map<string, RemoteUIParam>::iterator it = params.find(paramName);
 		bool isAParamWeKnowOf = it != params.end();

-		if(isAParamWeKnowOf){
-
-			if (readKeys.find(paramName) == readKeys.end()){ //lets not read keys twice, only read the first one we find in xml
-
-				if(type.length() >	0){
-
-					unordered_map<string, RemoteUIParam>::iterator it = params.find(paramName);
-
-					if ( it != params.end() ){	// found!
-
-						readKeys[paramName] = true;
-						loadedParams.push_back(paramName);
-						RemoteUIParam &p = params[paramName];
-
-						switch (type[0]){
-
-							case 'f':{ //float
-								if(p.type != REMOTEUI_PARAM_FLOAT){ RLOG_ERROR << "type missmatch parsing '" << paramName << "'. Ignoring it!"; break;}
-								float val = ofClamp(s.getFloatValue(), p.minFloat, p.maxFloat);
-								p.floatVal = *p.floatValAddr = val;
-								if(verbose_) RLOG_NOTICE << "loading a FLOAT '" << paramName <<"' (" << ofToString( *p.floatValAddr, 3) << ") from XML" ;
-								}break;
-
-							case 'i':{ //int
-								if(p.type != REMOTEUI_PARAM_INT){ RLOG_ERROR << "type missmatch parsing '" << paramName << "'. Ignoring it!"; break;}
-								int val = ofClamp(s.getIntValue(), p.minInt, p.maxInt);
-								p.intVal = *p.intValAddr = val;
-								if(verbose_) RLOG_NOTICE << "loading an INT '" << paramName <<"' (" << (int) *p.intValAddr << ") from XML" ;
-								}break;
-
-							case 's':{ //string
-								if(p.type != REMOTEUI_PARAM_STRING){ RLOG_ERROR << "type missmatch parsing '" << paramName << "'. Ignoring it!"; break;}
-								string val = s.getValue();
-								p.stringVal = *p.stringValAddr = val;
-								if(verbose_) RLOG_NOTICE << "loading a STRING '" << paramName <<"' (" << (string) *p.stringValAddr << ") from XML" ;
-								}break;
-
-							case 'e':{ //enum
-								if(p.type != REMOTEUI_PARAM_ENUM){ RLOG_ERROR << "type missmatch parsing '" << paramName << "'. Ignoring it!"; break;}
-								int val = ofClamp(s.getIntValue(), p.minInt, p.maxInt);
-								p.intVal = *p.intValAddr = val;
-								if(verbose_) RLOG_NOTICE << "loading an ENUM '" << paramName <<"' (" << (int) *p.intValAddr << ") from XML" ;
-								}break;
-
-							case 'b':{ //bool
-								if(p.type != REMOTEUI_PARAM_BOOL){ RLOG_ERROR << "type missmatch parsing '" << paramName << "'. Ignoring it!"; break;}
-								bool val = s.getIntValue();
-								p.boolVal = *p.boolValAddr = val;
-								if(verbose_) RLOG_NOTICE << "loading a BOOL '" << paramName <<"' (" << (bool) *p.boolValAddr << ") from XML" ;
-								}break;
-
-							case 'g':{ //group
-								if(verbose_) RLOG_NOTICE << "skipping GROUP '" << paramName << "' from XML" ;
-							}break;
-
-
-							case 'c':{ //color
-								if(p.type != REMOTEUI_PARAM_COLOR){ RLOG_ERROR << "type missmatch parsing '" << paramName << "'. Ignoring it!"; break;}
-								unsigned char r = ofToInt(s.getAttribute("c0.red"));
-								unsigned char g = ofToInt(s.getAttribute("c1.green"));
-								unsigned char b = ofToInt(s.getAttribute("c2.blue"));
-								unsigned char a = ofToInt(s.getAttribute("c3.alpha"));
-								if(p.redValAddr != NULL){
-									*p.redValAddr = p.redVal = r;
-									*(p.redValAddr + 1) = p.greenVal = g;
-									*(p.redValAddr + 2) = p.blueVal = b;
-									*(p.redValAddr + 3) = p.alphaVal = a;
-									if(verbose_) RLOG_NOTICE << "loading a COLOR '" << paramName <<"' (" << (int)*p.redValAddr << " " << (int)*(p.redValAddr + 1) << " " << (int)*(p.redValAddr + 2) << " " << (int)*(p.redValAddr + 3)  << ") from XML" ;
-								}else{
-									RLOG_ERROR << "ERROR at loading COLOR (" << paramName << ")" ;
-								}
-								}break;
+		if (readKeys.find(paramName) == readKeys.end()){ //lets not read keys twice, only read the first one we find in xml
+
+			if(type.length() >	0){
+
+				unordered_map<string, RemoteUIParam>::iterator it = params.find(paramName);
+
+				readKeys[paramName] = true;
+				loadedParams.push_back(paramName);
+				RemoteUIParam p;
+
+				if(isAParamWeKnowOf){
+					p = params[paramName];
+				}
+
+				switch (type[0]){
+
+					case 'f':{ //float
+						if (!isAParamWeKnowOf){
+							p.type = REMOTEUI_PARAM_FLOAT;
+							p.floatVal = s.getFloatValue();
+						}else{
+							if(p.type != REMOTEUI_PARAM_FLOAT){ RLOG_ERROR << "type missmatch parsing '" << paramName << "'. Ignoring it!"; break;}
+							float val = ofClamp(s.getFloatValue(), p.minFloat, p.maxFloat);
+							p.floatVal = *p.floatValAddr = val;
+							if(verbose_) RLOG_NOTICE << "loading a FLOAT '" << paramName <<"' (" << ofToString( *p.floatValAddr, 3) << ") from XML" ;
+						}
+						}break;
+
+					case 'i':{ //int
+						if (!isAParamWeKnowOf){
+							p.type = REMOTEUI_PARAM_INT;
+							p.intVal = s.getFloatValue();
+						}else{
+							if(p.type != REMOTEUI_PARAM_INT){ RLOG_ERROR << "type missmatch parsing '" << paramName << "'. Ignoring it!"; break;}
+							int val = ofClamp(s.getIntValue(), p.minInt, p.maxInt);
+							p.intVal = *p.intValAddr = val;
+							if(verbose_) RLOG_NOTICE << "loading an INT '" << paramName <<"' (" << (int) *p.intValAddr << ") from XML" ;
+						}
+						}break;
+
+					case 's':{ //string
+						if (!isAParamWeKnowOf){
+							p.type = REMOTEUI_PARAM_STRING;
+							p.stringVal = s.getValue();
+						}else{
+							if(p.type != REMOTEUI_PARAM_STRING){ RLOG_ERROR << "type missmatch parsing '" << paramName << "'. Ignoring it!"; break;}
+							string val = s.getValue();
+							p.stringVal = *p.stringValAddr = val;
+							if(verbose_) RLOG_NOTICE << "loading a STRING '" << paramName <<"' (" << (string) *p.stringValAddr << ") from XML" ;
+						}
+						}break;
+
+					case 'e':{ //enum
+						if (!isAParamWeKnowOf){
+							p.type = REMOTEUI_PARAM_ENUM;
+							p.intVal = s.getIntValue();
+						}else{
+							if(p.type != REMOTEUI_PARAM_ENUM){ RLOG_ERROR << "type missmatch parsing '" << paramName << "'. Ignoring it!"; break;}
+							int val = ofClamp(s.getIntValue(), p.minInt, p.maxInt);
+							p.intVal = *p.intValAddr = val;
+							if(verbose_) RLOG_NOTICE << "loading an ENUM '" << paramName <<"' (" << (int) *p.intValAddr << ") from XML" ;
+						}
+						}break;
+
+					case 'b':{ //bool
+						if (!isAParamWeKnowOf){
+							p.type = REMOTEUI_PARAM_BOOL;
+							p.boolVal = s.getIntValue();
+						}else{
+							if(p.type != REMOTEUI_PARAM_BOOL){ RLOG_ERROR << "type missmatch parsing '" << paramName << "'. Ignoring it!"; break;}
+							bool val = s.getIntValue();
+							p.boolVal = *p.boolValAddr = val;
+							if(verbose_) RLOG_NOTICE << "loading a BOOL '" << paramName <<"' (" << (bool) *p.boolValAddr << ") from XML" ;
+						}
+						}break;
+
+					case 'g':{ //group
+						if (!isAParamWeKnowOf){
+							p.type = REMOTEUI_PARAM_SPACER;
+							p.group = p.stringVal = paramName;
+						}else{
+							if(verbose_) RLOG_NOTICE << "skipping GROUP '" << paramName << "' from XML" ;
+						}
+					}break;
+
+
+					case 'c':{ //color
+						if (!isAParamWeKnowOf){
+							p.type = REMOTEUI_PARAM_COLOR;
+							p.redVal = ofToInt(s.getAttribute("c0.red"));
+							p.greenVal = ofToInt(s.getAttribute("c1.green"));
+							p.blueVal = ofToInt(s.getAttribute("c2.blue"));
+							p.alphaVal = ofToInt(s.getAttribute("c3.alpha"));
+						}else{
+							if(p.type != REMOTEUI_PARAM_COLOR){ RLOG_ERROR << "type missmatch parsing '" << paramName << "'. Ignoring it!"; break;}
+							unsigned char r = ofToInt(s.getAttribute("c0.red"));
+							unsigned char g = ofToInt(s.getAttribute("c1.green"));
+							unsigned char b = ofToInt(s.getAttribute("c2.blue"));
+							unsigned char a = ofToInt(s.getAttribute("c3.alpha"));
+							if(p.redValAddr != NULL){
+								*p.redValAddr = p.redVal = r;
+								*(p.redValAddr + 1) = p.greenVal = g;
+								*(p.redValAddr + 2) = p.blueVal = b;
+								*(p.redValAddr + 3) = p.alphaVal = a;
+								if(verbose_) RLOG_NOTICE << "loading a COLOR '" << paramName <<"' (" << (int)*p.redValAddr << " " << (int)*(p.redValAddr + 1) << " " << (int)*(p.redValAddr + 2) << " " << (int)*(p.redValAddr + 3)  << ") from XML" ;
+							}else{
+								RLOG_ERROR << "ERROR at loading COLOR (" << paramName << ")" ;
 							}
-
-						//params[paramName] = p;
+						}
+					}break;
+				}
+
+				if(isAParamWeKnowOf){
+					params[paramName] = p;
+				}else{
+					RLOG_WARNING << "Param '" << paramName << "' found in XML but not defined in source code! Keeping it arround to save back to XML";
+					if (params_removed.find(paramName) == params_removed.end()){ //not added yet
+						orderedKeys_removed[orderedKeys_removed.size()] = paramName;
 					}
-					if(!loadedFromXML) paramsFromXML[paramName] = params[paramName];
-				}
-			}
-		}else{ //params not defined from code! ignore!
-			RLOG_VERBOSE << "ignoring param '" << paramName << "' defined in xml but found in DB!" ;
+					params_removed[paramName] = p;
+				}
+
+				if(paramsLoadedFromXML.find(paramName) == paramsLoadedFromXML.end()){
+					paramsLoadedFromXML[paramName] = true;
+					paramsFromXML[paramName] = p;
+				}
+			}
 		}
 		s.setToParent();
 	}


let cctor and = do the right thing for storedColors

--- src/ogl/OpenGLTexFont.cxx
+++ src/ogl/OpenGLTexFont.cxx
@@ -419,8 +419,6 @@

 OpenGLTexFont::OpenGLTexFont(const OpenGLTexFont& f)
 {
-  const float color[3] = {1.0, 1.0, 1.0};
-
   rep = f.rep;
   rep->ref();
   bitmapRep = f.bitmapRep;
@@ -429,7 +427,7 @@
   height = f.height;

   for (unsigned int i=0; i < STORED_COLORS; i++) {
-    setColor(i, color);
+    setColor(i, f.storedColor[i]);
   }
 }

@@ -450,6 +448,9 @@
     rep->ref();
     width = f.width;
     height = f.height;
+    for (unsigned int i=0; i < STORED_COLORS; i++) {
+      setColor(i, f.storedColor[i]);
+    }
   }
   return *this;
 }