Added option input-alias-checks and output-alias-checks

Running some AAs (e.g., ds-aa) on large programs takes a long time. We
dump the alias checks to a file and reuse them later to save time.

--- lib/Instrumenters/AliasCheckerInstrumenter.cpp
+++ lib/Instrumenters/AliasCheckerInstrumenter.cpp
@@ -2,6 +2,7 @@

 #define DEBUG_TYPE "dyn-aa"

+#include <cstdio>
 #include <string>

 #include "llvm/Pass.h"
@@ -57,6 +58,8 @@
   Type *VoidType;
   IntegerType *CharType, *IntType, *LongType;
   PointerType *CharStarType;
+  // Input alias checks.
+  DenseMap<unsigned, vector<pair<unsigned, unsigned> > > InputAliasChecks;
 };
 }

@@ -76,6 +79,12 @@
 static cl::opt<bool> NoPHI("no-phi",
                            cl::desc("Store pointer values into slots and "
                                     "load them at the end of functions"));
+static cl::opt<string> OutputAliasChecksName(
+    "output-alias-checks",
+    cl::desc("Dump all alias checks"));
+static cl::opt<string> InputAliasChecksName(
+    "input-alias-checks",
+    cl::desc("Read all alias checks"));

 STATISTIC(NumAliasQueries, "Number of alias queries");
 STATISTIC(NumAliasChecks, "Number of alias checks");
@@ -92,15 +101,18 @@
 }

 void AliasCheckerInstrumenter::getAnalysisUsage(AnalysisUsage &AU) const {
-  AU.addRequired<AliasAnalysis>();
+  if (InputAliasChecksName == "") {
+    // We need not run any AA if the alias checks are inputed by the user.
+    AU.addRequired<AliasAnalysis>();
+    if (BaselineAAName != "") {
+      const PassInfo *PI = lookupPassInfo(BaselineAAName);
+      assert(PI && "The baseline AA is not registered");
+      AU.addRequiredID(PI->getTypeInfo());
+    }
+  }
   AU.addRequired<IntraReach>();
   AU.addRequired<DominatorTree>();
   AU.addRequired<IDAssigner>();
-  if (BaselineAAName != "") {
-    const PassInfo *PI = lookupPassInfo(BaselineAAName);
-    assert(PI && "The baseline AA is not registered");
-    AU.addRequiredID(PI->getTypeInfo());
-  }
 }

 #if 0
@@ -113,10 +125,7 @@
 void AliasCheckerInstrumenter::computeAliasChecks(Function &F,
                                                   InstList &Pointers,
                                                   vector<InstPair> &Checks) {
-  AliasAnalysis &AA = getAnalysis<AliasAnalysis>();
-  AliasAnalysis *BaselineAA = getBaselineAA();
   IntraReach &IR = getAnalysis<IntraReach>();
-
   DenseMap<BasicBlock *, InstList> PointersInBB;
   // TODO: consider arguments
   for (Function::iterator BB = F.begin(); BB != F.end(); ++BB) {
@@ -130,8 +139,28 @@
     }
   }

+  if (InputAliasChecksName != "") {
+    IDAssigner &IDA = getAnalysis<IDAssigner>();
+    DenseMap<unsigned, vector<pair<unsigned, unsigned> > >::iterator I =
+        InputAliasChecks.find(IDA.getFunctionID(&F));
+    if (I != InputAliasChecks.end()) {
+      for (size_t j = 0; j < I->second.size(); ++j) {
+        unsigned InsID1 = I->second[j].first;
+        unsigned InsID2 = I->second[j].second;
+        Instruction *I1 = IDA.getInstruction(InsID1);
+        Instruction *I2 = IDA.getInstruction(InsID2);
+        assert(I1->getParent()->getParent() == &F &&
+               I2->getParent()->getParent() == &F);
+        Checks.push_back(make_pair(I1, I2));
+      }
+    }
+    return;
+  }
+
   // Do not query AA on modified bc. Therefore, we store the checks we are
   // going to add in Checks, and add them to the program later.
+  AliasAnalysis &AA = getAnalysis<AliasAnalysis>();
+  AliasAnalysis *BaselineAA = getBaselineAA();
   unsigned NumAliasQueriesInF = 0;
   for (Function::iterator B1 = F.begin(); B1 != F.end(); ++B1) {
     if (!PointersInBB.count(B1))
@@ -185,8 +214,7 @@
   InstList MergedPointers;
   for (size_t i = 0; i < Pointers.size(); ++i) {
     Instruction *P = Pointers[i];
-    // If P does not reach BB, the alias check does not make
-    // sense because P
+    // If P does not reach BB, the alias check does not make sense because P
     // has an undefined value.
     if (!ReachableBBs.count(P->getParent())) {
       MergedPointers.push_back(NULL);
@@ -334,6 +362,18 @@
   InstList Pointers;
   computeAliasChecks(F, Pointers, Checks);

+  if (OutputAliasChecksName != "") {
+    IDAssigner &IDA = getAnalysis<IDAssigner>();
+    FILE *OutputFile = fopen(OutputAliasChecksName.c_str(), "a");
+    for (size_t i = 0; i < Checks.size(); ++i) {
+      fprintf(OutputFile, "%u: %u %u\n",
+              IDA.getFunctionID(&F),
+              IDA.getInstructionID(Checks[i].first),
+              IDA.getInstructionID(Checks[i].second));
+    }
+    fclose(OutputFile);
+  }
+
   addAliasChecks(F, Pointers, Checks);

   // Remove deallocators.
@@ -374,6 +414,21 @@
                                        AssertNoAliasHookName,
                                        &M);

+  assert(InputAliasChecksName == "" || OutputAliasChecksName == "");
+  // Initialize the output file for alias checks if necessary.
+  if (OutputAliasChecksName != "") {
+    FILE *OutputFile = fopen(OutputAliasChecksName.c_str(), "w");
+    fclose(OutputFile);
+  }
+  // Read input alias checks.
+  if (InputAliasChecksName != "") {
+    FILE *InputFile = fopen(InputAliasChecksName.c_str(), "r");
+    unsigned FuncID, InsID1, InsID2;
+    while (fscanf(InputFile, "%u: %u %u", &FuncID, &InsID1, &InsID2) == 3) {
+      InputAliasChecks[FuncID].push_back(make_pair(InsID1, InsID2));
+    }
+    fclose(InputFile);
+  }
   return true;
 }


[1.7>master] [1.6>1.7] [MERGE #3390 @agarwal-sandeep] Fixes #3387: Fix build break with simd unused variable

Merge pull request #3390 from agarwal-sandeep:issue3387

--- lib/Runtime/Language/i386/AsmJsJitTemplate.cpp
+++ lib/Runtime/Language/i386/AsmJsJitTemplate.cpp
@@ -531,13 +531,16 @@
         const int intConstCount = asmInfo->GetIntConstCount();
         const int doubleConstCount = asmInfo->GetDoubleConstCount();
         const int floatConstCount = asmInfo->GetFloatConstCount();
-        const int simdConstCount = asmInfo->GetSimdConstCount();

         // Offset of doubles from (double*)m_localSlot
         const int intOffsets = asmInfo->GetIntByteOffset() / sizeof(int);
         const int doubleOffsets = asmInfo->GetDoubleByteOffset() / sizeof(double);
         const int floatOffset = asmInfo->GetFloatByteOffset() / sizeof(float);
+
+#ifdef ENABLE_SIMDJS
+        const int simdConstCount = asmInfo->GetSimdConstCount();
         const int simdByteOffset = asmInfo->GetSimdByteOffset(); // in bytes
+#endif

         int argoffset = (int)args;
         // initialize argument location


[X86] Also pretty-print shuffle mask for INSERTPS rm variants.

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

--- lib/Target/X86/InstPrinter/X86InstComments.cpp
+++ lib/Target/X86/InstPrinter/X86InstComments.cpp
@@ -140,11 +140,15 @@

   case X86::INSERTPSrr:
   case X86::VINSERTPSrr:
-    DestName = getRegName(MI->getOperand(0).getReg());
-    Src1Name = getRegName(MI->getOperand(1).getReg());
-    Src2Name = getRegName(MI->getOperand(2).getReg());
-    if(MI->getOperand(3).isImm())
-      DecodeINSERTPSMask(MI->getOperand(3).getImm(), ShuffleMask);
+    Src2Name = getRegName(MI->getOperand(2).getReg());
+    // FALL THROUGH.
+  case X86::INSERTPSrm:
+  case X86::VINSERTPSrm:
+    DestName = getRegName(MI->getOperand(0).getReg());
+    Src1Name = getRegName(MI->getOperand(1).getReg());
+    if(MI->getOperand(MI->getNumOperands()-1).isImm())
+      DecodeINSERTPSMask(MI->getOperand(MI->getNumOperands()-1).getImm(),
+                         ShuffleMask);
     break;

   case X86::MOVLHPSrr:


Fix Transforms/DeadArgElim/2007-02-07-FuncRename.ll, fallout from PR411.
This happened because deadargelim now causes VMCore to auto-rename every
function that it hacks arguments out of.  Because it hacks arguments out of
functions in a non-deterministic order, this caused the resultant numbering
to be nondet.  The fix is to just be careful to not rename functions!

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

--- lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -150,7 +150,8 @@
   unsigned NumArgs = Params.size();

   // Create the new function body and insert it into the module...
-  Function *NF = new Function(NFTy, Fn.getLinkage(), Fn.getName());
+  std::string Name = Fn.getName(); Fn.setName("");
+  Function *NF = new Function(NFTy, Fn.getLinkage(), Name);
   NF->setCallingConv(Fn.getCallingConv());
   Fn.getParent()->getFunctionList().insert(&Fn, NF);

@@ -508,7 +509,8 @@
   FunctionType *NFTy = FunctionType::get(RetTy, Params, FTy->isVarArg());

   // Create the new function body and insert it into the module...
-  Function *NF = new Function(NFTy, F->getLinkage(), F->getName());
+  std::string Name = F->getName(); F->setName("");
+  Function *NF = new Function(NFTy, F->getLinkage(), Name);
   NF->setCallingConv(F->getCallingConv());
   F->getParent()->getFunctionList().insert(F, NF);


* s/Method/Function
* Fix bug where the character after a % was being discarded

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

--- lib/Transforms/Instrumentation/TraceValues.cpp
+++ lib/Transforms/Instrumentation/TraceValues.cpp
@@ -1,6 +1,6 @@
 //===- TraceValues.cpp - Value Tracing for debugging -------------*- C++ -*--=//
 //
-// Support for inserting LLVM code to print values at basic block and method
+// Support for inserting LLVM code to print values at basic block and function
 // exits.
 //
 //===----------------------------------------------------------------------===//
@@ -38,13 +38,13 @@
     //--------------------------------------------------------------------------
     // Function InsertCodeToTraceValues
     //
-    // Inserts tracing code for all live values at basic block and/or method
+    // Inserts tracing code for all live values at basic block and/or function
     // exits as specified by `traceBasicBlockExits' and `traceFunctionExits'.
     //
     static bool doit(Function *M, bool traceBasicBlockExits,
                      bool traceFunctionExits, Function *Printf);

-    // runOnMethod - This method does the work.  Always successful.
+    // runOnFunction - This method does the work.
     //
     bool runOnMethod(Function *F) {
       return doit(F, TraceBasicBlockExits, TraceFunctionExits, PrintfFunc);
@@ -53,11 +53,11 @@
 } // end anonymous namespace

-Pass *createTraceValuesPassForMethod() {       // Just trace methods
+Pass *createTraceValuesPassForMethod() {       // Just trace functions
   return new InsertTraceCode(false, true);
 }

-Pass *createTraceValuesPassForBasicBlocks() {  // Trace BB's and methods
+Pass *createTraceValuesPassForBasicBlocks() {  // Trace BB's and functions
   return new InsertTraceCode(true, true);
 }

@@ -123,24 +123,15 @@

 static string getPrintfCodeFor(const Value *V) {
   if (V == 0) return "";
-  switch (V->getType()->getPrimitiveID()) {
-  case Type::BoolTyID:
-  case Type::UByteTyID: case Type::UShortTyID:
-  case Type::UIntTyID:  case Type::ULongTyID:
-  case Type::SByteTyID: case Type::ShortTyID:
-  case Type::IntTyID:   case Type::LongTyID:
+  if (V->getType()->isFloatingPoint())
+    return "%g";
+  else if (V->getType() == Type::LabelTy || isa<PointerType>(V->getType()))
+    return "0x%p";
+  else if (V->getType()->isIntegral() || V->getType() == Type::BoolTy)
     return "%d";

-  case Type::FloatTyID: case Type::DoubleTyID:
-    return "%g";
-
-  case Type::LabelTyID: case Type::PointerTyID:
-    return "%p";
-
-  default:
-    assert(0 && "Illegal value to print out...");
-    return "";
-  }
+  assert(0 && "Illegal value to print out...");
+  return "";
 }

@@ -149,7 +140,7 @@
   // Escape Message by replacing all % characters with %% chars.
   unsigned Offset = 0;
   while ((Offset = Message.find('%', Offset)) != string::npos) {
-    Message.replace(Offset, 2, "%%");
+    Message.replace(Offset, 1, "%%");
     Offset += 2;  // Skip over the new %'s
   }

@@ -188,8 +179,8 @@
 // or that is stored to memory in this basic block.
 // If the value is stored to memory, we load it back before printing
 // We also return all such loaded values in the vector valuesStoredInFunction
-// for printing at the exit from the method.  (Note that in each invocation
-// of the method, this will only get the last value stored for each static
+// for printing at the exit from the function.  (Note that in each invocation
+// of the function, this will only get the last value stored for each static
 // store instruction).
 // *bb must be the block in which the value is computed;
 // this is not checked here.
@@ -232,7 +223,7 @@
     Instruction *I = *II;
     if (StoreInst *SI = dyn_cast<StoreInst>(I)) {
       assert(valuesStoredInFunction &&
-             "Should not be printing a store instruction at method exit");
+             "Should not be printing a store instruction at function exit");
       LoadInst *LI = new LoadInst(SI->getPointerOperand(), SI->copyIndices(),
                                   "reload");
       InsertPos = BB->getInstList().insert(InsertPos, LI) + 1;
@@ -250,7 +241,7 @@

   std::ostringstream OutStr;
   WriteAsOperand(OutStr, M, true);
-  InsertPrintInst(0, BB, BBI, "ENTERING METHOD: " + OutStr.str(), Printf);
+  InsertPrintInst(0, BB, BBI, "ENTERING FUNCTION: " + OutStr.str(), Printf);

   // Now print all the incoming arguments
   const Function::ArgumentListType &argList = M->getArgumentList();
@@ -271,7 +262,7 @@

   std::ostringstream OutStr;
   WriteAsOperand(OutStr, BB->getParent(), true);
-  InsertPrintInst(0, BB, BBI, "LEAVING  METHOD: " + OutStr.str(), Printf);
+  InsertPrintInst(0, BB, BBI, "LEAVING  FUNCTION: " + OutStr.str(), Printf);

   // print the return value, if any
   if (BB->getParent()->getReturnType() != Type::VoidTy)


Use Instruction::moveBefore instead of manipulating the instruction list
directly.

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

--- lib/Transforms/Scalar/InstructionCombining.cpp
+++ lib/Transforms/Scalar/InstructionCombining.cpp
@@ -1672,9 +1672,8 @@
       }
       Root.replaceAllUsesWith(TmpLHSI);          // Users now use TmpLHSI
       TmpLHSI->setOperand(1, &Root);             // TmpLHSI now uses the root
-      TmpLHSI->getParent()->getInstList().remove(TmpLHSI);
       BasicBlock::iterator ARI = &Root; ++ARI;
-      BB->getInstList().insert(ARI, TmpLHSI);    // Move TmpLHSI to after Root
+      TmpLHSI->moveBefore(ARI);                  // Move TmpLHSI to after Root
       ARI = Root;

       // Now propagate the ExtraOperand down the chain of instructions until we
@@ -1683,8 +1682,7 @@
         Instruction *NextLHSI = cast<Instruction>(TmpLHSI->getOperand(0));
         // Move the instruction to immediately before the chain we are
         // constructing to avoid breaking dominance properties.
-        NextLHSI->getParent()->getInstList().remove(NextLHSI);
-        BB->getInstList().insert(ARI, NextLHSI);
+        NextLHSI->moveBefore(ARI);
         ARI = NextLHSI;

         Value *NextOp = NextLHSI->getOperand(1);


- instcombine (~(a < b)) into (a >= b)

  - instcombine (~(a < b)) into (a >= b)

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

--- lib/Transforms/Scalar/InstructionCombining.cpp
+++ lib/Transforms/Scalar/InstructionCombining.cpp
@@ -328,10 +328,18 @@
     if (Op1C->isNullValue())
       return ReplaceInstUsesWith(I, Op0);

-    // xor (xor X, -1), -1 = not (not X) = X
-    if (Op1C->isAllOnesValue())
+    // Is this a "NOT" instruction?
+    if (Op1C->isAllOnesValue()) {
+      // xor (xor X, -1), -1 = not (not X) = X
       if (Value *X = dyn_castNotInst(Op0))
         return ReplaceInstUsesWith(I, X);
+
+      // xor (setcc A, B), true = not (setcc A, B) = setncc A, B
+      if (SetCondInst *SCI = dyn_cast<SetCondInst>(Op0))
+        if (SCI->use_size() == 1)
+          return new SetCondInst(SCI->getInverseCondition(),
+                                 SCI->getOperand(0), SCI->getOperand(1));
+    }
   }

   return Changed ? &I : 0;


hack to fix bzip2 (bug 571)

hack to fix bzip2 (bug 571)

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

--- lib/Transforms/Scalar/InstructionCombining.cpp
+++ lib/Transforms/Scalar/InstructionCombining.cpp
@@ -3088,6 +3088,8 @@
     return 0;
   }

+  return 0; //The rest of this function is broken.  See bug 571
+
   // Okay, we have the two reduced sized operands.  If we are doing a <,>
   // comparison, make sure we perform the compare with the same signedness as
   // the DestTy.  We don't have to do this if the comparison is !=/== or if the


V1.3

V1.3

getLastBlockDate fix

--- src/qt/clientmodel.cpp
+++ src/qt/clientmodel.cpp
@@ -49,7 +49,10 @@

 QDateTime ClientModel::getLastBlockDate() const
 {
-    return QDateTime::fromTime_t(pindexBest->GetBlockTime());
+    if (pindexBest)
+      return QDateTime::fromTime_t(pindexBest->GetBlockTime());
+    else
+      return QDateTime::fromTime_t(1374635824); // Genesis block's time
 }

 void ClientModel::updateTimer()


Set both time/height header caches at the same time

--- src/qt/clientmodel.cpp
+++ src/qt/clientmodel.cpp
@@ -106,6 +106,7 @@
         LOCK(cs_main);
         if (pindexBestHeader) {
             cachedBestHeaderHeight = pindexBestHeader->nHeight;
+            cachedBestHeaderTime = pindexBestHeader->GetBlockTime();
         }
     }
     return cachedBestHeaderHeight;
@@ -116,6 +117,7 @@
     if (cachedBestHeaderTime == -1) {
         LOCK(cs_main);
         if (pindexBestHeader) {
+            cachedBestHeaderHeight = pindexBestHeader->nHeight;
             cachedBestHeaderTime = pindexBestHeader->GetBlockTime();
         }
     }


Do not start bitcoin: thread on OSX. fixes #889

--- src/qt/qtipcserver.cpp
+++ src/qt/qtipcserver.cpp
@@ -44,6 +44,11 @@

 void ipcInit()
 {
+#ifdef MAC_OSX
+    // TODO: implement bitcoin: URI handling the Mac Way
+    return;
+#endif
+
     message_queue* mq;
     char strBuf[257];
     size_t nSize;


Update walletframe.cpp

Update walletframe.cpp

--- src/qt/walletframe.cpp
+++ src/qt/walletframe.cpp
@@ -8,6 +8,7 @@
 #include "walletview.h"

 #include <cstdio>
+#include <iostream>

 #include <QHBoxLayout>
 #include <QLabel>
@@ -175,6 +176,14 @@
         walletView->unlockWallet();
 }

+void WalletFrame::printPaperWallets()
+{
+    WalletView *walletView = currentWalletView();
+    if (walletView)
+        walletView->printPaperWallets();
+}
+
+
 void WalletFrame::lockWallet()
 {
     WalletView *walletView = currentWalletView();


Changed Messages of Random AI

Changed Messages of Random AI

--- src/randomaiplayer.cpp
+++ src/randomaiplayer.cpp
@@ -38,7 +38,21 @@

 void RandomAIPlayer::doTurn()
 {
-    emit sendMessage("???");
+    int random = qrand()%10;
+
+    if(random == 0)
+    {
+        emit sendMessage("What am I doing?");
+    }
+    else
+    {
+        QString s = "";
+        for(int i = 0; i < random; --random)
+        {
+            s = QString("%1%2").arg(s).arg("?");
+        }
+        emit sendMessage(s);
+    }
     emit turn(qrand()%8, qrand()%8);
 }


Introduce a private FUNC_INFO shortcut macro

--- TelegramQt/Debug_p.hpp
+++ TelegramQt/Debug_p.hpp
@@ -21,6 +21,9 @@
 #include "Debug.hpp"
 #include "TLNumbers.hpp"
 #include "TLValues.hpp"
+
+// Macro for stream debug output
+#define CALL_INFO this << __func__

 TELEGRAMQT_INTERNAL_EXPORT QDebug operator<<(QDebug d, const TLValue &v);


removed optimize conditionals in TemperatureFormats.cpp

--- TemperatureFormats.cpp
+++ TemperatureFormats.cpp
@@ -22,17 +22,6 @@
 #include <string.h>
 #include <limits.h>
 #include "TempControl.h"
-
-/**
- * Before (no-optimize)
-				Program Memory Usage 	:	26230 bytes   80.0 % Full
-				Data Memory Usage 		:	1081 bytes   42.2 % Full
- * After
-				Program Memory Usage 	:	26058 bytes   79.5 % Full
-				Data Memory Usage 		:	1087 bytes   42.5 % Full
- */
-#define OPTIMIZE_TEMPERATURE_FORMATS_fixedPointToString 1 && OPTIMIZE_TEMPERATURE_FORMATS
-#define OPTIMIZE_TEMPERATURE_FORMATS_convertAntConstrain 1 && OPTIMIZE_TEMPERATURE_FORMATS

 // result can have maximum length of : sign + 3 digits integer part + point + 3 digits fraction part + '\0' = 9 bytes;
 // only 1, 2 or 3 decimals allowed.
@@ -72,7 +61,6 @@

 	int intPart = rawValue >> 9;
 	uint16_t fracPart;
-#if OPTIMIZE_TEMPERATURE_FORMATS_fixedPointToString
 	const char* fmt;
 	uint16_t scale;
 	switch (numDecimals)
@@ -95,32 +83,6 @@
 		fracPart = 0;
 	}
 	mysnprintf_P(&s[1], maxLength-1, fmt,  intPart, fracPart);
-#else
-	if(numDecimals == 1){
-		fracPart = ((rawValue & 0x01FF) * 10 + 256) >> 9; // add 256 for rounding
-		if(fracPart >= 10){
-			intPart++;
-			fracPart = 0; // has already overflowed into integer part.
-		}
-		snprintf_P(&s[1], maxLength-1, PSTR("%d.%01d"), intPart, fracPart);
-	}
-	else if(numDecimals == 2){
-		fracPart = ((rawValue  & 0x01FF) * 100 + 256) >> 9;
-		if(fracPart >= 100){
-			intPart++;
-			fracPart = 0; // has already overflowed into integer part.
-		}
-		snprintf_P(&s[1], maxLength-1, PSTR("%d.%02d"), intPart, fracPart);
-	}
-	else{
-		fracPart = ((rawValue  & 0x01FF) * 1000 + 256) >> 9;
-		if(fracPart>=1000){
-			intPart++;
-			fracPart = 0; // has already overflowed into integer part.
-		}
-		snprintf_P(&s[1], maxLength-1, PSTR("%d.%03d"),  intPart, fracPart);
-	}
-#endif
 	return s;
 }

@@ -134,14 +96,7 @@

 fixed7_9 stringToTemp(const char * numberString){
 	fixed23_9 rawTemp = stringToFixedPoint(numberString);
-#ifdef OPTIMIZE_TEMPERATURE_FORMATS_convertAntConstrain
 	return convertAndConstrain(rawTemp, 32<<9);
-#else
-	if(tempControl.cc.tempFormat == 'F'){
-		rawTemp = ((rawTemp - (32 << 9)) * 5) / 9; // convert to store as Celsius
-	}
-	return constrainTemp16(rawTemp);
-#endif
 }

 fixed23_9 stringToFixedPoint(const char * numberString){
@@ -184,14 +139,7 @@

 fixed7_9 stringToTempDiff(const char * numberString){
 	fixed23_9 rawTempDiff = stringToFixedPoint(numberString);
-#ifdef OPTIMIZE_TEMPERATURE_FORMATS_convertAntConstrain
 	return convertAndConstrain(rawTempDiff, 0);
-#else
-	if(tempControl.cc.tempFormat == 'F'){
-		rawTempDiff = (rawTempDiff * 5) / 9; // convert to store as Celsius
-	}
-	return constrainTemp16(rawTempDiff);
-#endif
 }

 int fixedToTenths(fixed23_9 temperature){


FIX: renmove debug printing

FIX: renmove debug printing

--- lib/smurff-cpp/SmurffCpp/Priors/MacauPrior.cpp
+++ lib/smurff-cpp/SmurffCpp/Priors/MacauPrior.cpp
@@ -135,8 +135,6 @@
     }
     // complexity: num_feat x num_feat x num_latent
     BBt = beta() * beta().transpose();
-    std::cout << "beta: " << beta().rows() << " x " << beta().cols() << std::endl;
-    std::cout << "BBt: " << BBt.rows() << " x " << BBt.cols() << std::endl;
 }

 const Eigen::VectorXd MacauPrior::getMu(int n) const


Default route for image layout switch statements (fixes gcc compiler warnings, refs #103)

--- base/VulkanTools.cpp
+++ base/VulkanTools.cpp
@@ -156,6 +156,9 @@
 				// Make sure any shader reads from the image have been finished
 				imageMemoryBarrier.srcAccessMask = VK_ACCESS_SHADER_READ_BIT;
 				break;
+			default:
+				// Other source layouts aren't handled (yet)
+				break;
 			}

 			// Target layouts (new)
@@ -194,6 +197,9 @@
 					imageMemoryBarrier.srcAccessMask = VK_ACCESS_HOST_WRITE_BIT | VK_ACCESS_TRANSFER_WRITE_BIT;
 				}
 				imageMemoryBarrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
+				break;
+			default:
+				// Other source layouts aren't handled (yet)
 				break;
 			}


fix bench_gemm

fix bench_gemm

--- bench/bench_gemm.cpp
+++ bench/bench_gemm.cpp
@@ -161,10 +161,11 @@
   A a(m,p); a.setRandom();
   B b(p,n); b.setRandom();
   C c(m,n); c.setOnes();
+  C rc = c;

   std::cout << "Matrix sizes = " << m << "x" << p << " * " << p << "x" << n << "\n";
   std::ptrdiff_t mc(m), nc(n), kc(p);
-  computeProductBlockingSizes<Scalar,Scalar>(kc, mc, nc);
+  internal::computeProductBlockingSizes<Scalar,Scalar>(kc, mc, nc);
   std::cout << "blocking size (mc x kc) = " << mc << " x " << kc << "\n";

   C r = c;
@@ -188,23 +189,22 @@
     blas_gemm(a,b,r);
     c.noalias() += a * b;
     if(!r.isApprox(c)) std::cerr << "Warning, your product is crap!\n\n";
-//     std::cerr << r << "\n\n" << c << "\n\n";
   #else
     gemm(a,b,c);
     r.noalias() += a.cast<Scalar>() * b.cast<Scalar>();
     if(!r.isApprox(c)) std::cerr << "Warning, your product is crap!\n\n";
-//     std::cerr << c << "\n\n";
-//     std::cerr << r << "\n\n";
   #endif

   #ifdef HAVE_BLAS
   BenchTimer tblas;
+  c = rc;
   BENCH(tblas, tries, rep, blas_gemm(a,b,c));
   std::cout << "blas  cpu         " << tblas.best(CPU_TIMER)/rep  << "s  \t" << (double(m)*n*p*rep*2/tblas.best(CPU_TIMER))*1e-9  <<  " GFLOPS \t(" << tblas.total(CPU_TIMER)  << "s)\n";
   std::cout << "blas  real        " << tblas.best(REAL_TIMER)/rep << "s  \t" << (double(m)*n*p*rep*2/tblas.best(REAL_TIMER))*1e-9 <<  " GFLOPS \t(" << tblas.total(REAL_TIMER) << "s)\n";
   #endif

   BenchTimer tmt;
+  c = rc;
   BENCH(tmt, tries, rep, gemm(a,b,c));
   std::cout << "eigen cpu         " << tmt.best(CPU_TIMER)/rep  << "s  \t" << (double(m)*n*p*rep*2/tmt.best(CPU_TIMER))*1e-9  <<  " GFLOPS \t(" << tmt.total(CPU_TIMER)  << "s)\n";
   std::cout << "eigen real        " << tmt.best(REAL_TIMER)/rep << "s  \t" << (double(m)*n*p*rep*2/tmt.best(REAL_TIMER))*1e-9 <<  " GFLOPS \t(" << tmt.total(REAL_TIMER) << "s)\n";
@@ -213,8 +213,9 @@
   if(procs>1)
   {
     BenchTimer tmono;
-    //omp_set_num_threads(1);
-    Eigen::setNbThreads(1);
+    omp_set_num_threads(1);
+    Eigen::internal::setNbThreads(1);
+    c = rc;
     BENCH(tmono, tries, rep, gemm(a,b,c));
     std::cout << "eigen mono cpu    " << tmono.best(CPU_TIMER)/rep  << "s  \t" << (double(m)*n*p*rep*2/tmono.best(CPU_TIMER))*1e-9  <<  " GFLOPS \t(" << tmono.total(CPU_TIMER)  << "s)\n";
     std::cout << "eigen mono real   " << tmono.best(REAL_TIMER)/rep << "s  \t" << (double(m)*n*p*rep*2/tmono.best(REAL_TIMER))*1e-9 <<  " GFLOPS \t(" << tmono.total(REAL_TIMER) << "s)\n";


Remove unused file fileno.hpp.

Remove unused file fileno.hpp.

--- libraries/chain/include/eosio/chain/fileno.hpp
+++ libraries/chain/include/eosio/chain/fileno.hpp
@@ -1,192 +0,0 @@
-#pragma once
-
-#include <cstdio>  // declaration of ::fileno
-#include <fstream>  // for basic_filebuf template
-#include <cerrno>
-
-#if defined(__GLIBCXX__) || (defined(__GLIBCPP__) && __GLIBCPP__>=20020514)  // GCC >= 3.1.0
-# include <ext/stdio_filebuf.h>
-#endif
-#if defined(__GLIBCXX__) // GCC >= 3.4.0
-# include <ext/stdio_sync_filebuf.h>
-#endif
-
-#if defined(_LIBCPP_VERSION)
-// Generate a static data member of type Tag::type in which to store
-// the address of a private member. It is crucial that Tag does not
-// depend on the /value/ of the the stored address in any way so that
-// we can access it from ordinary code without directly touching
-// private data.
-template < class Tag >
-struct stowed
-{
-  static typename Tag::type value;
-};
-
-template < class Tag >
-typename Tag::type stowed< Tag >::value;
-
-// Generate a static data member whose constructor initializes
-// stowed< Tag >::value. This type will only be named in an explicit
-// instantiation, where it is legal to pass the address of a private
-// member.
-template < class Tag, typename Tag::type x >
-struct stow_private
-{
-  stow_private() { stowed< Tag >::value = x; }
-  static stow_private instance;
-};
-template < class Tag, typename Tag::type x >
-stow_private< Tag, x > stow_private< Tag, x >::instance;
-
-struct filebuf_file { typedef FILE*( std::filebuf::*type ); };
-template struct stow_private< filebuf_file, &std::filebuf::__file_ >;
-#endif
-
-//! Similar to fileno(3), but taking a C++ stream as argument instead of a
-//! FILE*.  Note that there is no way for the library to track what you do with
-//! the descriptor, so be careful.
-//! \return  The integer file descriptor associated with the stream, or -1 if
-//!   that stream is invalid.  In the latter case, for the sake of keeping the
-//!   code as similar to fileno(3), errno is set to EBADF.
-//! \see  The upstream page at
-//!   http://www.ginac.de/~kreckel/fileno/ of this code provides more
-//!   detailed information.
-template <typename charT, typename traits>
-inline int
-fileno_hack(const std::basic_ios<charT, traits>& stream)
-{
-    // Some C++ runtime libraries shipped with ancient GCC, Sun Pro,
-    // Sun WS/Forte 5/6, Compaq C++ supported non-standard file descriptor
-    // access basic_filebuf<>::fd().  Alas, starting from GCC 3.1, the GNU C++
-    // runtime removes all non-standard std::filebuf methods and provides an
-    // extension template class __gnu_cxx::stdio_filebuf on all systems where
-    // that appears to make sense (i.e. at least all Unix systems).  Starting
-    // from GCC 3.4, there is an __gnu_cxx::stdio_sync_filebuf, in addition.
-    // Sorry, darling, I must get brutal to fetch the darn file descriptor!
-    // Please complain to your compiler/libstdc++ vendor...
-#if defined(__GLIBCXX__) || defined(__GLIBCPP__)
-    // OK, stop reading here, because it's getting obscene.  Cross fingers!
-# if defined(__GLIBCXX__)  // >= GCC 3.4.0
-    // This applies to cin, cout and cerr when not synced with stdio:
-    typedef __gnu_cxx::stdio_filebuf<charT, traits> unix_filebuf_t;
-    unix_filebuf_t* fbuf = dynamic_cast<unix_filebuf_t*>(stream.rdbuf());
-    if (fbuf != NULL) {
-        return fbuf->fd();
-    }
-
-    // This applies to filestreams:
-    typedef std::basic_filebuf<charT, traits> filebuf_t;
-    filebuf_t* bbuf = dynamic_cast<filebuf_t*>(stream.rdbuf());
-    if (bbuf != NULL) {
-        // This subclass is only there for accessing the FILE*.  Ouuwww, sucks!
-        struct my_filebuf : public std::basic_filebuf<charT, traits> {
-            // Note: _M_file is of type __basic_file<char> which has a
-            // FILE* as its first (but private) member variable.
-            FILE* c_file() { return *(FILE**)(&this->_M_file); }
-        };
-        FILE* c_file = static_cast<my_filebuf*>(bbuf)->c_file();
-        if (c_file != NULL) {  // Could be NULL for failed ifstreams.
-            return ::fileno(c_file);
-        }
-    }
-
-    // This applies to cin, cout and cerr when synced with stdio:
-    typedef __gnu_cxx::stdio_sync_filebuf<charT, traits> sync_filebuf_t;
-    sync_filebuf_t* sbuf = dynamic_cast<sync_filebuf_t*>(stream.rdbuf());
-    if (sbuf != NULL) {
-#  if (__GLIBCXX__<20040906) // GCC < 3.4.2
-        // This subclass is only there for accessing the FILE*.
-        // See GCC PR#14600 and PR#16411.
-        struct my_filebuf : public sync_filebuf_t {
-            my_filebuf();  // Dummy ctor keeps the compiler happy.
-            // Note: stdio_sync_filebuf has a FILE* as its first (but private)
-            // member variable.  However, it is derived from basic_streambuf<>
-            // and the FILE* is the first non-inherited member variable.
-            FILE* c_file() {
-                return *(FILE**)((char*)this + sizeof(std::basic_streambuf<charT, traits>));
-            }
-        };
-        return ::fileno(static_cast<my_filebuf*>(sbuf)->c_file());
-#  else
-        return ::fileno(sbuf->file());
-#  endif
-    }
-# else  // GCC < 3.4.0 used __GLIBCPP__
-#  if (__GLIBCPP__>=20020514)  // GCC >= 3.1.0
-    // This applies to cin, cout and cerr:
-    typedef __gnu_cxx::stdio_filebuf<charT, traits> unix_filebuf_t;
-    unix_filebuf_t* buf = dynamic_cast<unix_filebuf_t*>(stream.rdbuf());
-    if (buf != NULL) {
-        return buf->fd();
-    }
-
-    // This applies to filestreams:
-    typedef std::basic_filebuf<charT, traits> filebuf_t;
-    filebuf_t* bbuf = dynamic_cast<filebuf_t*>(stream.rdbuf());
-    if (bbuf != NULL) {
-        // This subclass is only there for accessing the FILE*.  Ouuwww, sucks!
-        struct my_filebuf : public std::basic_filebuf<charT, traits> {
-            // Note: _M_file is of type __basic_file<char> which has a
-            // FILE* as its first (but private) member variable.
-            FILE* c_file() { return *(FILE**)(&this->_M_file); }
-        };
-        FILE* c_file = static_cast<my_filebuf*>(bbuf)->c_file();
-        if (c_file != NULL) {  // Could be NULL for failed ifstreams.
-            return ::fileno(c_file);
-        }
-    }
-#  else  // GCC 3.0.x
-    typedef std::basic_filebuf<charT, traits> filebuf_t;
-    filebuf_t* fbuf = dynamic_cast<filebuf_t*>(stream.rdbuf());
-    if (fbuf != NULL) {
-        struct my_filebuf : public filebuf_t {
-            // Note: basic_filebuf<charT, traits> has a __basic_file<charT>* as
-            // its first (but private) member variable.  Since it is derived
-            // from basic_streambuf<charT, traits> we can guess its offset.
-            // __basic_file<charT> in turn has a FILE* as its first (but
-            // private) member variable.  Get it by brute force.  Oh, geez!
-            FILE* c_file() {
-                std::__basic_file<charT>* ptr_M_file = *(std::__basic_file<charT>**)((char*)this + sizeof(std::basic_streambuf<charT, traits>));
-#  if _GLIBCPP_BASIC_FILE_INHERITANCE
-                // __basic_file<charT> inherits from __basic_file_base<charT>
-                return *(FILE**)((char*)ptr_M_file + sizeof(std::__basic_file_base<charT>));
-#  else
-                // __basic_file<charT> is base class, but with vptr.
-                return *(FILE**)((char*)ptr_M_file + sizeof(void*));
-#  endif
-            }
-        };
-        return ::fileno(static_cast<my_filebuf*>(fbuf)->c_file());
-    }
-#  endif
-# endif
-#elif defined(_LIBCPP_VERSION)
-    return ::fileno(stream.rdbuf()->*stowed< filebuf_file >::value);
-#else
-#  error "Does anybody know how to fetch the bloody file descriptor?"
-    return stream.rdbuf()->fd();  // Maybe a good start?
-#endif
-#if !defined(_LIBCPP_VERSION)
-    errno = EBADF;
-#endif
-    return -1;
-}
-
-#if defined(_LIBCPP_VERSION)
-//! 8-Bit character instantiation: fileno(ios).
-template <>
-int
-fileno_hack<char>(const std::ios& stream)
-{
-    return fileno_hack(stream);
-}
-
-//! Wide character instantiation: fileno(wios).
-template <>
-int
-fileno_hack<wchar_t>(const std::wios& stream)
-{
-    return fileno_hack(stream);
-}
-#endif


Fixed find function naming

Fixed find function naming

--- Include/Solaire/Core/Container.hpp
+++ Include/Solaire/Core/Container.hpp
@@ -130,11 +130,11 @@
             }
         }

-        SOLAIRE_FORCE_INLINE int32_t FindFirstOf(const T& aValue) const throw() {
-            return FindNextOf(0, aValue);
-        }
-
-        inline int32_t FindNextOf(const int32_t aIndex, const T& aValue) const throw() {
+        SOLAIRE_FORCE_INLINE int32_t findFirstOf(const T& aValue) const throw() {
+            return findNextOf(0, aValue);
+        }
+
+        inline int32_t findNextOf(const int32_t aIndex, const T& aValue) const throw() {
             const int32_t length = size();
             if(isContiguous()) {
                 const T* const ptr = getPtr(0);
@@ -150,14 +150,14 @@
             return length;
         }

-        inline int32_t FindLastOf(const T& aValue) const throw() {
+        inline int32_t findLastOf(const T& aValue) const throw() {
             const int32_t end = size();
-            int32_t i = FindFirstOf(aValue);
+            int32_t i = findFirstOf(aValue);
             int32_t j = i;

             while(i != end) {
                 j = i;
-                i = FindNextOf(i + 1, aValue);
+                i = findNextOf(i + 1, aValue);
             }

             return j;


INTEGRATION: CWS sch05 (1.3.112); FILE MERGED 2004/11/25 14:18:11 iha 1.3.112.1: #i37758# formatpaintbrush didn't not work with custom shapes

--- sd/source/ui/docshell/formatclipboard.cxx
+++ sd/source/ui/docshell/formatclipboard.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: formatclipboard.cxx,v $
  *
- *  $Revision: 1.3 $
- *
- *  last change: $Author: hr $ $Date: 2004-08-05 11:03:14 $
+ *  $Revision: 1.4 $
+ *
+ *  last change: $Author: rt $ $Date: 2004-12-10 17:22:43 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -141,8 +141,10 @@
         case OBJ_DUMMY:
         case OBJ_FRAME:
         case OBJ_UNO:
+            return false;
+            break;
         case OBJ_CUSTOMSHAPE:
-            return false;
+            return true;
             break;
         default:
             return false;


properly set intensity to zero when range is invalid

--- software/perception/maps/src/LcmTranslator.cpp
+++ software/perception/maps/src/LcmTranslator.cpp
@@ -575,8 +575,8 @@
     msg.intensity_scale = intensityScale;
     std::vector<float> intensities = iScan.getIntensities();
     for (size_t i = 0; i < ranges.size(); ++i) {
+      intensities[i] = intensities[i]/intensityScale + 0.5f;
       if (ranges[i] <= 0) intensities[i] = 0;
-      intensities[i] = intensities[i]/intensityScale + 0.5f;
       if (intensities[i] > 255) intensities[i] = 255;
     }
     bytes = std::vector<uint8_t>


Simplify mShadowModulativePass shaders - strange code that sample absent texture in fragment program removed. Note - dest alpha would be preserved if shadowColor.w would be 1.0

--- OgreMain/src/OgreShadowVolumeExtrudeProgram.cpp
+++ OgreMain/src/OgreShadowVolumeExtrudeProgram.cpp
@@ -649,12 +649,10 @@

 	 String ShadowVolumeExtrudeProgram::mModulate_Fs_hlsl_4_0 =
-        "Texture2D RT : register(t0);\n"
-        "SamplerState RTState : register(s0); \n"
         "uniform float4 shadowColor;\n"
-        "float4 ShadowBlend_ps(float4 position : SV_POSITION, float2 iTexCoord : TEXCOORD0) : SV_Target\n"
-        "{\n"
-        "   return float4(shadowColor.xyz, RT.Sample(RTState, iTexCoord).w);\n"
+        "float4 ShadowBlend_ps(float4 position : SV_POSITION) : SV_Target\n"
+        "{\n"
+        "   return shadowColor;\n"
         "}";

@@ -663,21 +661,17 @@
         "(\n"
         "in float4 inPos : POSITION,\n"
         "out float4 pos : SV_POSITION,\n"
-        "out float2 uv0 : TEXCOORD0,\n"
         "uniform float4x4 worldViewProj\n"
         ")\n"
         "{\n"
         "   pos = mul(worldViewProj, inPos);\n"
-        "   inPos.xy = sign(inPos.xy);\n"
-        "   uv0 = (float2(inPos.x, -inPos.y) + 1.0f) * 0.5f;\n"
         "}";

 	 String ShadowVolumeExtrudeProgram::mModulate_Fs_cg =
-		 "sampler2D RT : register(s0);\n"
 		 "uniform float4 shadowColor; \n"
-		 "float4 ShadowBlend_ps(float2 iTexCoord : TEXCOORD0) : COLOR\n"
+		 "float4 ShadowBlend_ps() : COLOR\n"
 		 "{\n"
-         "   return float4(shadowColor.xyz, tex2D(RT, iTexCoord).w);\n"
+         "   return shadowColor;\n"
 		"}\n";

 	 String ShadowVolumeExtrudeProgram::mModulate_Vs_cg =
@@ -685,13 +679,10 @@
             "(\n"
             "in float4 inPos : POSITION,\n"
             "out float4 pos : POSITION,\n"
-            "out float2 uv0 : TEXCOORD0,\n"
             "uniform float4x4 worldViewProj\n"
             ")\n"
             "{\n"
             "   pos = mul(worldViewProj, inPos);\n"
-            "   inPos.xy = sign(inPos.xy);\n"
-            "   uv0 = (float2(inPos.x, -inPos.y) + 1.0f) * 0.5f;\n"
             "}";

@@ -702,24 +693,18 @@
                                     "precision lowp samplerCube;\n";

     String ShadowVolumeExtrudeProgram::mModulate_Fs_glsl =
-        "uniform sampler2D RT;\n"
         "uniform vec4 shadowColor;\n"
-        "varying vec2 uv0;\n"
         "\n"
         "void main() {\n"
-        "    gl_FragColor = vec4(shadowColor.xyz, texture2D(RT, uv0).w);\n"
+        "    gl_FragColor = shadowColor;\n"
         "}";

     String ShadowVolumeExtrudeProgram::mModulate_Vs_glsl =
         "uniform mat4 worldViewProj; \n"
         "attribute vec4 inPos; \n"
-        "varying vec2 uv0; \n"
         "\n"
         "void main() {\n"
         "    gl_Position = worldViewProj*inPos; \n"
-        "    uv0.x = inPos.x < 0.0 ? -1.0 :  1.0;\n"
-        "    uv0.y = inPos.y < 0.0 ?  1.0 : -1.0;\n"
-        "    uv0 = (uv0 + 1.0) * 0.5; \n"
         "}";


INTEGRATION: CWS rowlimit (1.8.324); FILE MERGED 2004/03/17 12:24:59 er 1.8.324.3: #i1967# type correctness (ScMatrix parameters are SCSIZE now) 2004/03/15 17:24:10 er 1.8.324.2: RESYNC: (1.8-1.9); FILE MERGED 2004/01/19 19:09:23 jmarmion 1.8.324.1: #i1967# SCCOL,SCROW,SCTAB replace USHORT; SCsCOL,SCsROW,SCsTAB replace short.

--- sc/source/filter/xml/XMLExportDDELinks.cxx
+++ sc/source/filter/xml/XMLExportDDELinks.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: XMLExportDDELinks.cxx,v $
  *
- *  $Revision: 1.9 $
- *
- *  last change: $Author: hr $ $Date: 2004-03-08 11:53:09 $
+ *  $Revision: 1.10 $
+ *
+ *  last change: $Author: obo $ $Date: 2004-06-04 11:09:20 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -162,10 +162,11 @@
         pMatrix = rExport.GetDocument()->GetDdeLinkResultMatrix( static_cast<USHORT>(nPos) );
     if (pMatrix)
     {
-        USHORT nuCol, nuRow;
+        SCSIZE nuCol;
+        SCSIZE nuRow;
         pMatrix->GetDimensions( nuCol, nuRow );
-        sal_Int32 nRowCount = nuRow;
-        sal_Int32 nColCount = nuCol;
+        sal_Int32 nRowCount = static_cast<sal_Int32>(nuRow);
+        sal_Int32 nColCount = static_cast<sal_Int32>(nuCol);
         SvXMLElementExport aTableElem(rExport, XML_NAMESPACE_TABLE, XML_TABLE, sal_True, sal_True);
         rtl::OUStringBuffer sBuffer;
         if (nColCount > 1)
@@ -187,7 +188,7 @@
             for(sal_Int32 nColumn = 0; nColumn < nColCount; nColumn++)
             {
                 BOOL bIsString = FALSE;
-                const MatValue* pMatVal = pMatrix->Get( static_cast<USHORT>(nColumn), static_cast<USHORT>(nRow), bIsString );
+                const MatValue* pMatVal = pMatrix->Get( static_cast<SCSIZE>(nColumn), static_cast<SCSIZE>(nRow), bIsString );

                 if (nColumn == 0)
                 {


INTEGRATION: CWS changefileheader (1.5.700); FILE MERGED 2008/04/01 12:36:30 thb 1.5.700.2: #i85898# Stripping all external header guards 2008/03/31 17:14:55 rt 1.5.700.1: #i87441# Change license header to LPGL v3.

--- sc/source/filter/xml/XMLExportDDELinks.hxx
+++ sc/source/filter/xml/XMLExportDDELinks.hxx
@@ -1,44 +1,37 @@
 /*************************************************************************
  *
- *  OpenOffice.org - a multi-platform office productivity suite
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- *  $RCSfile: XMLExportDDELinks.hxx,v $
+ * Copyright 2008 by Sun Microsystems, Inc.
  *
- *  $Revision: 1.5 $
+ * OpenOffice.org - a multi-platform office productivity suite
  *
- *  last change: $Author: rt $ $Date: 2005-09-08 19:53:56 $
+ * $RCSfile: XMLExportDDELinks.hxx,v $
+ * $Revision: 1.6 $
  *
- *  The Contents of this file are made available subject to
- *  the terms of GNU Lesser General Public License Version 2.1.
+ * This file is part of OpenOffice.org.
  *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
  *
- *    GNU Lesser General Public License Version 2.1
- *    =============================================
- *    Copyright 2005 by Sun Microsystems, Inc.
- *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
  *
- *    This library is free software; you can redistribute it and/or
- *    modify it under the terms of the GNU Lesser General Public
- *    License version 2.1, as published by the Free Software Foundation.
- *
- *    This library is distributed in the hope that it will be useful,
- *    but WITHOUT ANY WARRANTY; without even the implied warranty of
- *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *    Lesser General Public License for more details.
- *
- *    You should have received a copy of the GNU Lesser General Public
- *    License along with this library; if not, write to the Free Software
- *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- *    MA  02111-1307  USA
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
  *
  ************************************************************************/

 #ifndef _SC_XMLEXPORTDDELINKS_HXX
 #define _SC_XMLEXPORTDDELINKS_HXX

-#ifndef _COM_SUN_STAR_SHEET_XSPREADSHEETDOCUMENT_HPP_
 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#endif

 class String;
 class ScXMLExport;


Added: 'D3D11' predefined macro for HLSL programs in Direct3D11.

--HG--
branch : v1-9

--- RenderSystems/Direct3D11/src/OgreD3D11HLSLProgram.cpp
+++ RenderSystems/Direct3D11/src/OgreD3D11HLSLProgram.cpp
@@ -148,72 +148,76 @@

         defines.clear();

-        if (stringBuffer.empty())
-            return;
-
-        // Split preprocessor defines and build up macro array
-        D3D_SHADER_MACRO macro;
-        String::size_type pos = 0;
-        while (pos != String::npos)
-        {
-            macro.Name = &stringBuffer[pos];
-            macro.Definition = 0;
-
-            String::size_type start_pos=pos;
-
-            // Find delims
-            pos = stringBuffer.find_first_of(";,=", pos);
-
-            if(start_pos==pos)
-            {
-                if(pos==stringBuffer.length())
-                {
-                    break;
-                }
-                pos++;
-                continue;
-            }
-
-            if (pos != String::npos)
-            {
-                // Check definition part
-                if (stringBuffer[pos] == '=')
-                {
-                    // Setup null character for macro name
-                    stringBuffer[pos++] = '\0';
-                    macro.Definition = &stringBuffer[pos];
-                    pos = stringBuffer.find_first_of(";,", pos);
-                }
-                else
-                {
-                    // No definition part, define as "1"
-                    macro.Definition = "1";
-                }
-
-                if (pos != String::npos)
-                {
-                    // Setup null character for macro name or definition
-                    stringBuffer[pos++] = '\0';
-                }
-            }
-            else
-            {
-                macro.Definition = "1";
-            }
-            if(strlen(macro.Name)>0)
-            {
-                defines.push_back(macro);
-            }
-            else
-            {
-                break;
-            }
-        }
-
-        // Add NULL terminator
-        macro.Name = 0;
-        macro.Definition = 0;
-        defines.push_back(macro);
+        if (!stringBuffer.empty())
+		{
+			// Split preprocessor defines and build up macro array
+			D3D_SHADER_MACRO macro;
+			String::size_type pos = 0;
+			while (pos != String::npos)
+			{
+				macro.Name = &stringBuffer[pos];
+				macro.Definition = 0;
+
+				String::size_type start_pos=pos;
+
+				// Find delims
+				pos = stringBuffer.find_first_of(";,=", pos);
+
+				if(start_pos==pos)
+				{
+					if(pos==stringBuffer.length())
+					{
+						break;
+					}
+					pos++;
+					continue;
+				}
+
+				if (pos != String::npos)
+				{
+					// Check definition part
+					if (stringBuffer[pos] == '=')
+					{
+						// Setup null character for macro name
+						stringBuffer[pos++] = '\0';
+						macro.Definition = &stringBuffer[pos];
+						pos = stringBuffer.find_first_of(";,", pos);
+					}
+					else
+					{
+						// No definition part, define as "1"
+						macro.Definition = "1";
+					}
+
+					if (pos != String::npos)
+					{
+						// Setup null character for macro name or definition
+						stringBuffer[pos++] = '\0';
+					}
+				}
+				else
+				{
+					macro.Definition = "1";
+				}
+				if(strlen(macro.Name)>0)
+				{
+					defines.push_back(macro);
+				}
+				else
+				{
+					break;
+				}
+			}
+		}
+
+		//Add D3D11 define to all program, compiled with D3D11 RenderSystem
+		D3D_SHADER_MACRO macro = {"D3D11","1"};
+		defines.push_back(macro);
+
+		// Add NULL terminator
+		macro.Name = 0;
+		macro.Definition = 0;
+		defines.push_back(macro);
     }
     //-----------------------------------------------------------------------
     void D3D11HLSLProgram::loadFromSource(void)
@@ -1512,7 +1516,25 @@
     //-----------------------------------------------------------------------
     void D3D11HLSLProgram::setTarget(const String& target)
     {
-        mTarget = target;
+        mTarget = "";
+        vector<String>::type profiles = StringUtil::split(target, " ");
+        for(int i = 0 ; i < profiles.size() ; i++)
+        {
+            String & currentProfile = profiles[i];
+            if(GpuProgramManager::getSingleton().isSyntaxSupported(currentProfile))
+            {
+                mTarget = currentProfile;
+                break;
+            }
+        }
+
+        if(mTarget == "")
+        {
+            LogManager::getSingleton().logMessage(
+                "Invalid target for D3D11 shader '" + mName + "' - '" + target + "'");
+        }
+
+
     }
     //-----------------------------------------------------------------------
     const String& D3D11HLSLProgram::getCompatibleTarget(void) const


[D3D11] Fix for access violation - errors variable is filled only if compilation failed, and is NULL otherwise.

--HG--
branch : v1-9

--- RenderSystems/Direct3D11/src/OgreD3D11HLSLProgram.cpp
+++ RenderSystems/Direct3D11/src/OgreD3D11HLSLProgram.cpp
@@ -495,11 +495,11 @@
         if (FAILED(hr))
         {
             mErrorsInCompile = true;
-            String message = "Cannot assemble D3D11 high-level shader " + mName + " Errors:\n" +
-                static_cast<const char*>(errors->GetBufferPointer());
-            errors->Release();
+            String message = "Cannot compile D3D11 high-level shader " + mName + " Errors:\n" +
+                static_cast<const char*>(errors ? errors->GetBufferPointer() : "<null>");
+            SAFE_RELEASE(errors);
 			OGRE_EXCEPT_EX(Exception::ERR_RENDERINGAPI_ERROR, hr, message,
-                "D3D11HLSLProgram::loadFromSource");
+                "D3D11HLSLProgram::compileMicrocode");
         }
         else
         {
@@ -516,10 +516,9 @@

             if (FAILED(hr))
             {
-                String message = "Cannot reflect D3D11 high-level shader " + mName + " Errors:\n" +
-                    static_cast<const char*>(errors->GetBufferPointer());
+                String message = "Cannot reflect D3D11 high-level shader " + mName;
 				OGRE_EXCEPT_EX(Exception::ERR_RENDERINGAPI_ERROR, hr, message,
-                    "D3D11HLSLProgram::loadFromSource");
+                    "D3D11HLSLProgram::compileMicrocode");
             }

             D3D11_SHADER_DESC shaderDesc;
@@ -527,10 +526,9 @@

             if (FAILED(hr))
             {
-                String message = "Cannot get reflect info for D3D11 high-level shader " + mName + " Errors:\n" +
-                    static_cast<const char*>(errors->GetBufferPointer());
+                String message = "Cannot get reflect info for D3D11 high-level shader " + mName;
 				OGRE_EXCEPT_EX(Exception::ERR_RENDERINGAPI_ERROR, hr, message,
-                    "D3D11HLSLProgram::loadFromSource");
+                    "D3D11HLSLProgram::compileMicrocode");
             }

             // get the input parameters
@@ -559,7 +557,7 @@
             {
                 OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR,
                     "Multi constant buffers are not supported for now.",
-                    "D3D11HLSLProgram::loadFromSource");
+                    "D3D11HLSLProgram::compileMicrocode");
             }*/

 			mConstantBufferNr = shaderDesc.ConstantBuffers;
@@ -576,10 +574,9 @@
 					hr = shaderReflectionConstantBuffer->GetDesc(&constantBufferDesc);
 					if (FAILED(hr))
 					{
-						String message = "Cannot reflect constant buffer of D3D11 high-level shader " + mName + " Errors:\n" +
-							static_cast<const char*>(errors->GetBufferPointer());
+						String message = "Cannot reflect constant buffer of D3D11 high-level shader " + mName;
 						OGRE_EXCEPT_EX(Exception::ERR_RENDERINGAPI_ERROR, hr, message,
-							"D3D11HLSLProgram::loadFromSource");
+							"D3D11HLSLProgram::compileMicrocode");
 					}

                     String * name = new String(constantBufferDesc.Name);
@@ -601,10 +598,9 @@
 						HRESULT hr = varRef->GetDesc(&curVar);
 						if (FAILED(hr))
 						{
-							String message = "Cannot reflect constant buffer variable of D3D11 high-level shader " + mName + " Errors:\n" +
-								static_cast<const char*>(errors->GetBufferPointer());
+							String message = "Cannot reflect constant buffer variable of D3D11 high-level shader " + mName;
 							OGRE_EXCEPT_EX(Exception::ERR_RENDERINGAPI_ERROR, hr, message,
-								"D3D11HLSLProgram::loadFromSource");
+								"D3D11HLSLProgram::compileMicrocode");
 						}

 						String * name = new String(curVar.Name);


First viable release version with user control

--- Resistor/main.cpp
+++ Resistor/main.cpp
@@ -11,12 +11,14 @@

 #include <Windows.h>
 #include <iostream>
-#include <fstream>
 #include <string>
 #include <sstream>
 #include <exception>
 #include <bitset>
 #include <stdlib.h>
+#include <fstream>
+#include <chrono>
+#include <ctime>

 // Bitwise operations for extracting data from return stream
 #define S1(k,n) ((k) & ((1<<(n))-1))
@@ -26,19 +28,30 @@
 HANDLE Resipod;
 DCB ResipodParam = { 0 };

-// Not C++ recommended to make this global, but I am lazy
-// and don't want to figure out how to return a byte array
-byte receive[] = { 0x0,0x0,0x0 };
-
-void GetResistance() {
+// Get timer ready
+HANDLE timer = NULL;
+LARGE_INTEGER timerValue;
+
+double GetResistance() {
 	byte command[] = { 0xC1,0xD2,0x21 };
+	byte receive[] = { 0x0, 0x0, 0x0 };
 	DWORD bytesWrite = 0;
 	DWORD bytesRead = 0;
 	WriteFile(Resipod, command, 3, &bytesWrite, NULL);
 	ReadFile(Resipod, receive, 3, &bytesRead, NULL);
 	if (receive[0] != 0x02) {
-		std::cout << "Received value does not contain correct start byte. Non-fatal error.\n";
-	}
+		return(-1.0);
+	}
+
+	unsigned output1 = (receive[2] << 8) | (receive[1]);
+	int reading = F10(output1, 0, 11);
+	double resistance = reading;
+	bool divide10 = F10(output1, 11, 12);
+	if (divide10) {
+		resistance = reading / 10.0;
+	}
+
+	return(resistance);
 }

 int InitializePort() {
@@ -119,12 +132,138 @@
 	std::cout << "  | $$  \\ $$| $$       /$$  \\ $$  | $$   /$$  \\ $$   | $$  | $$  | $$| $$  \\ $$\n";
 	std::cout << "  | $$  | $$| $$$$$$$$|  $$$$$$/ /$$$$$$|  $$$$$$/   | $$  |  $$$$$$/| $$  | $$\n";
 	std::cout << "  |__/  |__/|________/ \\______/ |______/ \\______/    |__/   \\______/ |__/  |__/\n";
-	std::cout << "\n\n    Current code is in testing phase. Do NOT use for research purposes...\n\n";
+	//std::cout << "\n\n    Current code is in testing phase. Do NOT use for research purposes...\n\n";
+}
+
+void DisplayMainMenu(){
+	std::cout << "##################################################################################\n";
+	std::cout << "#                                    Main Menu                                   #\n";
+	std::cout << "#     1) Take single immediate reading                                           #\n";
+	std::cout << "#     2) Take multiple evenly spaced readings for defined length of time (NO!)   #\n";
+	std::cout << "#     3) Take multiple evenly spaced readings for undefined length of time       #\n";
+	std::cout << "#     4) Exit                                                                    #\n";
+	std::cout << "#                                                                                #\n";
+	std::cout << "##################################################################################\n";
+}
+
+void UndefinedLengthTest(){
+	system("cls");
+	std::ofstream dataFile;
+	std::string operatorName, projectName, specimenID, fileName;
+	int lengthType, intervalType;
+	double lengthTest, intervalTest;
+	char dum;
+	std::cout << "DEFINED LENGTH TEST SETUP\n";
+	std::cout << "Data file will be stored in same directory as this executable.\nYou may add any extension to it.\nDate and time are automatically pulled from this computer and added to data file.\n";
+	std::cout << "Filename: ";
+	std::cin >> fileName;
+
+	dataFile.open(fileName, std::ios::out);
+
+	std::cout << "Operator Name: ";
+	std::cin >> operatorName;
+	dataFile << operatorName << std::endl;
+
+	std::cout << "\nProject Name: ";
+	std::cin >> projectName;
+	dataFile << projectName << std::endl;
+
+	std::cout << "\nSpecimen Name/ID: ";
+	std::cin >> specimenID;
+	dataFile << specimenID << std::endl;
+
+	std::time_t curTime = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
+	dataFile << curTime << std::endl;
+	dataFile << "Time (min), Resistance (kOhms)" << std::endl;
+
+	// Future work for defined length test function
+	/*std::cout << "\nWould you like to enter the length of testing in\n1) minutes\n2) hours\n3) days\n4) weeks\nChoice: ";
+	std::cin >> lengthType;
+	std::cout << "\nHow long should the test run ";
+	switch (lengthType){
+	case 1:
+		std::cout << "(minutes): ";
+		std::cin >> lengthTest;
+		break;
+	case 2:
+		std::cout << "(hours): ";
+		std::cin >> lengthTest;
+		break;
+	case 3:
+		std::cout << "(days): ";
+		std::cin >> lengthTest;
+		break;
+	case 4:
+		std::cout << "(weeks): ";
+		std::cin >> lengthTest;
+		break;
+	default:
+		std::cout << "(INVALID CHOICE, RETURN TO MAIN MENU): ";
+		std::cin >> lengthTest;
+		return;
+		break;
+	}*/
+	std::cout << "\nWould you like to enter the interval of sampling in\n1) hertz\n2) minutes\nChoice: ";
+	std::cin >> intervalType;
+	switch (intervalType){
+	case 1:
+		std::cout << "\nEnter sampling interval (Hz): ";
+		std::cin >> intervalTest;
+		intervalTest = 1.0 / intervalTest;
+		break;
+	case 2:
+		std::cout << "\nEnter sampling interval (minutes): ";
+		std::cin >> intervalTest;
+		intervalTest = intervalTest * 60.0;
+		break;
+	default:
+		std::cout << "\nINVALID CHOICE, RETURN TO MAIN MENU";
+		std::cin >> intervalTest;
+		return;
+		break;
+	}
+
+	// Get timer value ready. Value is in 100 nanosecond intervals
+	timerValue.QuadPart = intervalTest*1E7;
+
+	std::cout << "\nPress any key to start test...";
+	std::cin >> dum;
+
+	bool stopRecording = false;
+	int count = 0;
+	timer = CreateWaitableTimer(NULL, TRUE, NULL);
+	double tempResistance, tempTime;
+
+	while (stopRecording == false){
+		SetWaitableTimer(timer, &timerValue, 0, NULL, NULL, 0);
+		tempResistance = GetResistance();
+		tempTime = (double)(count*intervalTest) / 60;
+		dataFile << tempTime << ", ";
+		dataFile << tempResistance << std::endl;
+		system("cls");
+		std::cout << "CURRENT TEST STATUS\n";
+		std::cout << tempTime << " minutes into testing.\n";
+		std::cout << count + 1 << " data points saved so far.\n";
+		std::cout << tempResistance << " kOhms (most current data point).\n\n";
+		std::cout << "Hit (ESC) key to stop data recording. Program will stop after next data point is collected...";
+
+		// Duct tape way to get a decent timer function
+		if (WaitForSingleObject(timer, INFINITE) != WAIT_OBJECT_0)
+			dataFile << "Timer function failed due to error code " << GetLastError();
+		else{
+			if (GetAsyncKeyState(VK_ESCAPE)){
+				stopRecording = true;
+			}
+		}
+
+	}
+
 }

 int main() {
 	char TestInterface;
 	char dummy;
+	int choice;
 	DisplayHeader();
 	std::cout << "Initializing serial port interface...";
 	int PortOpen = InitializePort();
@@ -137,39 +276,46 @@
 	else {
 		std::cout << "success!\n\n";
 		std::cout << "Resipod device is on COM" << PortOpen << "\n";
-	}
-	std::cout << "Current test program will obtain three readings at an interval of 3 seconds.\n";
-	std::cout << "Press any key when ready to test interface...";
-	std::cin >> TestInterface;
-
-	for (int i = 1; i < 4; i++) {
-		std::cout << "\n\n\nStarting measurement #" << i << "...\n\n";
-		GetResistance();
-		std::cout << "  Checking first byte received\n";
-		std::cout << "--------------------------------\n";
-		std::cout << std::bitset<8>(0x02) << "  - expected from device\n";
-		std::cout << std::bitset<8>(receive[0]) << "  - received from device\n";
-		std::cout << "--------------------------------\n";
-		if (receive[0] = 0x02) {
-			std::cout << "Bytes match, next values should be correct.\n";
-		}
-		else {
-			std::cout << "Bytes do not match! Next values unlikely to be correct!\n";
-		}
-		unsigned output1 = (receive[2] << 8) | (receive[1]);
-		std::cout << std::bitset<16>(output1) << "\n";
-		int reading = F10(output1, 0, 11);
-		double resistance = reading;
-		bool divide10 = F10(output1, 11, 12);
-		if (divide10) {
-			resistance = reading / 10.0;
-		}
-
-		std::cout << "Decimal number: " << reading << "\n";
-		std::cout << "Binary number: " << std::bitset<16>(reading) << "\n";
-		std::cout << "Resistance: " << resistance << " ohms\n\n\n";
-		std::cin >> reading;
-	}
-
-
+		std::cout << "Press any key to continue...";
+		std::cin >> dummy;
+	}
+
+	do{
+		system("cls");
+		DisplayHeader();
+		DisplayMainMenu();
+		char dum;
+		std::cout << "\n\n\nEnter choice: ";
+		std::cin >> choice;
+		switch (choice){
+		case 1:
+			double resistance;
+			std::cout << "\n\nMeasuring resistance...";
+			resistance = GetResistance();
+			if (resistance > 0){
+				std::cout << "success!\n\nResistance measured: " << resistance << " kOhms\n";
+				std::cout << "Press any key to return to main menu...";
+				std::cin >> dum;
+			}
+			else{
+				std::cout << "failure!\n\nReturn byte incorrect. Try again or check serial parameters...\n";
+				std::cout << "Press any key to return to main menu...";
+				std::cin >> dum;
+			}
+			break;
+		case 2:
+			//DefinedLengthTest();
+
+			std::cout << "\nNOT PROGRAMMED YET, RETURNING TO MAIN MENU! PRESS ANY KEY...";
+			std::cin >> dum;
+			break;
+		case 3:
+			UndefinedLengthTest();
+			break;
+		case 4:
+			break;
+		default:
+			break;
+		}
+	} while (choice != 4);
 }


CTelegramConnection: Add conditional auth secrets debug

--- TelegramQt/CTelegramConnection.cpp
+++ TelegramQt/CTelegramConnection.cpp
@@ -1905,7 +1905,6 @@
     }

     inputStream >> serverNonce;
-
     m_serverNonce = serverNonce;

     QByteArray pq;
@@ -1944,6 +1943,15 @@
         return false;
     }

+#ifdef TELEGRAMQT_DEBUG_REVEAL_SECRETS
+    qDebug() << Q_FUNC_INFO << "Client nonce:" << clientNonce.data;
+    qDebug() << Q_FUNC_INFO << "Server nonce:" << serverNonce;
+    qDebug() << Q_FUNC_INFO << "PQ:" << m_pq;
+    qDebug() << Q_FUNC_INFO << "P:" << m_p;
+    qDebug() << Q_FUNC_INFO << "Q:" << m_q;
+    qDebug() << Q_FUNC_INFO << "FingerPrints:" << fingersprints;
+#endif
+
     m_serverPublicFingersprint = fingersprints.at(0);

     if (m_rsaKey.fingersprint != m_serverPublicFingersprint) {
@@ -1957,6 +1965,10 @@
 void CTelegramConnection::requestDhParameters()
 {
     Utils::randomBytes(m_newNonce.data, m_newNonce.size());
+
+#ifdef TELEGRAMQT_DEBUG_REVEAL_SECRETS
+    qDebug() << Q_FUNC_INFO << "New nonce:" << m_newNonce;
+#endif

     QByteArray bigEndianNumber;
     bigEndianNumber.fill(char(0), 8);
@@ -2108,8 +2120,17 @@
     setDeltaTime(qint64(serverTime) - (QDateTime::currentMSecsSinceEpoch() / 1000));
     m_deltaTimeHeuristicState = DeltaTimeIsOk;

+    // #6 Client computes random 2048-bit number b (using a sufficient amount of entropy) and sends the server a message
     m_b.resize(256);
     Utils::randomBytes(&m_b);
+
+    // IMPORTANT: Apart from the conditions on the Diffie-Hellman prime dh_prime and generator g,
+    // both sides are to check that g, g_a and g_b are greater than 1 and less than dh_prime - 1.
+    // We recommend checking that g_a and g_b are between 2^{2048-64} and dh_prime - 2^{2048-64} as well.
+
+#ifdef TELEGRAMQT_DEBUG_REVEAL_SECRETS
+    qDebug() << "m_b" << m_b;
+#endif

     return true;
 }


use poll_one instead of poll

use poll_one instead of poll

--- NFComm/NFNetPlugin/NFCWS.cpp
+++ NFComm/NFNetPlugin/NFCWS.cpp
@@ -11,7 +11,7 @@

 bool NFCWS::Execute()
 {
-	m_EndPoint.poll();
+	m_EndPoint.poll_one();
 	return false;
 }

@@ -30,7 +30,7 @@
 bool NFCWS::Final()
 {
 	CloseSocketAll();
-	m_EndPoint.stop();
+	m_EndPoint.stop_listening();

 	return true;
 }


TelegramDispatcher: Refactored internalProcessMessageReceived()

--- TelegramQt/CTelegramDispatcher.cpp
+++ TelegramQt/CTelegramDispatcher.cpp
@@ -1894,22 +1894,12 @@
         apiMessage.fwdTimestamp = message.fwdDate;
     }

-    switch (message.toId.tlType) {
-    case TLValue::PeerChat:
-        apiMessage.setPeer(TelegramNamespace::Peer::fromChatId(message.toId.chatId));
-        break;
-    case TLValue::PeerUser:
-        if (messageFlags & TelegramNamespace::MessageFlagOut) {
-            apiMessage.setPeer(TelegramNamespace::Peer::fromUserId(message.toId.userId));
-        } else {
-            apiMessage.setPeer(TelegramNamespace::Peer::fromUserId(message.fromId));
-        }
-        break;
-    default:
+    const TelegramNamespace::Peer peer = peerToPublicPeer(message.toId);
+    if (!peer.isValid()) {
         qWarning() << Q_FUNC_INFO << "Unknown peer type!";
         return;
     }
-
+    apiMessage.setPeer(peer);
     apiMessage.fromId = message.fromId;
     apiMessage.type = messageType;
     apiMessage.text = message.message;


all: fix.

all: fix.

	* sdk-remote/src/uobjects/test/all.uob/all.cc: here.

--- sdk-remote/src/uobjects/test/all.uob/all.cc
+++ sdk-remote/src/uobjects/test/all.uob/all.cc
@@ -240,7 +240,7 @@
     size_t num = 0;
     for (size_t i = 0; i < size; ++i)
     {
-      if (size_t d = abs(b2[i] - b1[1]))
+      if (size_t d = abs(b2[i] - b1[i]))
       {
         ++num;
         enum { max_errors = 5 };


rtp: clarify.

rtp: clarify.

This still does not work properly on Mac OS X.  Trying to understand why.

	* sdk-remote/src/uobjects/urbi/rtp.uob/rtp.cc: Clarify and factor.

--- sdk-remote/src/uobjects/urbi/rtp.uob/rtp.cc
+++ sdk-remote/src/uobjects/urbi/rtp.uob/rtp.cc
@@ -298,7 +298,7 @@
 }

 void URTP::readFrom(const void* data, size_t size,
-               boost::shared_ptr<libport::UDPLink>)
+                    boost::shared_ptr<libport::UDPLink>)
 {
   onRead(data, size);
 }
@@ -390,17 +390,23 @@
       type = forceType;
   }
   std::string ld = localDeliver;
-  if (type == URBISCRIPT)
+
+  switch (type)
+  {
+  case URBISCRIPT:
     UObject::send(std::string((const char*)payload, payload_size));
-  else if (type == VALUES)
-  {// FIXME: this will not work with binaries
+    break;
+
+  case VALUES:
+  {
+    // FIXME: this will not work with binaries
     binaries_type bd;
     UMessage m(*(UClient*)0, 0, "",
-               std::string((const char*)payload, payload_size).c_str(),
+               std::string((const char*)payload, payload_size),
                bd);
     if (m.type != MESSAGE_DATA || m.value->type != DATA_LIST)
     {
-      GD_WARN("Unexpeected RTP message with payload type 'values'");
+      GD_WARN("Unexpected RTP message with payload type 'values'");
       return sz;
     }
     foreach(UValue* v, m.value->list->array)
@@ -443,8 +449,12 @@
         getDefaultClient()->notifyCallbacks(m);
       }
     }
-  }
-  else if (type == BINARY || type == RAW_BINARY || type == 26)
+    break;
+  }
+
+  case BINARY:
+  case RAW_BINARY:
+  case 26:
   {
     if (!writeTo && ld.empty())
       return sz;
@@ -452,40 +462,31 @@
     binaries_type bd;
     std::string keywords;
     if (type == BINARY)
-    { // Just onhor the included header.
+    {
+      // Just honor the included header.
       void* p = memchr(payload, '\n', payload_size);
-      char* start = (char*)p + 1;
-      size_t len = start - (char*)payload;
       if (!p)
       {
         GD_WARN("Parse error in binary message: no newline detected");
         return sz;
       }
+      char* start = (char*)p + 1;
+      size_t len = start - (char*)payload;
       bd.push_back(BinaryData(start, payload_size - len));
       keywords = string_cast(payload_size-len) + " "
         + std::string((const char*)payload, len+1);
     }
     else
-    { // Use forceheader, or session type (26=jpeg), otherwise, raw binary.
+    {
+      // Use forceheader, or session type (26=jpeg), otherwise, raw binary.
       std::string fh = forceHeader;
+      keywords = string_cast(payload_size);
       if (!fh.empty())
-      {
-        keywords = string_cast(payload_size) + " " + fh + "\n";
-        bd.push_back(BinaryData(payload, payload_size));
-      }
-      else
-      {
-        switch (type)
-        {
-        case 26:
-          keywords = string_cast(payload_size) + " jpeg\n";
-          bd.push_back(BinaryData(payload, payload_size));
-          break;
-        default:
-          keywords = string_cast(payload_size) + "\n";
-          bd.push_back(BinaryData(payload, payload_size));
-        }
-      }
+        keywords += " " + fh;
+      else if (type == 26)
+        keywords += " jpeg";
+      keywords += "\n";
+      bd.push_back(BinaryData(payload, payload_size));
     }
     binaries_type::const_iterator beg = bd.begin();
     b.parse(keywords.c_str(), 0, bd, beg, false);
@@ -501,14 +502,16 @@
     }
     if (!ld.empty())
     {
-      // We are in the io_service thread, deliver asynchronously
-      //FIXME: use the client of current context instead
+      // We are in the io_service thread, deliver asynchronously.
+      // FIXME: use the client of current context instead.
       GD_SINFO_DUMP("Transmitting " << b.getMessage() <<" " << b.common.size);
       transmitRemoteWrite(ld, b);
     }
     b.common.data = 0;
     if (res)
       freeb(res);
+  }
+  break;
   }
   return sz;
 }
@@ -521,6 +524,7 @@
   else
     send_(v);
 }
+
 void URTP::send_(const UValue& v)
 {
   bool sync = syncSendSocket;


avoid small compiler warning in contour module

--- TerrainSDK/vtlib/core/Contours.cpp
+++ TerrainSDK/vtlib/core/Contours.cpp
@@ -68,7 +68,7 @@
 			if (tiledGeom->m_elev_info.lodmap.m_min[i] > minLod)
 				minLod = tiledGeom->m_elev_info.lodmap.m_min[i];

-		tileLod0Size = pow(2.0, minLod);
+		tileLod0Size = 1 << minLod;
 		m_spacing = DPoint2(m_ext.Width() / (tiledGeom->cols * tileLod0Size), m_ext.Height() / (tiledGeom->rows *tileLod0Size));
 	}
 	else


'sat_id' : singleton observations were not handled properly,  causing corrupted output

--- sat_id.cpp
+++ sat_id.cpp
@@ -241,7 +241,10 @@

 /* Loads up MPC-formatted 80-column observations from a file.  Makes
 a pass to find out how many observations there are,  allocates space
-for them,  then reads them again to actually load the observations. */
+for them,  then reads them again to actually load the observations.
+Note that because single observations will get duplicated,  we actually
+double the size of the allocated array,  just in case every observation
+we read in is a singleton. */

 static OBSERVATION *get_observations_from_file( FILE *ifile, size_t *n_found,
          const double t_low, const double t_high)
@@ -281,7 +284,7 @@
                if( !strcmp( buff, "COM end ignore obs"))
                   break;
       if( !pass && count)
-         rval = (OBSERVATION *)calloc( count, sizeof( OBSERVATION));
+         rval = (OBSERVATION *)calloc( count * 2, sizeof( OBSERVATION));
       *n_found = count;
       }
    free_ades2mpc_context( ades_context);
@@ -384,6 +387,7 @@
                   const double speed_cutoff)
 {
    size_t i = 0, rval = 0;
+   OBSERVATION *tobs = (OBSERVATION *)calloc( n_obs * 2, sizeof( OBSERVATION));

    while( i < n_obs)
       {
@@ -394,8 +398,8 @@
          j++;
       if( j == 1)    /* singleton observation */
          {
-         obs[rval++] = *optr;
-         obs[rval++] = *optr;
+         tobs[rval++] = *optr;
+         tobs[rval++] = *optr;
          }
       else        /* two or more obs:  pick two best */
          {
@@ -428,12 +432,14 @@
          speed /= minutes_per_day;    /* ...then to deg/hour = arcmin/minute */
          if( speed > speed_cutoff)    /* omit slow objects */
             {
-            obs[rval++] = optr[best_b];
-            obs[rval++] = optr[best_a];
+            tobs[rval++] = optr[best_b];
+            tobs[rval++] = optr[best_a];
             }
          }
       i += j;
       }
+   memcpy( obs, tobs, rval * sizeof( OBSERVATION));
+   free( tobs);
    return( rval);
 }

@@ -490,6 +496,7 @@
 static bool got_obs_in_range( const OBSERVATION *obs, size_t n_obs,
                const double jd_start, const double jd_end)
 {
+   assert( n_obs > 0);
 // if( obs[0].jd < jd_end && obs[n_obs - 1].jd > jd_start)
       while( n_obs--)
          {
@@ -544,6 +551,8 @@
       tle_t tle;  /* Structure for two-line elements set for satellite */
       const double mins_per_day = 24. * 60.;

+      if( verbose > 3)
+         printf( "%s\n", line2);
       if( got_obs_in_range( obs, n_obs, tle_start, tle_start + tle_range)
                  && parse_elements( line1, line2, &tle) >= 0
                  && (tle.ephemeris_type == 'H'
@@ -693,6 +702,8 @@
                i--;
             memcpy( iname, tle_file_name, i);
             strcpy( iname + i, line2 + 10);
+            if( verbose > 1)
+               printf( "Including '%s'\n", iname);
             rval = add_tle_to_obs( obs, n_obs, iname, search_radius,
                                     max_revs_per_day);
             }


fix typo

fix typo


'sat_id' : the specified TLE (defaults to 'tle_list.txt') is looked for first as specified on the command line;  then in ~/.find_orb;  then in ~/.find_orb/tles;  and finally in ~/tles.

--- sat_id.cpp
+++ sat_id.cpp
@@ -76,6 +76,7 @@
 #include <time.h>
 #include <stdlib.h>
 #include <assert.h>
+#include <unistd.h>
 #if defined( _WIN32) || defined( __WATCOMC__)
    #include <malloc.h>     /* for alloca() prototype */
 #endif
@@ -794,7 +795,12 @@

 /* The "on-line version",  sat_id2,  gathers data from a CGI multipart form,
    puts it into a file,  possibly adds in some options,  puts together the
- command-line arguments,  and then calls sat_id_main.  See 'sat_id2.cpp'. */
+   command-line arguments,  and then calls sat_id_main.  See 'sat_id2.cpp'.
+
+   By default,  TLE information is drawn from 'tle_list.txt';  this can
+   be overridden with the -t (filename) option.  The specified file is first
+   searched for in the current directory,  then in ~/.find_orb,  then in
+   ~/.find_orb/tles,  then in ~/tles.    */

 #ifdef ON_LINE_VERSION
 int sat_id_main( const int argc, const char **argv)
@@ -803,6 +809,7 @@
 #endif
 {
    char tle_file_name[256];
+   const char *tname = "tle_list.txt";
    FILE *ifile;
    OBSERVATION *obs;
    object_t *objects;
@@ -829,20 +836,6 @@
       error_exit( -2);
       }

-#if !defined( _WIN32)
-   make_config_dir_name( tle_file_name, "tles/tle_list.txt");
-   ifile = fopen( tle_file_name, "rb");
-   if( ifile)
-      fclose( ifile);
-   else
-      {
-      strcpy( tle_file_name, getenv( "HOME"));
-      strcat( tle_file_name, "/tles/tle_list.txt");
-      }
-#else
-   strcpy( tle_file_name( "tle_list.txt"));
-#endif
-
    for( i = 1; i < argc; i++)
       if( argv[i][0] == '-')
          {
@@ -877,7 +870,7 @@
                show_computed_motion = true;
                break;
             case 't':
-               strcpy( tle_file_name, param);
+               tname = param;
                break;
             case 'u':
                show_summary = true;
@@ -900,6 +893,34 @@
    if( verbose)
       for( i = 0; i < argc; i++)
          printf( "Arg %d: '%s'\n", i, argv[i]);
+
+   strcpy( tle_file_name, tname);
+#if !defined( _WIN32)
+   if( access( tle_file_name, F_OK))
+      {
+      if( verbose)
+         fprintf( stderr, "'%s' failed\n", tle_file_name);
+      make_config_dir_name( tle_file_name, tname);
+      if( access( tle_file_name, F_OK))
+         {
+         char buff[256];
+
+         if( verbose)
+            fprintf( stderr, "'%s' failed\n", tle_file_name);
+         strcpy( buff, "tles/");
+         strcat( buff, tname);
+         make_config_dir_name( tle_file_name, buff);
+         if( access( tle_file_name, F_OK))
+            {
+            if( verbose)
+               fprintf( stderr, "'%s' failed\n", tle_file_name);
+            strcpy( tle_file_name, getenv( "HOME"));
+            strcat( tle_file_name, "/tles/");
+            strcat( tle_file_name, tname);
+            }
+         }
+      }
+#endif

    ifile = fopen( argv[1], "rb");
    if( !ifile)
@@ -946,7 +967,7 @@
    rval = add_tle_to_obs( objects, n_objects, tle_file_name, search_radius,
                                     max_revs_per_day);
    if( rval)
-      fprintf( stderr, "Couldn't open TLE file %s\n", tle_file_name);
+      fprintf( stderr, "Couldn't open TLE file %s\n", tname);
    else if( show_summary)
       for( i = 0; (size_t)i < n_objects; i++)
 //       if( objects[i].matches[0])


addapt configuration to run in muon_calo and uncalibrated data, add possibility to do analysis for EMCAL and/or PHOS and/or with combinations

--- PWGGA/CaloTrackCorrelations/macros/AddTaskPi0.C
+++ PWGGA/CaloTrackCorrelations/macros/AddTaskPi0.C
@@ -13,7 +13,7 @@
 /// Creates a CaloTrackCorr task, configures it and adds it to the analysis manager.
 ///
 /// The options that can be passed to the macro are:
-/// \param calorimeter : A string with he calorimeter used to measure the trigger particle
+/// \param calorimeter : A string with he calorimeter used to measure the trigger particle. Several combinations possible: "EMCAL", "PHOS","EMCAL_PHOS","EMCAL_PHOS_BothCalo". Last option enables combination of both calorimeters DCal and PHOS
 /// \param simulation : A bool identifying the data as simulation
 /// \param year: The year the data was taken, used to configure some histograms
 /// \param col: A string with the colliding system
@@ -35,10 +35,11 @@
 (
  TString  calorimeter   = "EMCAL",
  Bool_t   simulation    = kFALSE,
- Int_t    year          = 2011,
+ Int_t    year          = 2015,
  TString  col           = "pp",
  TString  trigger       = "EMC7",
- Int_t    rejectEMCTrig = 0,
+ Bool_t   rejectEMCTrig = kFALSE,
+ Bool_t   muonCaloPass  = kFALSE,
  TString  clustersArray = "",
  Bool_t   tender        = kFALSE,
  Bool_t   nonLinOn      = kFALSE,
@@ -94,17 +95,60 @@
   // General frame setting and configuration
   maker->SetReader   ( ConfigureReader   (col,simulation,clustersArray,tender,calorimeter,nonLinOn,trigger,rejectEMCTrig,minCen,maxCen,printSettings,debug) );
   maker->SetCaloUtils( ConfigureCaloUtils(col,simulation,clustersArray,tender,nonLinOn,year,                                           printSettings,debug) );
-
+
+  if(muonCaloPass)
+  {
+    maker->GetReader()->SwitchOffPrimaryVertexSelection();
+    maker->GetReader()->SwitchOffRejectNoTrackEvents();
+  }
+
+  // Remove as soon calibrations are available
+  if(year > 2014)
+  {
+    maker->GetReader()->SwitchOffUseEMCALTimeCut();
+    maker->GetReader()->SetEMCALTimeCut(-1000,1000);
+    maker->GetCaloUtils()->SwitchOffRunDepCorrection();
+  }
+
   // Analysis tasks setting and configuration
-  Int_t n = 0;//Analysis number, order is important
-
-  // Photon analysis
-  //
-  maker->AddAnalysis(ConfigurePhotonAnalysis(col, simulation, calorimeter, year, tm, shshMax, printSettings, debug), n++);
-
-  // Pi0 analysis
-  //
-  maker->AddAnalysis(ConfigurePi0Analysis   (col, simulation, calorimeter, year, tm, mixOn  , printSettings, debug), n++);
+  Int_t n = 0;//Analysis number, order is important
+
+  if(calorimeter.Contains("EMCAL"))
+  {
+    // Photon analysis
+    //
+    maker->AddAnalysis(ConfigurePhotonAnalysis(col, simulation, "EMCAL", year, tm, shshMax, printSettings, debug), n++);
+
+    // Pi0 analysis
+    //
+    printf("AliAnaPi0: EMCal-EMCal invariant mass\n");
+    maker->AddAnalysis(ConfigurePi0Analysis   (col, simulation, "EMCAL", kFALSE, year, tm, mixOn  , printSettings, debug), n++);
+  }
+
+  if(calorimeter.Contains("PHOS"))
+  {
+    // Photon analysis
+    //
+    maker->AddAnalysis(ConfigurePhotonAnalysis(col, simulation, "PHOS", year, tm, shshMax, printSettings, debug), n++);
+
+    // Pi0 analysis
+    //
+    printf("AliAnaPi0: PHOS-PHOS invariant mass\n");
+    maker->AddAnalysis(ConfigurePi0Analysis   (col, simulation, "PHOS", kFALSE, year, tm, mixOn  , printSettings, debug), n++);
+  }
+
+  if(calorimeter.Contains("BothCalo"))
+  {
+    // Pi0 analysis
+    //
+    //Do it with PHOS or EMCal in the main loop and EMCal or PHOS in the mixed event, should be equivalent?
+    printf("AliAnaPi0: DCal-PHOS invariant mass\n");
+    maker->AddAnalysis(ConfigurePi0Analysis   (col, simulation, "EMCAL", kTRUE, year, tm, mixOn, printSettings, debug), n++);
+    printf("AliAnaPi0: PHOS-DCal invariant mass\n");
+    maker->AddAnalysis(ConfigurePi0Analysis   (col, simulation, "PHOS" , kTRUE, year, tm, mixOn, printSettings, debug), n++);
+  }
+
+  // Maker

   maker->SetAnaDebug(debug)  ;

@@ -215,8 +259,9 @@
     reader->SetPtHardAndJetPtComparison(kTRUE);
     reader->SetPtHardAndJetPtFactor(4);

-    reader->SetPtHardAndClusterPtComparison(kTRUE);
-    reader->SetPtHardAndClusterPtFactor(1.5);
+    // Gamma-jet
+    //reader->SetPtHardAndClusterPtComparison(kTRUE);
+    //reader->SetPtHardAndClusterPtFactor(1.5);
   }

   //------------------------
@@ -250,7 +295,7 @@
   reader->SwitchOffUseTrackTimeCut();
   reader->SetTrackTimeCut(0,50);

-  reader->SwitchOnFiducialCut();
+  reader->SwitchOffFiducialCut();
   reader->GetFiducialCut()->SetSimpleCTSFiducialCut(0.8, 0, 360) ;

   reader->SwitchOffUseTrackDCACut();
@@ -316,13 +361,13 @@
   if(nonLinOn) reader->SwitchOnClusterELinearityCorrection();
   else         reader->SwitchOffClusterELinearityCorrection();

-  if(calorimeter == "EMCAL")
+  if(calorimeter.Contains("EMCAL"))
   {
     reader->SwitchOnEMCALCells();
     reader->SwitchOnEMCAL();
   }

-  if(calorimeter == "PHOS")
+  if(calorimeter.Contains("PHOS"))
   { // Should be on if QA is activated with correlation on
     reader->SwitchOnPHOSCells();
     reader->SwitchOnPHOS();
@@ -338,7 +383,8 @@
   reader->SwitchOffTriggerPatchMatching();
   reader->SwitchOffBadTriggerEventsRemoval();

-  if( rejectEMCTrig > 0 && !simulation && (trigger.Contains("EMC") || trigger.Contains("L")))
+
+  if( rejectEMCTrig && !simulation )
   {
     printf("=== Remove bad triggers === \n");
     reader->SwitchOnTriggerPatchMatching();
@@ -416,6 +462,12 @@
   else if(year >  2013) cu->SetNumberOfSuperModulesUsed(20);
   else                  cu->SetNumberOfSuperModulesUsed(10);

+  if(kAnaPi0.Contains("_PHOS_"))
+  {
+     if(year <= 2013) cu->SetNumberOfSuperModulesUsed(3);
+     else             cu->SetNumberOfSuperModulesUsed(4);
+  }
+
   printf("xxx Number of SM set to <%d> xxx\n",cu->GetNumberOfSuperModulesUsed());

   // Search of local maxima in cluster
@@ -453,7 +505,8 @@
     cu->SwitchOnRunDepCorrection();

     calibEner = kTRUE;
-    calibTime = kTRUE;
+    calibTime = kTRUE;
+    if (year > 2014) calibTime = kFALSE; // Remove as soon as calib available
   }

   if( simulation )
@@ -474,10 +527,10 @@
                           kTRUE,      // bad map
                           calibTime); // time calib

-  if( calibTime ) recou->SetExoticCellDiffTimeCut(50);
+  if( calibTime ) recou->SetExoticCellDiffTimeCut(200);

   if( nonLinOn )  cu->SwitchOnCorrectClusterLinearity();
-
+
   printf("ConfigureCaloUtils() - EMCAL Recalibration ON? %d %d\n",recou->IsRecalibrationOn(), cu->IsRecalibrationOn());
   printf("ConfigureCaloUtils() - EMCAL BadMap        ON? %d %d\n",recou->IsBadChannelsRemovalSwitchedOn(), cu->IsBadChannelsRemovalSwitchedOn());

@@ -511,23 +564,23 @@
   ana->SwitchOnFillShowerShapeHistograms();  // Filled before photon shower shape selection

  //if(!simulation) ana->SwitchOnFillPileUpHistograms();
-
+//
   if(tm) ana->SwitchOnTrackMatchRejection() ;
   else   ana->SwitchOffTrackMatchRejection() ;

-  ana->SwitchOnTMHistoFill() ;
+  ana->SwitchOffTMHistoFill() ;

   if(calorimeter == "PHOS")
   {
     ana->SetNCellCut(2);// At least 3 cells
-    ana->SetMinPt(0.3);
+    ana->SetMinPt(0.5);
     ana->SetMinDistanceToBadChannel(2, 4, 5);
     ana->SetTimeCut(-1e10,1e10); // open cut
   }
   else
   {//EMCAL
     ana->SetNCellCut(1);// At least 2 cells
-    ana->SetMinEnergy(0.3); // avoid mip peak at E = 260 MeV
+    ana->SetMinEnergy(0.5); // avoid mip peak at E = 260 MeV
     ana->SetMaxEnergy(100);
     ana->SetTimeCut(-1e10,1e10); // open cut, usual time window of [425-825] ns if time recalibration is off
     // restrict to less than 100 ns when time calibration is on
@@ -546,8 +599,11 @@
   // EMCAL

   //caloPID->SetEMCALLambda0CutMax(0.27);
-  caloPID->SetEMCALLambda0CutMax(shshMax);
-  caloPID->SetEMCALLambda0CutMin(0.10);
+  if(calorimeter=="EMCAL")
+  {
+    caloPID->SetEMCALLambda0CutMax(shshMax);
+    caloPID->SetEMCALLambda0CutMin(0.10);
+  }

   // Track matching
   caloPID->SetEMCALDEtaCut(0.025);
@@ -559,11 +615,11 @@
   //if(kInputData=="AOD") caloPID->SetPHOSRCut(2000.); // Open cut since dX, dZ not stored

   // Branch AOD settings
-  ana->SetOutputAODName(Form("Photon_%s",kAnaPi0.Data()));
+  ana->SetOutputAODName(Form("Photon_%s_%s",calorimeter.Data(), kAnaPi0.Data()));
   ana->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");

   //Set Histograms name tag, bins and ranges
-  ana->AddToHistogramsName(Form("AnaPhoton_TM%d_",tm));
+  ana->AddToHistogramsName(Form("AnaPhoton_%s_TM%d_",calorimeter.Data(),tm));

   SetAnalysisCommonParameters(ana,calorimeter,year,col,simulation,printSettings,debug) ; // see method below

@@ -581,7 +637,7 @@
 /// Configure the task doing the 2 cluster invariant mass analysis
 ///
 AliAnaPi0* ConfigurePi0Analysis(TString col,           Bool_t simulation,
-                                TString calorimeter,   Int_t year,
+                                TString calorimeter,   Bool_t bothCalo,   Int_t year,
                                 Int_t tm,              Bool_t mixOn,
                                 Bool_t  printSettings, Int_t   debug)
 {
@@ -590,8 +646,15 @@
   ana->SetDebug(debug);

   // Input delta AOD settings
-  ana->SetInputAODName(Form("Photon_%s",kAnaPi0.Data()));
-
+  ana->SetInputAODName(Form("Photon_%s_%s",calorimeter.Data(),kAnaPi0.Data()));
+
+  if(bothCalo)
+  {
+    ana->SwitchOnPairWithOtherDetector();
+    if ( calorimeter == "EMCAL" ) ana->SetOtherDetectorInputName(Form("Photon_PHOS_%s" ,kAnaPi0.Data()));
+    else                          ana->SetOtherDetectorInputName(Form("Photon_EMCAL_%s",kAnaPi0.Data()));
+  }
+
   // Calorimeter settings
   ana->SetCalorimeter(calorimeter);

@@ -600,7 +663,11 @@
   else      ana->SwitchOffOwnMix();

   // Cuts
-  if (calorimeter == "EMCAL" ) ana->SetPairTimeCut(200);
+  if (calorimeter == "EMCAL" )
+  {
+    if(year < 2014) ana->SetPairTimeCut(50);
+    else            ana->SetPairTimeCut(200); // REMEMBER to remove this when time calib is on
+  }

   ana->SetNPIDBits(1);
   ana->SetNAsymCuts(1); // no asymmetry cut, previous studies showed small effect.
@@ -613,7 +680,7 @@
     ana->SetNZvertBin(10);
     ana->SetNRPBin(1);
     ana->SetNMaxEvMix(100);
-    ana->SetMinPt(0.5);
+    ana->SetMinPt(0.5); // 0.5
   }
   else if(col == "PbPb")
   {
@@ -632,6 +699,12 @@
     ana->SetMinPt(0.5);
   }

+  // Angle cut, avoid pairs with too large angle
+  ana->SwitchOnAngleSelection();
+  ana->SetAngleMaxCut(TMath::DegToRad()*80.); // EMCal: 4 SM in phi, 2 full SMs in eta
+  ana->SetAngleCut(0.); // Minimum angle open
+
+  //if(!bothCalo) ana->SwitchOnSMCombinations();
   ana->SwitchOnSMCombinations();
   ana->SwitchOffMultipleCutAnalysis();
   ana->SwitchOffFillAngleHisto();
@@ -639,7 +712,8 @@

   // Set Histograms name tag, bins and ranges

-  ana->AddToHistogramsName(Form("AnaPi0_TM%d_",tm));
+  if(!bothCalo) ana->AddToHistogramsName(Form("AnaPi0_%s_TM%d_",calorimeter.Data(),tm));
+  else          ana->AddToHistogramsName(Form("AnaPi0_%sPlusOther_TM%d_",calorimeter.Data(),tm));

   SetAnalysisCommonParameters(ana,calorimeter,year,col,simulation,printSettings,debug) ; // see method below

@@ -707,8 +781,8 @@
   histoRanges->SetHistoAsymmetryRangeAndNBins(0., 1. , 100) ;

   // check if time calibration is on
-  //histoRanges->SetHistoTimeRangeAndNBins(-1000.,1000,1000);
-  histoRanges->SetHistoTimeRangeAndNBins(-400.,400,400);
+  histoRanges->SetHistoTimeRangeAndNBins(0.,1000,1000);
+  //histoRanges->SetHistoTimeRangeAndNBins(-400.,400,400);
   histoRanges->SetHistoDiffTimeRangeAndNBins(-200, 200, 800);

   // track-cluster residuals


One last printf-style call cleanup.

One last printf-style call cleanup.

git-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@140205 91177308-0d34-0410-b5e6-96231b3b80d8

--- source/Interpreter/ScriptInterpreterPython.cpp
+++ source/Interpreter/ScriptInterpreterPython.cpp
@@ -575,7 +575,7 @@
                 if (IS_VALID_LLDB_HOST_THREAD(embedded_interpreter_thread))
                 {
                     if (log)
-                        log->Printf ("ScriptInterpreterPython::InputReaderCallback, Activate, succeeded in creating thread (thread = %d)", embedded_interpreter_thread);
+                        log->Printf ("ScriptInterpreterPython::InputReaderCallback, Activate, succeeded in creating thread (thread_t = %p)", embedded_interpreter_thread);
                     Error detach_error;
                     Host::ThreadDetach (embedded_interpreter_thread, &detach_error);
                 }


(hopefully) fixed a bug in the minimizer: the minimizer now can't move atoms farther than maximal_shift_

--- source/MOLMEC/MINIMIZATION/conjugateGradient.C
+++ source/MOLMEC/MINIMIZATION/conjugateGradient.C
@@ -1,7 +1,7 @@
 // -*- Mode: C++; tab-width: 2; -*-
 // vi: set ts=2:
 //
-// $Id: conjugateGradient.C,v 1.13 2002/02/27 12:21:37 sturm Exp $
+// $Id: conjugateGradient.C,v 1.14 2003/01/31 15:33:37 anhi Exp $
 // Minimize the potential energy of a system using a nonlinear conjugate
 // gradient method with  line search

@@ -124,8 +124,13 @@
     // set the options  to their default values if not already set
     step_ = options.setDefaultReal
 			(Option::STEP_LENGTH, Default::STEP_LENGTH);
+
 		updateForces();
-		step_ *= current_grad_.norm;
+		// This is to avoid completely senseless behaviour
+		//if (current_grad_.norm < 1e6)
+		{
+			step_ *= current_grad_.norm;
+		}

     // determine the number of atoms
     number_of_atoms_ = (Size)force_field_->getAtoms().size();
@@ -458,11 +463,42 @@

 		// define an alias for the atom vector
 		AtomVector& atoms = const_cast<AtomVector&>(force_field_->getAtoms());
+
+//Log.info() << "CG: " << step_ << " " << lambda_ << " " << initial_energy_ << " " << current_grad_.norm << " " << direction_.norm << endl;

 		bool success = true;
 		while (success)
 		{
-			atoms.moveTo(direction_, step_);
+			// TEST! This is a workaround...
+			// We try to find those cases where at least one atom might be
+			// translated more than maximal_shift_
+			if (direction_.norm * step_ * lambda_ <= direction_.size() * maximal_shift_)
+			{
+				atoms.moveTo(direction_, lambda_ * step_);
+			}
+			else
+			{
+				Log.info() << "CG1: Adjusted!!!!!" << endl;
+				// find the maximal translation
+				Gradient::ConstIterator grad_it(direction_.begin());
+				double max=0;
+				double cur=0;
+				for (; grad_it != direction_.end(); ++grad_it)
+				{
+					cur = (*grad_it).getSquareLength();
+					if (cur >= max)
+					{
+						max = cur;
+					}
+				}
+
+				if (sqrt(max)*lambda_*step_ >= maximal_shift_)
+				{
+					step_ = maximal_shift_ / (sqrt(max) * lambda_);
+				}
+
+				atoms.moveTo(direction_, lambda_ * step_);
+			}
 			success = (updateEnergy() < initial_energy_);
 			if (success)
 			{
@@ -477,7 +513,7 @@
 				step_ *= 2.0;
 			}
 		}
-
+//	Log.info() << "CG2: new step " << step_ << endl;
 		// now we perform line searches along direction_
 		LineSearch line_search(*this);

@@ -630,9 +666,39 @@
 			// try to find a new solution
 			bool result = findStep();
 			// take the step and save these positions
-			atoms.moveTo(direction_, lambda_ * step_);
+
+			// TEST! This is a workaround...
+			// We try to find those cases where at least one atom might be
+			// translated more than maximal_shift_
+			if (direction_.norm * step_ * lambda_ <= direction_.size() * maximal_shift_)
+			{
+				atoms.moveTo(direction_, lambda_ * step_);
+			}
+			else
+			{
+				Log.info() << "CG1: Adjusted!!!!!" << endl;
+				// find the maximal translation
+				Gradient::ConstIterator grad_it(direction_.begin());
+				double max=0;
+				double cur=0;
+				for (; grad_it != direction_.end(); ++grad_it)
+				{
+					cur = (*grad_it).getSquareLength();
+					if (cur >= max)
+					{
+						max = cur;
+					}
+				}
+
+				if (sqrt(max)*lambda_*step_ >= maximal_shift_)
+				{
+					step_ = maximal_shift_ / (sqrt(max) * lambda_);
+				}
+
+				atoms.moveTo(direction_, lambda_ * step_);
+			}
+
 			atoms.savePositions();
-
 			// if findStep only found an emergency solution...
 			if (!result)
 			{


Minor adjustments + a bugfix in the strangeness analysis framework

--- PWGLF/STRANGENESS/Cascades/Run2/AliV0Result.cxx
+++ PWGLF/STRANGENESS/Cascades/Run2/AliV0Result.cxx
@@ -33,7 +33,9 @@
 {
     // Dummy Constructor - not to be used!
     //Main output histogram: Centrality, mass, transverse momentum
-    fHisto = new TH3F("fHisto","", 20,0,100, 200,0,20, 400,0,2);
+    //Warning: This has super-fine binning in all dimensions!
+    //It may be quite costly to use, memory-wise!
+    fHisto = new TH3F("fHisto","", 100,0,100, 200,0,20, 400,0,2);
     fHisto->Sumw2();
 }
 //________________________________________________________________
@@ -68,7 +70,9 @@
     if( lMassHypo == AliV0Result::kAntiLambda   ) lThisMass = 1.116;

     //Main output histogram: Centrality, mass, transverse momentum
-    fHisto = new TH3F(Form("fHisto_%s",GetName()),"", 20,0,100, 200,0,20, 400,lThisMass-0.1,lThisMass+0.1);
+    //Warning: This has super-fine binning in all dimensions!
+    //It may be quite costly to use, memory-wise!
+    fHisto = new TH3F(Form("fHisto_%s",GetName()),"", 100,0,100, 200,0,20, 400,lThisMass-lMassWindow,lThisMass+lMassWindow);
     fHisto->Sumw2();
 }
 //________________________________________________________________
@@ -107,7 +111,7 @@
     Double_t lMassDelta = (lMassWindow * 2.) / lNMassBins;
     Double_t lMassBins[lNMassBins+1];

-    for( Long_t ibound = 0; ibound<lNMassBins+1; ibound++) lMassBins[ibound] = (lThisMass-0.1) + ( ( (Double_t) ibound )*lMassDelta );
+    for( Long_t ibound = 0; ibound<lNMassBins+1; ibound++) lMassBins[ibound] = (lThisMass-lMassWindow) + ( ( (Double_t) ibound )*lMassDelta );

     //Main output histogram: Centrality, mass, transverse momentum
     fHisto = new TH3F(Form("fHisto_%s",GetName()),"", lNCentBins, lCentBins, lNPtBins, lPtBins, lNMassBins, lMassBins );


Need to copy all the fields in Computed_field_image::copy. ASSIGNED - bug 1073: Texture formatted read and write API  https://tracker.physiomeproject.org/show_bug.cgi?id=1073

--- source/computed_field/computed_field_image.cpp
+++ source/computed_field/computed_field_image.cpp
@@ -177,6 +177,9 @@
 	if (new_parent)
 	{
 		core = new Computed_field_image(new_parent);
+		core->set_texture(texture);
+		core->set_native_texture_flag(native_texture);
+		core->set_output_range(minimum, maximum);
 	}
 	else
 	{


Add code to run the test framework

Add code to run the test framework

--- interval_tree_test.cpp
+++ interval_tree_test.cpp
@@ -5,6 +5,8 @@
 #include <time.h>
 #include <assert.h>
 #include "IntervalTree.h"
+#define CATCH_CONFIG_RUNNER // Mark this as file as the test-runner for catch
+#include "catch.hpp"        // Include the catch unit test framework

 using namespace std;

@@ -25,7 +27,7 @@
     return Interval<T,K>(start, stop, value);
 }

-int main() {
+int main(int argc, char**argv) {
     typedef vector<std::size_t> countsVector;

     // a simple sanity check
@@ -94,6 +96,6 @@
         assert(*b == *t);
     }

-    return 0;
+    return Catch::Session().run( argc, argv );
 }


Cleanup.

Cleanup.

--- interval_tree_test.cpp
+++ interval_tree_test.cpp
@@ -62,9 +62,7 @@
     cout << "brute force:\t" << ms.count() << "ms" << endl;

     // using the interval tree
-    //IntervalTree<bool> tree(intervals);
-    intervalTree tree;
-    tree = intervalTree(intervals);
+    intervalTree tree = intervalTree(intervals);
     countsVector treecounts;
     t0 = Clock::now();
     for (intervalVector::iterator q = queries.begin(); q != queries.end(); ++q) {


Run slightly fewer iterations

Run slightly fewer iterations

--- c++/test.cpp
+++ c++/test.cpp
@@ -163,7 +163,7 @@
 		else if (hex[0] == '\n') {
 			if (data.size()) {
 #ifdef BENCH
-				for (int i = 0; i < 1000; i++)
+				for (int i = 0; i < 300; i++)
 #endif
 					run_test(data);
 				fill_txv(data, allTxn, 0.9);
@@ -182,7 +182,7 @@
 	}

 #ifdef BENCH
-	for (int i = 0; i < 1000; i++)
+	for (int i = 0; i < 300; i++)
 #endif
 		test_compress_block(lastBlock, allTxn);
 	return 0;


mention on zip64 support.

mention on zip64 support.

git-svn-id: ecbadac9c76e8cf640a0bca86f6bd796c98521e3@39924 27541ba8-7e3a-0410-8455-c3a389f83636

--- io/io/src/TZIPFile.cxx
+++ io/io/src/TZIPFile.cxx
@@ -49,6 +49,8 @@
 // The fact that the archive has a global directory makes it efficient  //
 // and allows for only the reading of the desired data, one does not    //
 // have to scan through the whole file to find the desired sub-file.    //
+// The Zip64 extensions are supported so files larger than 2GB can be   //
+// stored in archives larger than 4 GB.                                 //
 //                                                                      //
 // Once the archive has been opened, the client can query the members   //
 // and read their contents by asking the archive for an offset where    //


Fixed bug in ::addCircle

Fixed bug in ::addCircle

git-svn-id: 6c2b1bd10c324c49ea9d9e6e31006a80e70507cb@392 5242fede-7e19-0410-aef8-94bd7d2200fb

--- source/operation/buffer/OffsetCurveBuilder.cpp
+++ source/operation/buffer/OffsetCurveBuilder.cpp
@@ -13,6 +13,9 @@
  *
  **********************************************************************
  * $Log$
+ * Revision 1.8  2004/05/19 13:40:49  strk
+ * Fixed bug in ::addCircle
+ *
  * Revision 1.7  2004/05/05 13:08:01  strk
  * Leaks fixed, explicit allocations/deallocations reduced.
  *
@@ -453,7 +456,9 @@
 */
 void OffsetCurveBuilder::addCircle(const Coordinate &p, double distance){
 	// add start point
-	addPt(p);
+	Coordinate pt(p);
+	pt.x+=distance;
+	addPt(pt);
 	addFillet(p, 0.0, 2.0*3.1415926535, -1, distance);
 }