Made the Delay class a template class for use with any copyable type. Renamed to Delay_ made typedef Delay for compatibility, might change in the future

--- HOPSAN++/HopsanCore/include/ComponentUtilities/Delay.hpp
+++ HOPSAN++/HopsanCore/include/ComponentUtilities/Delay.hpp
@@ -1,7 +1,7 @@
 /*-----------------------------------------------------------------------------
  This source file is part of Hopsan NG

- Copyright (c) 2011
+ Copyright (c) 2011
     Mikael Axin, Robert Braun, Alessandro Dell'Amico, Björn Eriksson,
     Peter Nordin, Karl Pettersson, Petter Krus, Ingo Staack

@@ -18,158 +18,158 @@
 //! @author Peter Nordin <peter.nordin@liu.se>
 //! @date   2010-12-01
 //!
-//! @brief Contains the Core Utility Delay Circle Buffer class
+//! @brief Contains the Component Utility Delay circle buffer class
 //!
 //$Id$

 #ifndef DELAY_HPP_INCLUDED
 #define DELAY_HPP_INCLUDED

-#include "win32dll.h"
 #include "assert.h"
 #include <cmath>
 #include <iostream>
-//#include <vector>

 namespace hopsan {

-    class DLLIMPORTEXPORT Delay
+template<typename T>
+class Delay_
+{
+public:
+    Delay_()
     {
-    public:
-        Delay()
+        mpArray = 0;
+    }
+
+    ~Delay_()
+    {
+        if (mpArray != 0)
         {
-            mpArray = 0;
+            delete mpArray;
+        }
+    }
+
+    //! @brief Initialize Delay size based on timeDelay at a given timestep
+    //! @param [in] timeDelay The total time delay for a value to come out on the other side of the circle buffer
+    //! @param [in] Ts The timestep between each call
+    //! @param [in] initValue The initial value of all buffer elements
+    void initialize(const double timeDelay, const double Ts, const T initValue)
+    {
+        //mFracStep = timeDelay/Ts;
+        //Calculate stepdelay, round double to int
+        //! @todo mayby need to behave differently if we want to use fractions, (rount to ceeling before), however we cant do that allways as we get one extra step every time
+        this->initialize( size_t(floor(timeDelay/Ts+0.5)), initValue);
+    }
+
+    //! @brief Initialize Delay size based on known number of delay steps
+    //! @param [in] delaySteps The number of delay steps
+    //! @param [in] initValue The initial value of all buffer elements
+    void initialize(const size_t delaySteps, const T initValue)
+    {
+        if (mpArray != 0)
+        {
+            delete  mpArray;
+        }
+        assert(delaySteps > 0);
+        mSize = delaySteps+1;
+
+        mpArray = new double[mSize];
+        std::cout << "DelayBuffer, size: " << delaySteps << ", mSize: " << mSize << std::endl;
+
+        //! @todo maybe use c++ vector to init, or some smarter init, does not really matter I think
+        for (size_t i=0; i<mSize; ++i)
+        {
+            mpArray[i] = initValue;
         }

-        ~Delay()
+        newest = 0;
+        oldest = 1;
+    }
+
+    //! @brief updates delay with a new value
+    //! @param [in] newValue The new value to insert into delay buffer
+    //! @return The odlest value of the delay buffer (After update this value will have been overwriten in the buffer)
+    T update(const T newValue)
+    {
+        // First get the oldes value
+        T oldestValue = mpArray[oldest];
+
+        // Increment the pointers, newets will after incrementaion overwrite previous oldest
+        ++newest;
+        ++oldest;
+
+        if (oldest >= mSize)
         {
-            if (mpArray != 0)
-            {
-                delete mpArray;
-            }
+            oldest = 0;
+        }
+        if (newest >= mSize)
+        {
+            newest = 0;
         }

-        //! @brief Initialize Delay size based on timeDelay at a given timestep
-        //! @param [in] timeDelay The total time delay for a value to come out on the other side of the circle buffer
-        //! @param [in] Ts The timestep between each call
-        //! @param [in] initValue The initial value of all buffer elements
-        void initialize(const double timeDelay, const double Ts, const double initValue)
+        // Overwrite previous oldest with the new_value
+        mpArray[newest] = newValue;
+
+        return oldestValue;
+    }
+
+    //! @brief Get the oldest value inte the buffer
+    //! @return The oldest value in the buffer
+    T getOldest()
+    {
+        return mpArray[oldest];
+    }
+
+    //! @brief Get the newest value inte the buffer
+    //! @return The newest value in the buffer
+    T getNewest()
+    {
+        return mpArray[newest];
+    }
+
+    //! @brief Returns a specific value, 0=newest, 1=nextnewest, 2=nextnextnewest and so on, no range check is performed
+    //! @param [in] i Index of value to return
+    //! @return Value of specified index
+    T getIdx(const size_t i)
+    {
+        if ( (int(newest)-int(i)) < 0 )
         {
-            //mFracStep = timeDelay/Ts;
-            //Calculate stepdelay, round double to int
-            //! @todo mayby need to behave differently if we want to use fractions, (rount to ceeling before), however we cant do that allways as we get one extra step every time
-            this->initialize( size_t(floor(timeDelay/Ts+0.5)), initValue);
+            return mpArray[mSize+newest-i];
         }
+        else
+        {
+            return mpArray[newest-i];
+        }
+    }

-        //! @brief Initialize Delay size based on known number of delay steps
-        //! @param [in] delaySteps The number of delay steps
-        //! @param [in] initValue The initial value of all buffer elements
-        void initialize(const size_t delaySteps, const double initValue)
+    //! @brief Returns a specific value, 0=oldest, 1=nextoldest, 2=nextnextoldest and so on, no range check is performed
+    //! @param [in] i Index of value to return
+    //! @return Value of specified index
+    T getOldIdx(const size_t i)
+    {
+        if (oldest+i >= mSize)
         {
-            if (mpArray != 0)
-            {
-                delete  mpArray;
-            }
-            assert(delaySteps > 0);
-            mSize = delaySteps+1;
+            return mpArray[oldest+i-mSize];
+        }
+        else
+        {
+            return mpArray[oldest+i];
+        }
+    }

-            mpArray = new double[mSize];
-            std::cout << "DelayBuffer, size: " << delaySteps << ", mSize: " << mSize << ", init_value: " << initValue << std::endl;
+    //! @brief Get the size of the ring buffer (the number of elements)
+    //! @return The size of the buffer (the number of elements)
+    size_t getSize() const
+    {
+        return mSize-1;
+    }

-            //! @todo maybe use c++ vector to init, or some smarter init, does not really matter I think
-            for (size_t i=0; i<mSize; ++i)
-            {
-                mpArray[i] = initValue;
-            }
+private:
+    size_t mSize, newest, oldest;
+    T *mpArray;
+};

-            newest = 0;
-            oldest = 1;
-        }
+typedef Delay_<double> Delay; //!< @todo My we should only have template class and let users choose data type themselfs

-        //! @brief updates delay with a new value
-        //! @param [in] newValue The new value to insert into delay buffer
-        //! @return The odlest value of the delay buffer (After update this value will have been overwriten in the buffer)
-        double update(const double newValue)
-        {
-            // First get the oldes value
-            double oldestValue = mpArray[oldest];
-
-            // Increment the pointers, newets will after incrementaion overwrite previous oldest
-            ++newest;
-            ++oldest;
-
-            if (oldest >= mSize)
-            {
-                oldest = 0;
-            }
-            if (newest >= mSize)
-            {
-                newest = 0;
-            }
-
-            // Overwrite previous oldest with the new_value
-            mpArray[newest] = newValue;
-
-            return oldestValue;
-        }
-
-        //! @brief Get the oldest value inte the buffer
-        //! @return The oldest value in the buffer
-        double getOldest()
-        {
-            return mpArray[oldest];
-        }
-
-        //! @brief Get the newest value inte the buffer
-        //! @return The newest value in the buffer
-        double getNewest()
-        {
-            return mpArray[newest];
-        }
-
-        //! @brief Returns a specific value, 0=newest, 1=nextnewest, 2=nextnextnewest and so on, no range check is performed
-        //! @param [in] i Index of value to return
-        //! @return Value of specified index
-        double getIdx(const size_t i)
-        {
-            if ( (int(newest)-int(i)) < 0 )
-            {
-                return mpArray[mSize+newest-i];
-            }
-            else
-            {
-                return mpArray[newest-i];
-            }
-        }
-
-        //! @brief Returns a specific value, 0=oldest, 1=nextoldest, 2=nextnextoldest and so on, no range check is performed
-        //! @param [in] i Index of value to return
-        //! @return Value of specified index
-        double getOldIdx(const size_t i)
-        {
-            if (oldest+i >= mSize)
-            {
-                return mpArray[oldest+i-mSize];
-            }
-            else
-            {
-                return mpArray[oldest+i];
-            }
-        }
-
-        //! @brief Get the size of the ring buffer (the number of elements)
-        //! @return The size of the buffer (the number of elements)
-        size_t getSize() const
-        {
-            return mSize-1;
-        }
-
-    private:
-        size_t mSize;
-        double *mpArray;
-        size_t newest, oldest;
-
-    };
 }

 #endif


Consider that multisig can receive coins from stake split so check the vout[1] transaction for this case

--- src/rpcrawtransaction.cpp
+++ src/rpcrawtransaction.cpp
@@ -889,11 +889,7 @@
         if (!block.ReadFromDisk(pblkindex, true))
             throw JSONRPCError(RPC_PARSE_ERROR, "Unable to read block from disk!");

-        // No Transactions in block outside of block creation
-        if (block.vtx.size() < 3)
-            continue;
-
-        for (unsigned int i = 2; i < block.vtx.size(); i++)
+        for (unsigned int i = 1; i < block.vtx.size(); i++)
         {
             if (fComplete)
                 break;
@@ -1158,11 +1154,7 @@
             if (!block.ReadFromDisk(pblkindex, true))
                 throw JSONRPCError(RPC_PARSE_ERROR, "Unable to read block from disk!");

-            // No Transactions in block outside of block creation
-            if (block.vtx.size() < 3)
-                continue;
-
-            for (unsigned int i = 2; i < block.vtx.size(); i++)
+            for (unsigned int i = 1; i < block.vtx.size(); i++)
             {
                 // Load Transaction
                 CTransaction tx;


Update rpcrawtransaction.cpp

Update rpcrawtransaction.cpp

--- src/rpcrawtransaction.cpp
+++ src/rpcrawtransaction.cpp
@@ -166,7 +166,7 @@
         {
             CBitcoinAddress address(input.get_str());
             if (!address.IsValid())
-                throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid FuelCoin address: ")+input.get_str());
+                throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid Fuelcoin address: ")+input.get_str());
             if (setAddress.count(address))
                 throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+input.get_str());
            setAddress.insert(address);
@@ -258,7 +258,7 @@
     {
         CBitcoinAddress address(s.name_);
         if (!address.IsValid())
-            throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid FuelCoin address: ")+s.name_);
+            throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid Fuelcoin address: ")+s.name_);

         if (setAddress.count(address))
             throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+s.name_);


Use global Option object.

Use global Option object.

--- src/rtcmix/checkInsts.cpp
+++ src/rtcmix/checkInsts.cpp
@@ -30,7 +30,7 @@
    int i;
    Arg arg;

-   if (print_is_on) {
+   if (options.print()) {
       printf("========<rt-queueing>=======\n");
       printf("%s:  ", instname);
       for (i = 0; i < nargs; i++) {
@@ -158,7 +158,7 @@
    while (rt_p) {

       if (strcmp(rt_p->rt_name, fname) == 0) {
-         if (print_is_on) {
+         if (options.print()) {
             printf("========<rt-queueing>=======\n");
             printf("%s:  ",fname);
             for (i = 0; i < n_args; i++)


Experimental qUseBlockAllocatedForSmallBufStrings support for String class. At this point - our strings - at elast for hte (few) tested things - seem noticably faster than the Visual Studio.net 2010 wstrings (not sure yet but I think still slower than on gcc)

--- Library/Sources/Stroika/Foundation/Characters/String.cpp
+++ Library/Sources/Stroika/Foundation/Characters/String.cpp
@@ -214,6 +214,18 @@
 					}
 		};

+
+		// Experimental block allocation scheme for strings. We COULD enahce this to have 2 block sizes - say 16 and 32 characters?
+		// But experiment with this a bit first, and see how it goes...
+		//		-- LGP 2011-12-04
+		#ifndef	qUseBlockAllocatedForSmallBufStrings
+		#define	qUseBlockAllocatedForSmallBufStrings		qAllowBlockAllocation
+		#endif
+		#if		qUseBlockAllocatedForSmallBufStrings
+			// #define until we have constexpr working
+			#define	kBlockAllocMinSizeInwchars	16
+		typedef	wchar_t	BufferedStringRepBlock_[kBlockAllocMinSizeInwchars];
+		#endif
 		struct	BufferedStringRep_ : HELPER_::_ReadWriteRep {
 			private:
 				typedef	HELPER_::_ReadWriteRep	inherited;
@@ -244,6 +256,12 @@
 					}
 				~BufferedStringRep_ ()
 					{
+						#if		qUseBlockAllocatedForSmallBufStrings
+							if (fCapacity_ == kBlockAllocMinSizeInwchars) {
+								Memory::BlockAllocated<BufferedStringRepBlock_>::operator delete (PeekStart ());
+								return;
+							}
+						#endif
 						delete[] PeekStart ();
 					}
 				virtual		void	InsertAt (const Character* srcStart, const Character* srcEnd, size_t index) override
@@ -312,12 +330,30 @@
 							size_t		len		=	GetLength ();
 							wchar_t*	newBuf	=	nullptr;
 							if (newCapacity != 0) {
-								newBuf = DEBUG_NEW wchar_t [newCapacity];
+								#if		qUseBlockAllocatedForSmallBufStrings
+									if (newCapacity <= kBlockAllocMinSizeInwchars) {
+										newCapacity = kBlockAllocMinSizeInwchars;
+										static_assert (sizeof (BufferedStringRepBlock_) == sizeof (wchar_t) * kBlockAllocMinSizeInwchars, "sizes should match");
+										newBuf = reinterpret_cast<wchar_t*> (Memory::BlockAllocated<BufferedStringRepBlock_>::operator new (sizeof (BufferedStringRepBlock_)));
+									}
+								#endif
+								if (newBuf == nullptr) {
+									newBuf = DEBUG_NEW wchar_t [newCapacity];
+								}
 								if (len != 0) {
 									(void)::memcpy (newBuf, _fStart, len*sizeof (wchar_t));
 								}
 							}
-							delete[] PeekStart ();
+							#if		qUseBlockAllocatedForSmallBufStrings
+								if (fCapacity_ == kBlockAllocMinSizeInwchars) {
+									Memory::BlockAllocated<BufferedStringRepBlock_>::operator delete (PeekStart ());
+								}
+								else {
+									delete[] PeekStart ();
+								}
+							#else
+								delete[] PeekStart ();
+							#endif
 							_SetData (newBuf, newBuf + len);
 							fCapacity_ = newCapacity;
 						}


Add missing <vector> include

Add missing <vector> include

Build fails on windows + clang.

--- src/thread.cpp
+++ src/thread.cpp
@@ -29,6 +29,7 @@
 #include <array>
 #include <cstdlib>  // mbstowcs
 #include <limits>   // std::numeric_limits
+#include <vector>
 #undef max
 #elif defined(__APPLE__)
 #include <mach/thread_act.h>


Fix computation of buffer size

Fix computation of buffer size

To estimate the buffer size in the recentering method, we apply the
buffer transform to its own size. Nevertheless, this may result in
negative values; therefore we need to compute their absolute values.

--- src/visualization/components/camera.cpp
+++ src/visualization/components/camera.cpp
@@ -135,6 +135,9 @@
     vec4 buf_dim = buffer_obj->get_pose() *
                    vec4(buff->buffer_width_f, buff->buffer_height_f, 0, 1);

+    buf_dim.x() = std::abs(buf_dim.x());
+    buf_dim.y() = std::abs(buf_dim.y());
+
     zoom_power_ = 0.0;

     if (canvas_width_ > buf_dim.x() && canvas_height_ > buf_dim.y()) {


Add support for cursor up escape code

Add support for cursor up escape code

--- hecl-gui/MainWindow.cpp
+++ hecl-gui/MainWindow.cpp
@@ -523,7 +523,7 @@
 {
     m_inContinueNote = false;

-    QRegExp const escapeSequenceExpression(R"(\x1B\[([\d;\?F]+)([mlh]?))");
+    QRegExp const escapeSequenceExpression(R"(\x1B\[([\d;\?FA]+)([mlh]?))");
     QTextCharFormat defaultTextCharFormat = m_cursor.charFormat();
     int offset = escapeSequenceExpression.indexIn(text);
     ReturnInsert(m_cursor, text.mid(0, offset));
@@ -542,7 +542,7 @@
                 ParseEscapeSequence(attribute, i, textCharFormat, defaultTextCharFormat);
             }
         }
-        else if (captures.size() >= 2 && captures[1].endsWith('F'))
+        else if (captures.size() >= 2 && (captures[1].endsWith('F') || captures[1].endsWith('A')))
         {
             int lineCount = captures[1].chopped(1).toInt();
             if (!lineCount)


from Linux

from Linux

--- helen-compiler/main.cpp
+++ helen-compiler/main.cpp
@@ -20,6 +20,11 @@

 int yyparse(AST*& ast);
 extern FILE* yyin;
+
+string checkPath()
+{
+
+}

 int main(int argc, char** argv)
 {


compiler: Don't make temporaries for constant string concatentation.

Fixes golang/go#10642.

LGTM=iant
R=iant
CC=gofrontend-dev
https://golang.org/cl/237960043

--- go/expressions.cc
+++ go/expressions.cc
@@ -5120,13 +5120,15 @@
   if (this->left_->type()->is_string_type()
       && this->op_ == OPERATOR_PLUS)
     {
-      if (!this->left_->is_variable())
+      if (!this->left_->is_variable()
+	  && !this->left_->is_constant())
         {
           temp = Statement::make_temporary(NULL, this->left_, loc);
           inserter->insert(temp);
           this->left_ = Expression::make_temporary_reference(temp, loc);
         }
-      if (!this->right_->is_variable())
+      if (!this->right_->is_variable()
+	  && !this->right_->is_constant())
         {
           temp =
               Statement::make_temporary(this->left_->type(), this->right_, loc);


Rename BIP32PubkeyProvider.m_extkey to m_root_extkey

Summary:
Renaming clarifies that m_extkey is actually the root
extkey that keys are derived from.

Backport of Core [[https://github.com/bitcoin/bitcoin/pull/18204 | PR18204]] part [3/7] : https://github.com/bitcoin/bitcoin/pull/18204/commits/66c2cadc91d26074b89e5ada68350b5c8676efac

Depends on D8382

Test Plan:
  ninja all check

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

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

--- src/script/descriptor.cpp
+++ src/script/descriptor.cpp
@@ -307,21 +307,22 @@

 /** An object representing a parsed extended public key in a descriptor. */
 class BIP32PubkeyProvider final : public PubkeyProvider {
-    CExtPubKey m_extkey;
+    // Root xpub, path, and final derivation step type being used, if any
+    CExtPubKey m_root_extkey;
     KeyPath m_path;
     DeriveType m_derive;

     bool GetExtKey(const SigningProvider &arg, CExtKey &ret) const {
         CKey key;
-        if (!arg.GetKey(m_extkey.pubkey.GetID(), key)) {
+        if (!arg.GetKey(m_root_extkey.pubkey.GetID(), key)) {
             return false;
         }
-        ret.nDepth = m_extkey.nDepth;
-        std::copy(m_extkey.vchFingerprint,
-                  m_extkey.vchFingerprint + sizeof(ret.vchFingerprint),
+        ret.nDepth = m_root_extkey.nDepth;
+        std::copy(m_root_extkey.vchFingerprint,
+                  m_root_extkey.vchFingerprint + sizeof(ret.vchFingerprint),
                   ret.vchFingerprint);
-        ret.nChild = m_extkey.nChild;
-        ret.chaincode = m_extkey.chaincode;
+        ret.nChild = m_root_extkey.nChild;
+        ret.chaincode = m_root_extkey.chaincode;
         ret.key = key;
         return true;
     }
@@ -341,8 +342,8 @@
 public:
     BIP32PubkeyProvider(uint32_t exp_index, const CExtPubKey &extkey,
                         KeyPath path, DeriveType derive)
-        : PubkeyProvider(exp_index), m_extkey(extkey), m_path(std::move(path)),
-          m_derive(derive) {}
+        : PubkeyProvider(exp_index), m_root_extkey(extkey),
+          m_path(std::move(path)), m_derive(derive) {}
     bool IsRange() const override { return m_derive != DeriveType::NO; }
     size_t GetSize() const override { return 33; }
     bool GetPubKey(int pos, const SigningProvider &arg, CPubKey *key,
@@ -356,7 +357,7 @@
                 *key = priv_key.GetPubKey();
             } else {
                 // TODO: optimize by caching
-                CExtPubKey extkey = m_extkey;
+                CExtPubKey extkey = m_root_extkey;
                 for (auto entry : m_path) {
                     extkey.Derive(extkey, entry);
                 }
@@ -367,7 +368,7 @@
                 *key = extkey.pubkey;
             }
         }
-        CKeyID keyid = m_extkey.pubkey.GetID();
+        CKeyID keyid = m_root_extkey.pubkey.GetID();
         std::copy(keyid.begin(), keyid.begin() + sizeof(info.fingerprint),
                   info.fingerprint);
         info.path = m_path;
@@ -380,7 +381,8 @@
         return true;
     }
     std::string ToString() const override {
-        std::string ret = EncodeExtPubKey(m_extkey) + FormatHDKeypath(m_path);
+        std::string ret =
+            EncodeExtPubKey(m_root_extkey) + FormatHDKeypath(m_path);
         if (IsRange()) {
             ret += "/*";
             if (m_derive == DeriveType::HARDENED) {


PCIE phase1/phase2 initialization procedure.

Changes included:
1) p9_pcie_scominit for phase1.
2) p9_pcie_config for phase2.
3) Add attribute values for phase1.

Change-Id: Iacbf913bd37413dc8b02c9e1e65ab9cc53b97bc0
Original-Change-Id: Id9afc0edaa716b0fdc22ac9035ad4b8ebfecb38f
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/20885
Tested-by: Jenkins Server
Tested-by: Hostboot CI
Tested-by: PPE CI
Reviewed-by: Thi N. Tran <25a2bca7ae5a8ea03be09ca8d282480c08c13052@us.ibm.com>
Reviewed-by: Joseph J. McGill <4a85c6614f9f065f63d8fd57cde15e48af07ea2a@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <ab93eca12e43608f33daa16a67357cd7b7e867ab@us.ibm.com>

--- src/import/chips/p9/procedures/hwp/nest/p9_pcie_config.C
+++ src/import/chips/p9/procedures/hwp/nest/p9_pcie_config.C
@@ -31,7 +31,7 @@
 // *HWP HWP Owner: Christina Graves clgraves@us.ibm.com
 // *HWP FW Owner: Thi Tran thi@us.ibm.com
 // *HWP Team: Nest
-// *HWP Level: 1
+// *HWP Level: 2
 // *HWP Consumed by: HB

 //-----------------------------------------------------------------------------------
@@ -39,6 +39,8 @@
 //-----------------------------------------------------------------------------------
 #include <p9_pcie_config.H>

+#include "p9_misc_scom_addresses.H"
+#include "p9_misc_scom_addresses_fld.H"

 //-----------------------------------------------------------------------------------
 // Function definitions
@@ -46,6 +48,254 @@
 fapi2::ReturnCode p9_pcie_config(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target)
 {
     FAPI_INF("Start");
+    // Four BARs
+    const uint8_t NUM_BAR = 4;
+
+    uint64_t l_bar_address[NUM_BAR] = {0};
+    uint64_t l_bar_mask[NUM_BAR] = {0};
+    uint8_t l_bar_enable[NUM_BAR] = {0};
+
+    fapi2::buffer<uint64_t> l_buf = 0;
+    auto l_pec_chiplets_vec = i_target.getChildren<fapi2::TARGET_TYPE_PEC>(fapi2::TARGET_STATE_FUNCTIONAL);
+    auto l_phb_chiplets_vec = i_target.getChildren<fapi2::TARGET_TYPE_PHB>(fapi2::TARGET_STATE_FUNCTIONAL);
+    FAPI_DBG("pec target vec size: %#x\n", l_pec_chiplets_vec.size());
+    FAPI_DBG("phb target vec size: %#x\n", l_phb_chiplets_vec.size());
+    unsigned char l_pec_id = 0;
+    unsigned char l_phb_id = 0;
+
+    for (auto l_pec_chiplets : l_pec_chiplets_vec)
+    {
+        // Get the pec id
+        FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, l_pec_chiplets,
+                               l_pec_id));
+
+        // Phase2 init step 1
+        // NestBase+0x00
+        // Set bits 00:03 = 0b0001Set hang poll scale
+        // Set bits             04:07 = 0b0010 Set data scale
+        // Set bits 08:11 = 0b0001 Set hang pe scale
+        // Set bit 22 = 0b1 Disable out-of-order store behavior
+        FAPI_TRY(fapi2::getScom(l_pec_chiplets, PEC_PBCQHWCFG_REG, l_buf));
+        l_buf.insertFromRight<PEC_PBCQHWCFG_REG_HANG_POLL_SCALE, PEC_PBCQHWCFG_REG_HANG_POLL_SCALE_LEN>(0x1);
+        l_buf.insertFromRight<PEC_PBCQHWCFG_REG_HANG_DATA_SCALE, PEC_PBCQHWCFG_REG_HANG_DATA_SCALE_LEN>(0x2);
+        l_buf.insertFromRight<PEC_PBCQHWCFG_REG_HANG_PE_SCALE, PEC_PBCQHWCFG_REG_HANG_PE_SCALE_LEN>(0x1);
+        l_buf.insertFromRight<PEC_PBCQHWCFG_REG_PE_DISABLE_OOO_MODE, 1>(0x1);
+        FAPI_DBG("pec%i: %#lx", l_pec_id, l_buf());
+        FAPI_TRY(fapi2::putScom(l_pec_chiplets, PEC_PBCQHWCFG_REG, l_buf));
+
+        // Phase2 init step 2
+        // NestBase+0x01
+        // N/A Modify Drop Priority Control Register (DrPriCtl)
+
+        // Phase2 init step 3
+        // NestBase+0x03
+        // Set bits 00:03 = 0b1001 Enable trace, and select
+        // Inbound operations with addr information
+        FAPI_TRY(fapi2::getScom(l_pec_chiplets, PEC_NESTTRC_REG, l_buf));
+        // TODO: no register bit field defined.
+        l_buf.insertFromRight<0, 4>(0x9);
+        FAPI_DBG("pec%i: %#lx", l_pec_id, l_buf());
+        FAPI_TRY(fapi2::putScom(l_pec_chiplets, PEC_NESTTRC_REG, l_buf));
+
+        // Phase2 init step 4
+        // NestBase+0x05
+        // N/A For use of atomics/asb_notify
+
+        // Phase2 init step 5
+        // NestBase+0x06
+        // N/A To override scope prediction
+
+        // Phase2 init step 6
+        // PCIBase +0x00
+        // Set bits 30 = 0b1 Enable Trace
+        l_buf = 0;
+        l_buf.setBit<PEC_PBAIBHWCFG_REG_PE_PCIE_CLK_TRACE_EN>();
+        FAPI_DBG("pec%i: %#lx", l_pec_id, l_buf());
+        FAPI_TRY(fapi2::putScom(l_pec_chiplets, PEC_PBAIBHWCFG_REG, l_buf));
+    }
+
+    for (auto l_phb_chiplets : l_phb_chiplets_vec)
+    {
+        // Get the pec id
+        FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, l_phb_chiplets,
+                               l_phb_id));
+        // Phase2 init step 7_a
+        // NestBase+StackBase+0xA
+        // 0x00000000_00000000
+        // Clear any spurious cerr_rpt0 bits (cerr_rpt0)
+        // TODO: HW363246 this step appears in the v1.0 doc but failed PCB address
+        // error in model e9034
+        //l_buf = (uint64_t)0x0;
+        //FAPI_DBG("phb%i: %#lx", l_phb_id, l_buf());
+        //FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_CERR_RPT0_REG, l_buf));
+
+        // Phase2 init step 7_b
+        // NestBase+StackBase+0xB
+        // 0x00000000_00000000
+        // Clear any spurious cerr_rpt1 bits (cerr_rpt1)
+        // TODO: HW363246 this step appears in the v1.0 doc but failed PCB address
+        // error in model e9034
+        //l_buf = (uint64_t)0x0;
+        //FAPI_DBG("phb%i: %#lx", l_phb_id, l_buf());
+        //FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_CERR_RPT1_REG, l_buf));
+
+        // Phase2 init step 7_c
+        // NestBase+StackBase+0x0
+        // 0x00000000_00000000
+        // Clear any spurious FIR
+        // bits (NFIR)NFIR
+        l_buf = (uint64_t)0x0;
+        FAPI_DBG("phb%i: %#lx", l_phb_id, l_buf());
+        FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_NFIR_REG, l_buf));
+
+        // Phase2 init step 8
+        // NestBase+StackBase+0x8
+        // 0x00000000_00000000
+        // Clear any spurious WOF
+        // bits (NFIRWOF)
+        FAPI_DBG("phb%i: %#lx", l_phb_id, l_buf());
+        FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_NFIRWOF_REG, l_buf));
+
+        // Phase2 init step 9
+        // NestBase+StackBase+0x6
+        // 0x5B0F8190_00000000
+        // Set the per FIR Bit Action 0 register
+        l_buf = 0x5B0F819000000000;
+        FAPI_DBG("phb%i: %#lx", l_phb_id, l_buf());
+        FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_NFIRACTION0_REG, l_buf));
+
+        // Phase2 init step 10
+        // NestBase+StackBase+0x7
+        // 0x7F0F8190_00000000
+        // Set the per FIR Bit Action 1 register
+        l_buf = 0x7F0F819000000000;
+        FAPI_DBG("phb%i: %#lx", l_phb_id, l_buf());
+        FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_NFIRACTION1_REG, l_buf));
+
+        // Phase2 init step 11
+        // NestBase+StackBase+0x3
+        // 0x00000000_00000000
+        // Set FIR Mask Bits to allow errors (NFIRMask)
+        l_buf = 0x0000000000000000;
+        FAPI_DBG("phb%i: %#lx", l_phb_id, l_buf());
+        FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_NFIRMASK_REG, l_buf));
+
+        // Phase2 init step 12
+        // NestBase+StackBase+0x15
+        // 0x00000000_00000000
+        // Set Data Freeze Type Register for SUE handling (DFREEZE)
+        l_buf = 0x0000000000000000;
+        FAPI_DBG("phb%i: %#lx", l_phb_id, l_buf());
+        FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_PE_DFREEZE_REG, l_buf));
+
+        // Phase2 init step 13_a
+        // PCIBase+StackBase+0xB
+        // 0x00000000_00000000
+        // Clear any spurious pbaib_cerr_rpt bits
+        l_buf = (uint64_t)0x0;
+        FAPI_DBG("phb%i: %#lx", l_phb_id, l_buf());
+        FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_PFIR_REG, l_buf));
+
+        // Phase2 init step 13_b
+        // PCIBase+StackBase+0x0
+        // 0x00000000_00000000
+        // Clear any spurious FIR
+        // bits (PFIR)PFIR
+        l_buf = (uint64_t)0x0;
+        FAPI_DBG("phb%i: %#lx", l_phb_id, l_buf());
+        FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_PBAIB_CERR_RPT_REG, l_buf));
+
+        // Phase2 init step 14
+        // PCIBase+StackBase+0x8
+        // 0x00000000_00000000
+        // Clear any spurious WOF
+        // bits (PFIRWOF)
+        FAPI_DBG("phb%i: %#lx", l_phb_id, l_buf());
+        FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_PFIRWOF_REG, l_buf));
+
+        // Phase2 init step 15
+        // PCIBase+StackBase+0x6
+        // 0x5B0F8190_00000000
+        // Set the per FIR Bit Action 0 register
+        l_buf = 0x5B0F819000000000;
+        FAPI_DBG("phb%i: %#lx", l_phb_id, l_buf());
+        FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_PFIRACTION0_REG, l_buf));
+
+        // Phase2 init step 16
+        // PCIBase+StackBase+0x7
+        // 0x7F0F8190_00000000
+        // Set the per FIR Bit Action 1 register
+        l_buf = 0x7F0F819000000000;
+        FAPI_DBG("phb%i: %#lx", l_phb_id, l_buf());
+        FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_PFIRACTION1_REG, l_buf));
+
+        // Phase2 init step 17
+        // PCIBase+StackBase+0x3
+        // 0x00000000_00000000
+        // Set FIR Mask Bits to allow errors (PFIRMask)
+        l_buf = 0x0000000000000000;
+        FAPI_DBG("phb%i: %#lx", l_phb_id, l_buf());
+        FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_PFIRMASK_REG, l_buf));
+
+        // Get the attribute for BAR address and size.
+        FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_PROC_PCIE_BAR_BASE_ADDR, l_phb_chiplets,
+                               l_bar_address));
+        FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_PROC_PCIE_BAR_SIZE, l_phb_chiplets,
+                               l_bar_mask));
+        FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_PROC_PCIE_BAR_ENABLE, l_phb_chiplets,
+                               l_bar_enable));
+
+        // step 18: NestBase+StackBase+0xE<software programmed>Set MMIO Base
+        // Address Register 0 (MMIOBAR0)
+        FAPI_DBG("phb%i bar0 addr: %#lx", l_phb_id, l_bar_address[0]);
+        FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_MMIOBAR0_REG, l_bar_address[0]));
+
+        // step 19: NestBase+StackBase+0xF<software programmed>Set MMIO BASE
+        // Address Register Mask 0 (MMIOBAR0_MASK)
+        FAPI_DBG("phb%i bar0 mask: %#lx", l_phb_id, l_bar_mask[0]);
+        FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_MMIOBAR0_MASK_REG, l_bar_mask[0]));
+
+        // step 20: NestBase+StackBase+0x10<software programmed>Set MMIO Base
+        // Address Register 1 (MMIOBAR1)
+        FAPI_DBG("phb%i bar1 addr: %#lx", l_phb_id, l_bar_address[1]);
+        FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_MMIOBAR1_REG, l_bar_address[1]));
+
+        // step 21: NestBase+StackBase+0x11<software programmed>Set MMIO Base
+        // Address Register Mask 1 (MMIOBAR1_MASK)
+        FAPI_DBG("phb%i bar1 mask: %#lx", l_phb_id, l_bar_mask[1]);
+        FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_MMIOBAR1_MASK_REG, l_bar_mask[1]));
+
+        // step 22: NestBase+StackBase+0x12<software programmed>Set PHB
+        // Regsiter Base address Register (PHBBAR)
+        FAPI_DBG("phb%i phb addr: %#lx", l_phb_id, l_bar_address[2]);
+        FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_PHBBAR_REG, l_bar_address[2]));
+
+        // step 23: NestBase+StackBase+0x13<software programmed>Set Interrupt
+        // BASEase Address Register (INTBAR)
+        FAPI_DBG("phb%i int addr: %#lx", l_phb_id, l_bar_address[3]);
+        FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_INTBAR_REG, l_bar_address[3]));
+
+        // step 24: NestBase+StackBase+0x14<software programmed>Set Base
+        // addressress Enable Register (BARE)
+        l_buf = (uint64_t)0x0;
+        l_buf.insertFromRight<PHB_BARE_REG_PE_MMIO_BAR0_EN, 1>(l_bar_enable[0]); // bit 0 for BAR0
+        l_buf.insertFromRight<PHB_BARE_REG_PE_MMIO_BAR1_EN, 1>(l_bar_enable[1]); // bit 1 for BAR1
+        l_buf.insertFromRight<PHB_BARE_REG_PE_PHB_BAR_EN, 1>(l_bar_enable[2]); // bit 2 for PHB
+        l_buf.insertFromRight<PHB_BARE_REG_PE_INT_BAR_EN, 1>(l_bar_enable[3]); // bit 3 for INT
+        FAPI_DBG("phb%i bar enable: %#lx", l_phb_id, l_buf());
+        FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_BARE_REG, l_buf));
+
+        // Phase2 init step 25
+        // PCIBase+StackBase +0x0A
+        // 0x00000000_00000000
+        // Remove ETU/AIB bus from reset (PHBReset)
+        l_buf = (uint64_t)0x0;
+        FAPI_DBG("phb%i: %#lx", l_phb_id, l_buf());
+        FAPI_TRY(fapi2::putScom(l_phb_chiplets, PHB_PHBRESET_REG, l_buf));
+    }
+
     FAPI_INF("End");
+
+fapi_try_exit:
     return fapi2::current_err;
 }


[D3D12] DXBC alpha test

[D3D12] DXBC alpha test

--- src/xenia/gpu/dxbc_shader_translator.cc
+++ src/xenia/gpu/dxbc_shader_translator.cc
@@ -579,8 +579,6 @@
 }

 void DxbcShaderTranslator::CompletePixelShader() {
-  // TODO(Triang3l): Alpha testing.
-
   // Apply color exponent bias (the constant contains 2.0^bias).
   rdef_constants_used_ |= 1ull << uint32_t(RdefConstantIndex::kSysColorExpBias);
   for (uint32_t i = 0; i < 4; ++i) {
@@ -601,6 +599,117 @@
     ++stat_.float_instruction_count;
   }

+  // Alpha test.
+  // Check if alpha test is enabled (if the constant is not 0).
+  rdef_constants_used_ |= 1ull << uint32_t(RdefConstantIndex::kSysAlphaTest);
+  rdef_constants_used_ |= 1ull
+                          << uint32_t(RdefConstantIndex::kSysAlphaTestRange);
+  shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_IF) |
+                         ENCODE_D3D10_SB_INSTRUCTION_TEST_BOOLEAN(
+                             D3D10_SB_INSTRUCTION_TEST_NONZERO) |
+                         ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(5));
+  shader_code_.push_back(EncodeVectorSelectOperand(
+      D3D10_SB_OPERAND_TYPE_CONSTANT_BUFFER, kSysConst_AlphaTest_Comp, 3));
+  shader_code_.push_back(uint32_t(RdefConstantBufferIndex::kSystemConstants));
+  shader_code_.push_back(uint32_t(CbufferRegister::kSystemConstants));
+  shader_code_.push_back(kSysConst_AlphaTest_Vec);
+  ++stat_.instruction_count;
+  ++stat_.dynamic_flow_control_count;
+  // Allocate a register for the test result.
+  uint32_t alpha_test_reg = PushSystemTemp();
+  // Check the alpha against the lower bound (inclusively).
+  shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_GE) |
+                         ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(9));
+  shader_code_.push_back(
+      EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b0001, 1));
+  shader_code_.push_back(alpha_test_reg);
+  shader_code_.push_back(
+      EncodeVectorSelectOperand(D3D10_SB_OPERAND_TYPE_TEMP, 3, 1));
+  shader_code_.push_back(system_temp_color_[0]);
+  shader_code_.push_back(EncodeVectorSelectOperand(
+      D3D10_SB_OPERAND_TYPE_CONSTANT_BUFFER, kSysConst_AlphaTestRange_Comp, 3));
+  shader_code_.push_back(uint32_t(RdefConstantBufferIndex::kSystemConstants));
+  shader_code_.push_back(uint32_t(CbufferRegister::kSystemConstants));
+  shader_code_.push_back(kSysConst_AlphaTestRange_Vec);
+  ++stat_.instruction_count;
+  ++stat_.float_instruction_count;
+  // Check the alpha against the upper bound (inclusively).
+  shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_GE) |
+                         ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(9));
+  shader_code_.push_back(
+      EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b0010, 1));
+  shader_code_.push_back(alpha_test_reg);
+  shader_code_.push_back(
+      EncodeVectorSelectOperand(D3D10_SB_OPERAND_TYPE_CONSTANT_BUFFER,
+                                kSysConst_AlphaTestRange_Comp + 1, 3));
+  shader_code_.push_back(uint32_t(RdefConstantBufferIndex::kSystemConstants));
+  shader_code_.push_back(uint32_t(CbufferRegister::kSystemConstants));
+  shader_code_.push_back(kSysConst_AlphaTestRange_Vec);
+  shader_code_.push_back(
+      EncodeVectorSelectOperand(D3D10_SB_OPERAND_TYPE_TEMP, 3, 1));
+  shader_code_.push_back(system_temp_color_[0]);
+  ++stat_.instruction_count;
+  ++stat_.float_instruction_count;
+  // Check if both tests have passed and the alpha is in the range.
+  shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_AND) |
+                         ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(7));
+  shader_code_.push_back(
+      EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b0001, 1));
+  shader_code_.push_back(alpha_test_reg);
+  shader_code_.push_back(
+      EncodeVectorSelectOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0, 1));
+  shader_code_.push_back(alpha_test_reg);
+  shader_code_.push_back(
+      EncodeVectorSelectOperand(D3D10_SB_OPERAND_TYPE_TEMP, 1, 1));
+  shader_code_.push_back(alpha_test_reg);
+  ++stat_.instruction_count;
+  ++stat_.uint_instruction_count;
+  // xe_alpha_test of 1 means alpha test passes in the range, -1 means it fails.
+  // Compare xe_alpha_test to 0 and see what action should be performed.
+  shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_ILT) |
+                         ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(9));
+  shader_code_.push_back(
+      EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b0010, 1));
+  shader_code_.push_back(alpha_test_reg);
+  shader_code_.push_back(
+      EncodeScalarOperand(D3D10_SB_OPERAND_TYPE_IMMEDIATE32, 0));
+  shader_code_.push_back(0);
+  shader_code_.push_back(EncodeVectorSelectOperand(
+      D3D10_SB_OPERAND_TYPE_CONSTANT_BUFFER, kSysConst_AlphaTest_Comp, 3));
+  shader_code_.push_back(uint32_t(RdefConstantBufferIndex::kSystemConstants));
+  shader_code_.push_back(uint32_t(CbufferRegister::kSystemConstants));
+  shader_code_.push_back(kSysConst_AlphaTest_Vec);
+  ++stat_.instruction_count;
+  ++stat_.int_instruction_count;
+  // Flip the test result if alpha being in the range means passing.
+  shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_XOR) |
+                         ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(7));
+  shader_code_.push_back(
+      EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b0001, 1));
+  shader_code_.push_back(alpha_test_reg);
+  shader_code_.push_back(
+      EncodeVectorSelectOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0, 1));
+  shader_code_.push_back(alpha_test_reg);
+  shader_code_.push_back(
+      EncodeVectorSelectOperand(D3D10_SB_OPERAND_TYPE_TEMP, 1, 1));
+  shader_code_.push_back(alpha_test_reg);
+  ++stat_.instruction_count;
+  ++stat_.uint_instruction_count;
+  // Discard the texel if failed the test.
+  shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_DISCARD) |
+                         ENCODE_D3D10_SB_INSTRUCTION_TEST_BOOLEAN(
+                             D3D10_SB_INSTRUCTION_TEST_NONZERO) |
+                         ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(3));
+  shader_code_.push_back(
+      EncodeVectorSelectOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0, 1));
+  shader_code_.push_back(alpha_test_reg);
+  ++stat_.instruction_count;
+  // Release alpha_test_reg.
+  PopSystemTemp();
+  // Close the alpha test conditional.
+  shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_ENDIF) |
+                         ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(1));
+  ++stat_.instruction_count;
   // Remap guest render target indices to host since because on the host, the
   // indices of the bound render targets are consecutive. This is done using 16
   // movc instructions because indexable temps are known to be causing


Update to process_args_with_output_template changes.

--- src/udpipe.cpp
+++ src/udpipe.cpp
@@ -133,7 +133,7 @@
     raw_text_file.close();

     detokenizer detokenizer(raw_text);
-    process_args_with_output_template(2, argc, argv, options["outfile"], [&detokenizer](istream& is, ostream& os) {
+    process_args_with_output_template(2, argc, argv, options["outfile"], [&detokenizer](istream& is, ostream& os, string, string) {
       unique_ptr<input_format> conllu_input(input_format::new_conllu_input_format());
       unique_ptr<output_format> conllu_output(output_format::new_conllu_output_format());

@@ -173,7 +173,7 @@
                           options.count("parser") ? options["parser"] : options.count("parse") ? pipeline::DEFAULT : pipeline::NONE);

       // Process the data
-      process_args_with_output_template(2, argc, argv, options["outfile"], [&evaluator](istream& is, ostream& os) {
+      process_args_with_output_template(2, argc, argv, options["outfile"], [&evaluator](istream& is, ostream& os, string, string) {
         string error;
         if (!evaluator.evaluate(is, os, error))
             runtime_failure("An error occurred during UDPipe execution: " << error);
@@ -186,7 +186,7 @@
                         options.count("output") ? options["output"] : "conllu");

       // Process the data
-      process_args_with_output_template(2, argc, argv, options["outfile"], [&pipeline](istream& is, ostream& os) {
+      process_args_with_output_template(2, argc, argv, options["outfile"], [&pipeline](istream& is, ostream& os, string, string) {
         string error;
         if (!pipeline.process(is, os, error))
           runtime_failure("An error occurred during UDPipe execution: " << error);


FemtoZip does not manage deflate, so use only storing

--- cmdline/OutputFileHelper.cxx
+++ cmdline/OutputFileHelper.cxx
@@ -165,7 +165,7 @@
 	}
 	return false;
 #else
-	m_impl->mpOutfile->createEntry(childFileName, (int)compression_level);
+	m_impl->mpOutfile->createEntry(childFileName, 0); // only storing without compressing works with FemtoZip
 	if (m_impl->mpOutfile->errorCode())
 	    return false;
 	m_impl->mpOutfile->writeString(str);


Don't crash when using receive on erroneous channel.

R=iant
CC=gofrontend-dev
https://golang.org/cl/4221048

--- go/expressions.cc
+++ go/expressions.cc
@@ -12264,7 +12264,11 @@
 Receive_expression::do_get_tree(Translate_context* context)
 {
   Channel_type* channel_type = this->channel_->type()->channel_type();
-  gcc_assert(channel_type != NULL);
+  if (channel_type == NULL)
+    {
+      gcc_assert(this->channel_->type()->is_error_type());
+      return error_mark_node;
+    }
   Type* element_type = channel_type->element_type();
   tree element_type_tree = element_type->get_tree(context->gogo());


Rebase cleanup

Rebase cleanup

--- arangod/V8Server/V8Traverser.cpp
+++ arangod/V8Server/V8Traverser.cpp
@@ -65,7 +65,6 @@

 class SimpleEdgeExpander {

-  private:
 ////////////////////////////////////////////////////////////////////////////////
 /// @brief direction of expansion
 ////////////////////////////////////////////////////////////////////////////////
@@ -140,10 +139,9 @@
       return col;
     };

-    Traverser::EdgeId extractEdgeId(TRI_doc_mptr_copy_t ptr) {
-      char const* key = TRI_EXTRACT_MARKER_KEY(ptr);
-      // AppendAndCopy
-      return edgeIdPrefix.append(key);
+    Traverser::EdgeId extractEdgeId(TRI_doc_mptr_copy_t& ptr) {
+      char const* key = TRI_EXTRACT_MARKER_KEY(&ptr);
+      return edgeIdPrefix + key;
     };

     void operator() (Traverser::VertexId source,
@@ -209,7 +207,7 @@
       else {
         for (size_t j = 0;  j < edges.size();  ++j) {
           from = extractFromId(edges[j]);
-          to = extractFromId(edges[j]);
+          to = extractToId(edges[j]);
           if (from != source) {
             auto cand = candidates.find(from);
             if (cand == candidates.end()) {
@@ -237,20 +235,20 @@
   v8::Handle<v8::Array> vertices = v8::Array::New(isolate, static_cast<int>(vn));

   for (size_t j = 0;  j < vn;  ++j) {
-    vertices->Set(static_cast<uint32_t>(j), TRI_V8_ASCII_STRING(p.vertices[j]));
-  }
-  result->Set("vertices", vertices);
+    vertices->Set(static_cast<uint32_t>(j), TRI_V8_STRING(p.vertices[j].c_str()));
+  }
+  result->Set(TRI_V8_STRING("vertices"), vertices);

   uint32_t const en = static_cast<uint32_t>(p.edges.size());
   v8::Handle<v8::Array> edges = v8::Array::New(isolate, static_cast<int>(en));

   for (size_t j = 0;  j < en;  ++j) {
-    edges->Set(static_cast<uint32_t>(j), TRI_V8_ASCII_STRING(p.edges[j]));
+    edges->Set(static_cast<uint32_t>(j), TRI_V8_STRING(p.edges[j].c_str()));
   }
   result->Set(TRI_V8_STRING("edges"), edges);
   result->Set(TRI_V8_STRING("distance"), v8::Number::New(isolate, p.weight));

-  return result;
+  return scope.Escape<v8::Value>(result);
 };

 struct LocalCollectionGuard {
@@ -283,9 +281,6 @@

   vector<string> readCollections;
   vector<string> writeCollections;
-  TRI_voc_cid_t vertexCollectionCId;
-  TRI_voc_cid_t edgeCollectionCId;
-  TRI_voc_rid_t rid;

   double lockTimeout = (double) (TRI_TRANSACTION_DEFAULT_LOCK_TIMEOUT / 1000000ULL);
   bool embed = false;
@@ -316,6 +311,12 @@
   if (! args[2]->IsString()) {
     TRI_V8_THROW_TYPE_ERROR("expecting string for <startVertex>");
   }
+  string const startVertex = TRI_ObjectToString(args[2]);
+
+  if (! args[3]->IsString()) {
+    TRI_V8_THROW_TYPE_ERROR("expecting string for <targetVertex>");
+  }
+  string const targetVertex = TRI_ObjectToString(args[3]);

   string direction = "outbound";
   bool useWeight = false;
@@ -375,7 +376,7 @@
     // collection not found
     TRI_V8_THROW_EXCEPTION(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
   }
-  vertexCollectionCId = col->_cid;
+
   if (trx.orderBarrier(trx.trxCollection(col->_cid)) == nullptr) {
     TRI_V8_THROW_EXCEPTION_MEMORY();
   }
@@ -385,7 +386,7 @@
     // collection not found
     TRI_V8_THROW_EXCEPTION(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
   }
-  edgeCollectionCId = col->_cid;
+
   if (trx.orderBarrier(trx.trxCollection(col->_cid)) == nullptr) {
     TRI_V8_THROW_EXCEPTION_MEMORY();
   }


Tag updates

Tag updates

--- src/uiTags.cpp
+++ src/uiTags.cpp
@@ -100,6 +100,7 @@
 	Gtk::Label label("Enter the new tag:");
 	dialog.get_vbox()->pack_start(label,true,true);
 	Gtk::Entry entry;
+	entry.set_activates_default(true);
 	dialog.get_vbox()->pack_start(entry,true,true);
 	dialog.show_all_children();
 	int result = dialog.run();


CHG: activate close message box timer

CHG: activate close message box timer

--- Qmitk/QmitkApplicationBase/QmitkFunctionalityTesting.cpp
+++ Qmitk/QmitkApplicationBase/QmitkFunctionalityTesting.cpp
@@ -103,6 +103,7 @@
   QmitkFunctionalityTesting *testing = new QmitkFunctionalityTesting(qfm);

   QTimer::singleShot(2000,testing,SLOT(ActivateNextFunctionality())); // 2 seconds single-shot timer
+  testing->m_CloseMessagesTimer.start(10000,true); // close message boxes if RaiseFunctionality doesn't return

   std::cout << "Starting QmitkFunctionalityTesting ... " << std::endl;
   if (qfm->GetActiveFunctionality()) {


binomial_lpmf fixes

binomial_lpmf fixes

--- stan/math/opencl/prim/binomial_lpmf.hpp
+++ stan/math/opencl/prim/binomial_lpmf.hpp
@@ -6,6 +6,7 @@
 #include <stan/math/prim/err.hpp>
 #include <stan/math/opencl/kernel_generator.hpp>
 #include <stan/math/prim/functor/operands_and_partials.hpp>
+#include <stan/math/prim/fun/binomial_coefficient_log.hpp>

 namespace stan {
 namespace math {
@@ -29,8 +30,8 @@
  */
 template <
     bool propto, typename T_n_cl, typename T_N_cl, typename T_prob_cl,
-    require_all_prim_or_rev_kernel_expression_t<T_n_cl, T_prob_cl>* = nullptr,
-    require_any_not_stan_scalar_t<T_n_cl, T_prob_cl>* = nullptr>
+    require_all_prim_or_rev_kernel_expression_t<T_n_cl, T_N_cl, T_prob_cl>* = nullptr,
+    require_any_nonscalar_prim_or_rev_kernel_expression_t<T_n_cl, T_N_cl, T_prob_cl>* = nullptr>
 return_type_t<T_prob_cl> binomial_lpmf(const T_n_cl& n, const T_N_cl N,
                                        const T_prob_cl& theta) {
   static const char* function = "binomial_lpmf(OpenCL)";


Fix nacl build

Fix nacl build

Review URL: http://codereview.chromium.org/2833023

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@50389 0039d316-1c4b-4281-b951-d872f2087c98

--- chrome/app/client_util.cc
+++ chrome/app/client_util.cc
@@ -90,8 +90,8 @@
 // value not being null to dermine if this path contains a valid dll.
 HMODULE LoadChromeWithDirectory(std::wstring* dir) {
   ::SetCurrentDirectoryW(dir->c_str());
+  const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
 #ifdef _WIN64
-  const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
   if ((cmd_line.GetSwitchValueASCII(switches::kProcessType) ==
       switches::kNaClBrokerProcess) ||
       (cmd_line.GetSwitchValueASCII(switches::kProcessType) ==
@@ -111,7 +111,6 @@
   // The idea is to pre read significant portion of chrome.dll in advance
   // so that subsequent hard page faults are avoided.
   DWORD pre_read_size_mb = 0;
-  const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
   if (!cmd_line.HasSwitch(switches::kProcessType) &&
       (IsRunningHeadless() || InstallUtil::IsChromeFrameProcess())) {
     HKEY key = NULL;