cpu: Kernels are now "blocks" until they are codegenerated...

--- ve/cpu/specializer.cpp
+++ ve/cpu/specializer.cpp
@@ -218,20 +218,20 @@
  *  Create a symbol for the kernel.
  *
  *  NOTE: System and extension opcodes are ignored.
- *        If a kernel consists of nothing but system and/or extension
+ *        If a block consists of nothing but system and/or extension
  *        opcodes then the symbol will be the empty string "".
  */
-bool symbolize(bh_kernel_t &kernel, bh_intp const optimized) {
+bool symbolize(block_t &block, bh_intp const optimized) {

     std::string symbol_opcode,
                 symbol_lmask,
                 symbol_tsig,
                 symbol_ndim;

-    kernel.symbol   = "";
-
-    for (int i=0; i<kernel.ninstr; ++i) {
-        tac_t* tac = &kernel.program[i];
+    block.symbol   = "";
+
+    for (int i=0; i<block.ninstr; ++i) {
+        tac_t* tac = &block.program[i];

         // Do not include system opcodes in the kernel symbol.
         if ((tac->op == SYSTEM) || (tac->op == EXTENSION)) {
@@ -239,12 +239,12 @@
         }

         symbol_opcode  += std::string(bh_opcode_to_cstr_short(tac->op));
-        symbol_tsig    += std::string(bh_typesig_to_shorthand(kernel.tsig[i]));
-        symbol_lmask   += std::string(bh_layoutmask_to_shorthand(kernel.lmask[i]));
+        symbol_tsig    += std::string(bh_typesig_to_shorthand(block.tsig[i]));
+        symbol_lmask   += std::string(bh_layoutmask_to_shorthand(block.lmask[i]));

-        int ndim = kernel.scope[tac->out].ndim;
+        int ndim = block.scope[tac->out].ndim;
         if (tac->op == REDUCE) {
-            ndim = kernel.scope[tac->in1].ndim;
+            ndim = block.scope[tac->in1].ndim;
         }
         if (optimized && (ndim <= 3)) {        // Optimized
             symbol_ndim += std::to_string(ndim);
@@ -253,12 +253,12 @@
         }
         symbol_ndim += "D";

-        kernel.tsig[i]  = tsig;
-        kernel.lmask[i] = lmask;
-    }
-
-    if (kernel.omask == (HAS_ARRAY_OP)) {
-        kernel.symbol = "BH_" + \
+        block.tsig[i]  = tsig;
+        block.lmask[i] = lmask;
+    }
+
+    if (block.omask == (HAS_ARRAY_OP)) {
+        block.symbol = "BH_" + \
                         symbol_opcode  + "_" +\
                         symbol_tsig    + "_" +\
                         symbol_lmask   + "_" +\


A quick fix for Issue 16597.
Our autofill code handles keyboard events by itself and it prevents dispatch a return key to WebKit when the key is comsumed by the autofill. Unfortunately, this code is enclosed with "#if defined(OS_WIN)" and "#endif". This change just activates this code on Linux.

BUG=16597 "Prevents submitting a form when pressing a return key in an auto-fill popup"
TEST=Type a return key on an auto-fill popup and verify this is not submitted.
Review URL: http://codereview.chromium.org/149517

git-svn-id: http://src.chromium.org/svn/trunk/src@20612 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

Former-commit-id: 32b4e49426039274036f3d59314a7c5cdacb18a1

--- webkit/glue/webview_impl.cc
+++ webkit/glue/webview_impl.cc
@@ -669,7 +669,7 @@
     return false;

   if (autocomplete_popup_->handleKeyEvent(MakePlatformKeyboardEvent(event))) {
-#if defined(OS_WIN)
+#if defined(OS_WIN) || defined(OS_LINUX)
       // We need to ignore the next Char event after this otherwise pressing
       // enter when selecting an item in the menu will go to the page.
       if (WebInputEvent::RawKeyDown == event.type)


lib/game/gfx/renderer/opengl: debug log stage sources.

--- lib/game/src/togo/game/gfx/renderer/opengl.ipp
+++ lib/game/src/togo/game/gfx/renderer/opengl.ipp
@@ -643,9 +643,16 @@
 		// Join sources
 		fixed_array::resize(sources, 1);
 		fixed_array::resize(sources_size, 1);
+		unsigned stage_index = 1;
 		for (StringRef const& stage_source : stage.sources) {
 			fixed_array::push_back(sources, stage_source.data);
 			fixed_array::push_back(sources_size, signed_cast(stage_source.size));
+			TOGO_LOG_DEBUGF(
+				"GL shader source stage %u: ```%.*s```\n",
+				stage_index,
+				stage_source.size, stage_source.data
+			);
+			++stage_index;
 		}

 		// Create GL shader


Throw an informative exception when parsing enum constant fails.

--- src/formast/lib/parse.cpp
+++ src/formast/lib/parse.cpp
@@ -404,7 +404,11 @@
                 if (option.first == "option") {
                     EnumConst const_;
                     const_.name = option.second.get<std::string>("<xmlattr>.name");
-                    const_.value = option.second.get<boost::int64_t>("<xmlattr>.value");
+                    try {
+                        const_.value = option.second.get<boost::int64_t>("<xmlattr>.value");
+                    } catch (boost::property_tree::ptree_bad_data const & e) {
+                        throw std::runtime_error("could not convert enum constant " + option.second.get<std::string>("<xmlattr>.value") + " to integer");
+                    }
                     std::string doc = option.second.data();
                     boost::algorithm::trim(doc);
                     if (!doc.empty()) {


lib/game/world/world_manager: use push_back_inplace() instead of placement-new.

--- lib/game/src/togo/game/world/world_manager.cpp
+++ lib/game/src/togo/game/world/world_manager.cpp
@@ -91,9 +91,7 @@
 		queue::pop_front(wm._free_indices);
 	} else {
 		index = array::size(wm._instances);
-		array::increase_size(wm._instances, 1);
-		auto& instance = array::back(wm._instances);
-		new(&instance) WorldInstance(*wm._instances._allocator);
+		auto& instance = array::push_back_inplace(wm._instances, *wm._instances._allocator);
 		hash_map::reserve(
 			instance.component_managers,
 			hash_map::size(wm._component_manager_defs)


Add AutoPacket successor satisfaction test

--- src/autowiring/test/AutoFilterSequencing.cpp
+++ src/autowiring/test/AutoFilterSequencing.cpp
@@ -97,14 +97,33 @@

 TEST_F(AutoFilterSequencing, ManySuccessors) {
   AutoRequired<AutoPacketFactory> factory;
+  {
+    auto packetA = factory->NewPacket();
+    auto packet5 = packetA->Successor()->Successor()->Successor()->Successor();
+
+    factory->NewPacket();
+    factory->NewPacket();
+    factory->NewPacket();
+    auto packetE = factory->NewPacket();

-  auto packetA = factory->NewPacket();
-  auto packet5 = packetA->Successor()->Successor()->Successor()->Successor();
+    ASSERT_EQ(packet5, packetE) << "Successor packet obtained after generation from the factory did not match as expected";
+  }

-  auto packetB = factory->NewPacket();
-  auto packetC = factory->NewPacket();
-  auto packetD = factory->NewPacket();
-  auto packetE = factory->NewPacket();
-
-  ASSERT_EQ(packet5, packetE) << "Successor packet obtained after generation from the factory did not match as expected";
+  AutoRequired<FilterFirst> first;
+  {
+    auto packetA = factory->NewPacket();
+    packetA->Successor()->Successor()->Successor()->Successor();
+    ASSERT_EQ(1, first->m_called) << "AutoFilter triggered from successor";
+
+    factory->NewPacket();
+    ASSERT_EQ(2, first->m_called) << "AutoFilter not triggered from new packet";
+    factory->NewPacket();
+    ASSERT_EQ(3, first->m_called) << "AutoFilter not triggered from new packet";
+    factory->NewPacket();
+    ASSERT_EQ(4, first->m_called) << "AutoFilter not triggered from new packet";
+    factory->NewPacket();
+    ASSERT_EQ(5, first->m_called) << "AutoFilter not triggered from new packet";
+    factory->NewPacket();
+    ASSERT_EQ(6, first->m_called) << "AutoFilter not triggered from new packet";
+  }
 }


index scan handles empty scan keys

index scan handles empty scan keys

Former-commit-id: 94950595d5b99e61fc718d77117feb0119ad7ac2

--- src/backend/executor/index_scan_executor.cpp
+++ src/backend/executor/index_scan_executor.cpp
@@ -121,7 +121,11 @@

   std::vector<ItemPointer> tuple_locations;

-  tuple_locations = index_->Scan(values_, key_column_ids_, expr_types_);
+  if (0 == key_column_ids_.size()) {
+    tuple_locations = index_->Scan();
+  } else {
+    tuple_locations = index_->Scan(values_, key_column_ids_, expr_types_);
+  }

   LOG_INFO("Tuple locations : %lu", tuple_locations.size());


remove unused variable in findCorners_caller()

--- modules/ocl/src/gftt.cpp
+++ modules/ocl/src/gftt.cpp
@@ -110,7 +110,6 @@
     oclMat&         counter)        //output value with number of detected corners, have to be 0 before call
 {
     string  opt;
-    std::vector<int> k;
     Context * cxt = Context::getContext();

     std::vector< std::pair<size_t, const void*> > args;


No tagged INPUT/OUTPUT, says Werner

No tagged INPUT/OUTPUT, says Werner

svn path=/branches/work/kdab-post-4.0/kdepim/; revision=711642

--- kleopatra/uiserver/assuanserverconnection.cpp
+++ kleopatra/uiserver/assuanserverconnection.cpp
@@ -197,20 +197,18 @@
     }

     // format: INPUT TAG([N])? (FD|FD=\d+|FILE=...)
-    static int IO_handler( assuan_context_t ctx_, char * line_, bool in ) {
+    static int IO_handler( assuan_context_t ctx_, char * line_, bool in, const char * tag ) {
         assert( assuan_get_pointer( ctx_ ) );
         AssuanServerConnection::Private & conn = *static_cast<AssuanServerConnection::Private*>( assuan_get_pointer( ctx_ ) );

         try {

             const std::vector<std::string> parsed = parse_commandline( line_ );
-            if ( parsed.size() < 2 || parsed.size() > 3 )
+            if ( parsed.size() < 1 || parsed.size() > 2 )
                 throw gpg_error( GPG_ERR_ASS_SYNTAX );

-            const std::string tag = parsed[0];
-
             IO io;
-            const std::string source = parsed[1];
+            const std::string source = parsed[0];
             if ( source == "FD" ) {
                 assuan_fd_t fd = ASSUAN_INVALID_FD;
                 if ( const gpg_error_t err = assuan_receivefd( conn.ctx.get(), &fd ) )
@@ -237,13 +235,13 @@
             } else
                 throw gpg_error( GPG_ERR_ASS_PARAMETER );

-            if ( parsed.size() < 3 )
+            if ( parsed.size() < 2 )
                 io.encoding = GpgME::Data::AutoEncoding;
-            else if ( parsed[2] == "--binary" )
+            else if ( parsed[1] == "--binary" )
                 io.encoding = GpgME::Data::BinaryEncoding;
-            else if ( parsed[2] == "--armor" )
+            else if ( parsed[1] == "--armor" )
                 io.encoding = GpgME::Data::ArmorEncoding;
-            else if ( parsed[2] == "--base64" )
+            else if ( parsed[1] == "--base64" )
                 io.encoding = GpgME::Data::Base64Encoding;
             else
                 throw gpg_error( GPG_ERR_ASS_PARAMETER );
@@ -266,11 +264,15 @@
     }

     static int input_handler( assuan_context_t ctx, char * line ) {
-        return IO_handler( ctx, line, true );
+        return IO_handler( ctx, line, true, "INPUT" );
     }

     static int output_handler( assuan_context_t ctx, char * line ) {
-        return IO_handler( ctx, line, false );
+        return IO_handler( ctx, line, false, "OUTPUT" );
+    }
+
+    static int message_handler( assuan_context_t ctx, char * line ) {
+        return IO_handler( ctx, line, true, "MESSAGE" );
     }

     void cleanup();


BUG: This hack is no longer useful.

BUG: This hack is no longer useful.

--- Graphics/Testing/Cxx/TestHyperOctreeDual.cxx
+++ Graphics/Testing/Cxx/TestHyperOctreeDual.cxx
@@ -148,18 +148,12 @@
   writer2d->Delete();
 #endif // #ifdef WRITE_RESULT

-  // Contour using data set API.
-  vtkHyperOctreeFractalSource* source3dHack = vtkHyperOctreeFractalSource::New();
-  source3dHack->SetMaximumNumberOfIterations(17);
-  source3dHack->SetMaximumLevel(7);
-  source3dHack->SetMinimumLevel(3);
-
   vtkContourFilter *contourDS=vtkContourFilter::New();
   contourDS->SetNumberOfContours(2);
   contourDS->SetValue(0,4.5);
   contourDS->SetValue(1,10.5);

-  contourDS->SetInputConnection(0,source3dHack->GetOutputPort(0));
+  contourDS->SetInputConnection(0,source3d->GetOutputPort(0));
   cout<<"update contour data set..."<<endl;
   timer->StartTimer();
   contourDS->Update(); // Update now, make things easier with a debugger
@@ -217,7 +211,6 @@
   actorDS->Delete();

   source3d->Delete();
-  source3dHack->Delete();
   contour3d->Delete();
   mapper3d->Delete();
   actor3d->Delete();


Apply astyle formatting to egs_kerma source code

--- HEN_HOUSE/user_codes/egs_kerma/egs_kerma.cpp
+++ HEN_HOUSE/user_codes/egs_kerma/egs_kerma.cpp
@@ -113,36 +113,55 @@
     EGS_KermaApplication(int argc, char **argv) :
         EGS_AdvancedApplication(argc,argv), ngeom(0),
         kerma(0), kerma_r(0), scg(0), fd_geom(0),
-        ncg(0), flug(0),flugT(0)
-    {
+        ncg(0), flug(0),flugT(0) {
         Eave=0.0;
     };

     /*! Destructor.  */
     ~EGS_KermaApplication() {
-        if( ngeom > 0 ) {
-            if( kerma_r ) {
-                for(int j=0; j<ngeom; j++) if (kerma_r[j]) delete kerma_r[j];
-                if(kerma_r) delete [] kerma_r;
-                if( kerma ) delete kerma;
-            }
-            if( flug ) {
-                for(int j=0; j<ngeom; j++) if (flug[j]) delete flug[j];
-                if(flug) delete [] flug;
-                if( flugT ) delete flugT;
+        if (ngeom > 0) {
+            if (kerma_r) {
+                for (int j=0; j<ngeom; j++) if (kerma_r[j]) {
+                        delete kerma_r[j];
+                    }
+                if (kerma_r) {
+                    delete [] kerma_r;
+                }
+                if (kerma) {
+                    delete kerma;
+                }
+            }
+            if (flug) {
+                for (int j=0; j<ngeom; j++) if (flug[j]) {
+                        delete flug[j];
+                    }
+                if (flug) {
+                    delete [] flug;
+                }
+                if (flugT) {
+                    delete flugT;
+                }
             }
             delete [] geoms;
             delete [] fd_geoms;
             delete [] mass;
             int j;
-            for(j=0; j<ngeom; j++) if( transforms[j] ) delete transforms[j];
-            if (transforms) delete [] transforms;
-            for(j=0; j<ngeom; j++) delete [] is_sensitive[j];
+            for (j=0; j<ngeom; j++) if (transforms[j]) {
+                    delete transforms[j];
+                }
+            if (transforms) {
+                delete [] transforms;
+            }
+            for (j=0; j<ngeom; j++) {
+                delete [] is_sensitive[j];
+            }
             delete [] is_sensitive;
-            for(j=0; j<ngeom; j++) delete [] is_excluded[j];
+            for (j=0; j<ngeom; j++) {
+                delete [] is_excluded[j];
+            }
             delete [] is_excluded;
         }
-        if( ncg > 0 ) {
+        if (ncg > 0) {
             delete [] gind1;
             delete [] gind2;
             delete [] scg;
@@ -175,29 +194,29 @@
     int ausgab(int iarg) {
         int np = the_stack->np-1, ir = the_stack->ir[np]-2, iq = the_stack->iq[np];
         /* Photon about to be transported in geometry */
-        if( iarg == BeforeTransport &&  !iq && ir >= 0 )
-        {
+        if (iarg == BeforeTransport &&  !iq && ir >= 0) {
             int latch = the_stack->latch[np];
             /* Track-Length Kerma scoring (classic) */
-            if( is_sensitive[ig][ir] ) {
-                if( !fd_geom && latch >= 0 ) {
+            if (is_sensitive[ig][ir]) {
+                if (!fd_geom && latch >= 0) {
                     EGS_Float E = the_stack->E[np], gle = log(E),
                               emuen   = E_Muen_Rho->interpolateFast(gle)*rho_cv[ig],
                               wtstep  = the_stack->wt[np]*the_epcont->tvstep;
                     kerma->score(ig,wtstep*emuen);
-                    if (kerma_r[ig])
+                    if (kerma_r[ig]) {
                         kerma_r[ig]->score(ir,wtstep*emuen);
+                    }
                     //--------------------------------------------
                     // score photon fluence
                     //--------------------------------------------
-                    if( flug ) {
+                    if (flug) {
                         EGS_Float e = E;
-                        if( flu_s ) {
+                        if (flu_s) {
                             e = log(e);
                         }
                         EGS_Float ae;
                         int je;
-                        if( e > flu_xmin && e <= flu_xmax) {
+                        if (e > flu_xmin && e <= flu_xmax) {
                             ae = flu_a*e + flu_b;
                             je = min((int)ae,flu_nbin-1);//je = (int) ae;
                             EGS_ScoringArray *aux = flug[ig];
@@ -210,11 +229,13 @@
                 latch = 1;
             }
             /* Mark photons in exclusion regions */
-            else if( is_excluded[ig][ir] )
+            else if (is_excluded[ig][ir]) {
                 latch = -1;
+            }
             /* photon outside cavity and has not been in any exclusion zone */
-            else if (latch >= 0)
+            else if (latch >= 0) {
                 latch = 0;
+            }

             the_stack->latch[np] = latch;
         }
@@ -231,32 +252,38 @@
         Eave += p.E;

         int err = startNewShower();
-        if( err ) return err;
+        if (err) {
+            return err;
+        }
         EGS_BaseGeometry *save_geometry = geometry;
-        for(ig=0; ig<ngeom; ig++) {
+        for (ig=0; ig<ngeom; ig++) {
             geometry = geoms[ig];
-            if ( fd_geoms[ig] ){
-               fd_geom = fd_geoms[ig];
+            if (fd_geoms[ig]) {
+                fd_geom = fd_geoms[ig];
             }
             else {
-               fd_geom = 0;
+                fd_geom = 0;
             }
             p.x = x;
             p.u = u;
-            if( transforms[ig] ) {
+            if (transforms[ig]) {
                 transforms[ig]->transform(p.x);
                 transforms[ig]->rotate(p.u);
             }
             int ireg = geometry->isWhere(p.x);
-            if( ireg < 0 ) {
+            if (ireg < 0) {
                 EGS_Float t = 1e30;
                 ireg = geometry->howfar(ireg,p.x,p.u,t);
-                if( ireg >= 0 ) p.x += p.u*t;
-            }
-            if( ireg >= 0 ) {
+                if (ireg >= 0) {
+                    p.x += p.u*t;
+                }
+            }
+            if (ireg >= 0) {
                 p.ir = ireg;
                 err = shower();
-                if( err ) return err;
+                if (err) {
+                    return err;
+                }
             }
         }
         err = finishShower();
@@ -284,7 +311,9 @@

         int np = the_stack->np-1;

-        if( the_stack->E[np] < the_bounds->pcut ) return 0;
+        if (the_stack->E[np] < the_bounds->pcut) {
+            return 0;
+        }

         EGS_Vector x(the_stack->x[np],the_stack->y[np],the_stack->z[np]);
         EGS_Vector u(the_stack->u[np],the_stack->v[np],the_stack->w[np]);
@@ -304,19 +333,22 @@
         /* Ray-trace from current position to CV and keep track of path to
          * CV and path in the CV
          */
-        while( navigating ){
-            while(1) {
-                if (is_excluded[ig][ireg]) break;
-                if( imed != newmed ) {
+        while (navigating) {
+            while (1) {
+                if (is_excluded[ig][ireg]) {
+                    break;
+                }
+                if (imed != newmed) {
                     imed = newmed;
-                    if( imed >= 0 ) {
+                    if (imed >= 0) {
                         gmfp = i_gmfp[imed].interpolateFast(gle);
-                        if( the_xoptions->iraylr ) {
+                        if (the_xoptions->iraylr) {
                             cohfac = i_cohe[imed].interpolateFast(gle);
                             gmfp *= cohfac;
                         }
                         sigma = 1/gmfp;
-                    } else {
+                    }
+                    else {
                         sigma = 0;
                         cohfac = 1;
                     }
@@ -326,7 +358,7 @@

                 Lambda += tstep*sigma;// keep track of path outside scoring volume

-                if ( is_sensitive[ig][ireg] ) { //in cavity, get path through it
+                if (is_sensitive[ig][ireg]) {   //in cavity, get path through it
                     ir_sc[n_ir_sc]  = ireg;
                     t_sc[n_ir_sc]   = tstep;
                     t_sc_tot       += tstep;
@@ -339,19 +371,20 @@
                     Lambda = Lambda - tstep*sigma;
                 }

-                if( inew < 0 ) break; // outside geometry, stop and score
+                if (inew < 0) {
+                    break;    // outside geometry, stop and score
+                }

                 ireg = inew;
                 x += u*tstep;

                 // Leaves CV?
-                if ( inside_cv && !is_sensitive[ig][ireg] )
-                {
+                if (inside_cv && !is_sensitive[ig][ireg]) {
                     // Does it re-enter CV?
                     tstep = TSTEP_MAX;
-                    if ( fd_geom->isInside(x) ||
-                         fd_geom->howfar(-1,x,u,tstep,&newmed)>= 0 ){
-                       re_enters_cv = true;
+                    if (fd_geom->isInside(x) ||
+                            fd_geom->howfar(-1,x,u,tstep,&newmed)>= 0) {
+                        re_enters_cv = true;
                     }
                     break;
                 }
@@ -363,7 +396,7 @@
                           exp_Lambda = exp_Lambda_to_CV,
                           exp_CV     = 1.0,
                           exp_Att, edepCV;
-                for (int i = 0; i < n_ir_sc; i++){
+                for (int i = 0; i < n_ir_sc; i++) {
                     edepCV     = emuen_rho*rho_cv[ig];// Data base contains E_muen/rho values
                     exp_CV     = exp(-mu_cv*t_sc[i]);
                     exp_Att    = exp_Lambda*(1-exp_CV)/mu_cv;//Attenuation in scoring region
@@ -371,23 +404,24 @@
                     //--------------------------------------------
                     // score kerma in scoring region
                     //--------------------------------------------
-                    if (kerma_r[ig])
+                    if (kerma_r[ig]) {
                         kerma_r[ig]->score(ir_sc[i],wt*edepCV);
+                    }
                     //--------------------------------------------
                     // score photon fluence
                     //--------------------------------------------
-                    if( flug ) {
+                    if (flug) {
                         EGS_Float e = the_stack->E[np];
-                        if( flu_s ) {
+                        if (flu_s) {
                             e = log(e);
                         }
                         EGS_Float ae;
                         int je;
-                        if( e > flu_xmin && e <= flu_xmax) {
+                        if (e > flu_xmin && e <= flu_xmax) {
                             ae = flu_a*e + flu_b;
                             je = min((int)ae,flu_nbin-1);
                             EGS_ScoringArray *aux = flug[ig];
-                            aux->score(  je,wt*exp_Att);
+                            aux->score(je,wt*exp_Att);
                         }
                     }
                     // Include as attenuation to next scoring region
@@ -401,20 +435,23 @@
                 exp_Att    = exp_Lambda_to_CV*(1-exp_CV)/mu_cv;
                 edepCV    *= exp_Att;
                 kerma->score(ig,wt*edepCV);
-                if( flug ) {
-                   flugT->score(ig,wt*exp_Att);
+                if (flug) {
+                    flugT->score(ig,wt*exp_Att);
                 }
                 // Ray-tracing continues
-                if (re_enters_cv){
-                    wt_att *= exp_Lambda; Lambda_to_CV = 0;
-                    Lambda = 0; t_sc_tot = 0; n_ir_sc = 0;
+                if (re_enters_cv) {
+                    wt_att *= exp_Lambda;
+                    Lambda_to_CV = 0;
+                    Lambda = 0;
+                    t_sc_tot = 0;
+                    n_ir_sc = 0;
                     inside_cv = false;
                 }
-                else{
+                else {
                     navigating = false;
                 }
             }
-            else{
+            else {
                 navigating = false;
             }
         }
@@ -425,29 +462,43 @@
     /*! Output intermediate results to the .egsdat file. */
     int outputData() {
         int err = EGS_AdvancedApplication::outputData();
-        if( err ) return err;
-        if( !kerma->storeState(*data_out) ) return 101;
-        for(int j=0; j<ngeom; j++) {
-            if( kerma_r[j] && !kerma_r[j]->storeState(*data_out) ) return 108+2*j;
-        }
-        if( ncg > 0 ) {
-            for(int j=0; j<ncg; j++) {
+        if (err) {
+            return err;
+        }
+        if (!kerma->storeState(*data_out)) {
+            return 101;
+        }
+        for (int j=0; j<ngeom; j++) {
+            if (kerma_r[j] && !kerma_r[j]->storeState(*data_out)) {
+                return 108+2*j;
+            }
+        }
+        if (ncg > 0) {
+            for (int j=0; j<ncg; j++) {
                 double aux = kerma->thisHistoryScore(gind1[j])*
                              kerma->thisHistoryScore(gind2[j]);
                 (*data_out) << scg[j]+aux << "  ";
             }
             (*data_out) << endl;
-            if( !data_out->good() ) return 104;
-        }
-        if( flug ) {
-            for(int j=0; j<ngeom; j++) {
-                if( !flug[j]->storeState(*data_out) ) return 108+2*(ngeom+j);
-            }
-            if( !flugT->storeState(*data_out) ) return 109+4*ngeom;
+            if (!data_out->good()) {
+                return 104;
+            }
+        }
+        if (flug) {
+            for (int j=0; j<ngeom; j++) {
+                if (!flug[j]->storeState(*data_out)) {
+                    return 108+2*(ngeom+j);
+                }
+            }
+            if (!flugT->storeState(*data_out)) {
+                return 109+4*ngeom;
+            }
         }

         (*data_out) << Eave << endl;
-        if( !data_out->good() ) return 1031;
+        if (!data_out->good()) {
+            return 1031;
+        }

         data_out->flush();
         delete data_out;
@@ -458,24 +509,40 @@
     /*! Read results from a .egsdat file. */
     int readData() {
         int err = EGS_AdvancedApplication::readData();
-        if( err ) return err;
-        if( !kerma->setState(*data_in) ) return 101;
-        for(int j=0; j<ngeom; j++) {
-            if( kerma_r[j] && !kerma_r[j]->setState(*data_in) ) return 108+2*j;
-        }
-        if( ncg > 0 ) {
-            for(int j=0; j<ncg; j++) (*data_in) >> scg[j];
-            if( !data_in->good() ) return 104;
-        }
-        if( flug ) {
-            for(int j=0; j<ngeom; j++) {
-                if( !flug[j]->setState(*data_in) ) return 108+2*(ngeom+j);
-            }
-            if( !flugT->setState(*data_in) ) return 109+4*ngeom;
+        if (err) {
+            return err;
+        }
+        if (!kerma->setState(*data_in)) {
+            return 101;
+        }
+        for (int j=0; j<ngeom; j++) {
+            if (kerma_r[j] && !kerma_r[j]->setState(*data_in)) {
+                return 108+2*j;
+            }
+        }
+        if (ncg > 0) {
+            for (int j=0; j<ncg; j++) {
+                (*data_in) >> scg[j];
+            }
+            if (!data_in->good()) {
+                return 104;
+            }
+        }
+        if (flug) {
+            for (int j=0; j<ngeom; j++) {
+                if (!flug[j]->setState(*data_in)) {
+                    return 108+2*(ngeom+j);
+                }
+            }
+            if (!flugT->setState(*data_in)) {
+                return 109+4*ngeom;
+            }
         }

         (*data_in) >> Eave;
-        if( !data_in->good() ) return 1031;
+        if (!data_in->good()) {
+            return 1031;
+        }

         return 0;
     };
@@ -484,14 +551,18 @@
     void resetCounter() {
         EGS_AdvancedApplication::resetCounter();
         kerma->reset();
-        for(int j=0; j<ngeom; j++) {
-            if (kerma_r[j]) kerma_r[j]->reset();
-        }
-        if( ncg > 0 ) {
-            for(int j=0; j<ncg; j++) scg[j] = 0;
-        }
-        if( flug ) {
-            for(int j=0; j<ngeom; j++) {
+        for (int j=0; j<ngeom; j++) {
+            if (kerma_r[j]) {
+                kerma_r[j]->reset();
+            }
+        }
+        if (ncg > 0) {
+            for (int j=0; j<ncg; j++) {
+                scg[j] = 0;
+            }
+        }
+        if (flug) {
+            for (int j=0; j<ngeom; j++) {
                 flug[j]->reset();
             }
             flugT->reset();
@@ -502,39 +573,53 @@
     /*! Add simulation results */
     int addState(istream &data) {
         int err = EGS_AdvancedApplication::addState(data);
-        if( err ) return err;
+        if (err) {
+            return err;
+        }
         EGS_ScoringArray ktmp(ngeom);
-        if( !ktmp.setState(data) ) return 101;
+        if (!ktmp.setState(data)) {
+            return 101;
+        }
         (*kerma) += ktmp;
-        for(int j=0; j<ngeom; j++) {
-            if (kerma_r[j]){
-               EGS_ScoringArray ktmp_r(kerma_r[j]->regions());
-               if( !ktmp_r.setState(data) ) return 108+2*j;
-               (*kerma_r[j]) += ktmp_r;
-            }
-        }
-        if( ncg > 0 ) {
-            for(int j=0; j<ncg; j++) {
+        for (int j=0; j<ngeom; j++) {
+            if (kerma_r[j]) {
+                EGS_ScoringArray ktmp_r(kerma_r[j]->regions());
+                if (!ktmp_r.setState(data)) {
+                    return 108+2*j;
+                }
+                (*kerma_r[j]) += ktmp_r;
+            }
+        }
+        if (ncg > 0) {
+            for (int j=0; j<ncg; j++) {
                 double tmp;
                 data >> tmp;
-                if( !data.good() ) return 104;
+                if (!data.good()) {
+                    return 104;
+                }
                 scg[j] += tmp;
             }
         }
-        if( flug ) {
+        if (flug) {
             EGS_ScoringArray tg(flu_nbin);
-            for(int j=0; j<ngeom; j++) {
-                if( !tg.setState(data) ) return 108+2*(ngeom+j);
+            for (int j=0; j<ngeom; j++) {
+                if (!tg.setState(data)) {
+                    return 108+2*(ngeom+j);
+                }
                 (*flug[j]) += tg;
             }
             EGS_ScoringArray tgT(ngeom);
-            if( !tgT.setState(data) ) return 109+4*ngeom;
+            if (!tgT.setState(data)) {
+                return 109+4*ngeom;
+            }
             (*flugT) += tgT;
         }

         EGS_Float aux_Eave;
         data >> aux_Eave;
-        if( !data.good() ) return 1036;
+        if (!data.good()) {
+            return 1036;
+        }
         Eave += aux_Eave;

         return 0;
@@ -549,8 +634,8 @@

         outputKermaResults();

-        if( flug ) {
-          outputFluenceResults();
+        if (flug) {
+            outputFluenceResults();
         }

     };
@@ -563,7 +648,7 @@
         EGS_Float F = getFluence();
         /* Normalize to actual source fluence */
         EGS_Float normE = current_case/F,
-                 MeVtoJ = 1.6021773e-10, // Pure energy conversion
+                  MeVtoJ = 1.6021773e-10, // Pure energy conversion
                   normD = MeVtoJ*normE;
         int irmax_digits = getDigits(max_sc_reg),
             max_medl     = getMaxMedLength();
@@ -574,82 +659,91 @@
         EGS_Float rho = -1.0, m = -1.0;
         int imed = -1, nreg = 0;
         /* Compute deposited energy and dose */
-        for(int j=0; j<ngeom; j++) {
-           if (normE==1) {
-               egsInformation("\n\n==> Calculation summary (per particle) in geometry: %s\n",
-                              geoms[j]->getName().c_str());
-               egsInformation(
-                   "  %*s      m/g        Edep/[MeV]                   K/[Gy]            %n\n",
-                   irmax_digits,"ir",&count);
-           }
-           else {
-               egsInformation("\n==> Calculation summary (per fluence) in geometry: %s\n",
-                              geoms[j]->getName().c_str());
-               egsInformation(
-                   "  %*s      m/g      Edep/[MeV*cm2]                 K/[Gy*cm2]         %n\n",
-                   irmax_digits,"ir",&count);
-           }
-           line.append(count,'-');
-           egsInformation("  %s\n",line.c_str());
-           if (kerma_r[j]){
-              nreg = geoms[j]->regions();
-              for (int ir = 0; ir < nreg; ir++) {
-                  if (is_sensitive[j][ir]) {
-                      imed     = getMedium(ir);
-                      rho      = getMediumRho(imed);
-                      med_name = getMediumName(imed);
-                      m = mass[j][ir];
-                      kerma_r[j]->currentResult(ir,r,dr);
-                      if (r > 0) {
-                          dr = dr/r;
-                          if (dr < kermaEpsilon) dr = 1.0;
-                      }
-                      else {
-                          dr=1.0;
-                      }
-                      egsInformation("  %*d  %8.4f %12.6e +/- %-8.4f%% %12.6e +/- %-8.4f%%\n",
-                                     irmax_digits,ir,m,r*normE,dr*100.,r*normD/m,dr*100.);
-                  }
-              }
-              egsInformation("  %s\n",line.c_str());
-           }
-           kerma->currentResult(j,r,dr);
-           if (r > 0) {
-               dr = dr/r;
-               if (dr < kermaEpsilon) dr = 1.0;
-           }
-           else {
-               dr=1.0;
-           }
-           egsInformation("  Total: %8.4f %12.6e +/- %-8.4f%% %12.6e +/- %-8.4f%%\n",
-                          mass_cv[j],r*normE,dr*100.,r*normD/mass_cv[j],dr*100.);
-           egsInformation("  %s\n",line.c_str());
-           count = 0; line.clear();// reset line
+        for (int j=0; j<ngeom; j++) {
+            if (normE==1) {
+                egsInformation("\n\n==> Calculation summary (per particle) in geometry: %s\n",
+                               geoms[j]->getName().c_str());
+                egsInformation(
+                    "  %*s      m/g        Edep/[MeV]                   K/[Gy]            %n\n",
+                    irmax_digits,"ir",&count);
+            }
+            else {
+                egsInformation("\n==> Calculation summary (per fluence) in geometry: %s\n",
+                               geoms[j]->getName().c_str());
+                egsInformation(
+                    "  %*s      m/g      Edep/[MeV*cm2]                 K/[Gy*cm2]         %n\n",
+                    irmax_digits,"ir",&count);
+            }
+            line.append(count,'-');
+            egsInformation("  %s\n",line.c_str());
+            if (kerma_r[j]) {
+                nreg = geoms[j]->regions();
+                for (int ir = 0; ir < nreg; ir++) {
+                    if (is_sensitive[j][ir]) {
+                        imed     = getMedium(ir);
+                        rho      = getMediumRho(imed);
+                        med_name = getMediumName(imed);
+                        m = mass[j][ir];
+                        kerma_r[j]->currentResult(ir,r,dr);
+                        if (r > 0) {
+                            dr = dr/r;
+                            if (dr < kermaEpsilon) {
+                                dr = 1.0;
+                            }
+                        }
+                        else {
+                            dr=1.0;
+                        }
+                        egsInformation("  %*d  %8.4f %12.6e +/- %-8.4f%% %12.6e +/- %-8.4f%%\n",
+                                       irmax_digits,ir,m,r*normE,dr*100.,r*normD/m,dr*100.);
+                    }
+                }
+                egsInformation("  %s\n",line.c_str());
+            }
+            kerma->currentResult(j,r,dr);
+            if (r > 0) {
+                dr = dr/r;
+                if (dr < kermaEpsilon) {
+                    dr = 1.0;
+                }
+            }
+            else {
+                dr=1.0;
+            }
+            egsInformation("  Total: %8.4f %12.6e +/- %-8.4f%% %12.6e +/- %-8.4f%%\n",
+                           mass_cv[j],r*normE,dr*100.,r*normD/mass_cv[j],dr*100.);
+            egsInformation("  %s\n",line.c_str());
+            count = 0;
+            line.clear();// reset line
         }

         egsInformation("\n\n");
         /******************************************************************************/
         /* Print out Kerma ratio in the whole scoring volume of correlated geometries */
         /******************************************************************************/
-        if( ncg > 0 ) {
+        if (ncg > 0) {
             egsInformation("%-20s %-20s    KERMA ratio\n","Geometry 1", "Geometry 2");

-            for(int j=0; j<ncg; j++) {
+            for (int j=0; j<ncg; j++) {
                 double r1,dr1,r2,dr2;
                 kerma->currentResult(gind1[j],r1,dr1);
                 kerma->currentResult(gind2[j],r2,dr2);
-                if( r1 > 0 && r2 > 0 ) {
+                if (r1 > 0 && r2 > 0) {
                     double rc=(scg[j]/(r1*r2*current_case)-1)/(current_case-1);
                     dr1 /= r1;
                     dr2 /= r2;
                     double dr = dr1*dr1 + dr2*dr2 - 2*rc;
-                    if( dr > 0 ) dr = sqrt(dr);
+                    if (dr > 0) {
+                        dr = sqrt(dr);
+                    }
                     double r = r1*mass_cv[gind2[j]]/(r2*mass_cv[gind1[j]]);
                     egsInformation("%-20s %-20s     %-11.8lg +/- %-10.8lg [%-10.6lf%%]\n",
                                    geoms[gind1[j]]->getName().c_str(),
                                    geoms[gind2[j]]->getName().c_str(),r,r*dr,100.*dr);
                 }
-                else egsInformation("zero dose\n");
+                else {
+                    egsInformation("zero dose\n");
+                }
             }

         }
@@ -680,7 +774,7 @@
         spe_output << "@    subtitle size 1.000000\n";
         egsInformation("\n\nPhoton fluence\n"
                        "=============================\n");
-        for(int j=0; j<ngeom; j++) {
+        for (int j=0; j<ngeom; j++) {
             double norm = current_case/source->getFluence();//per particle
             norm /= (mass_cv[j]/rho_cv[j]);               //per unit volume
             norm *= flu_a;                           //per unit bin width
@@ -692,17 +786,23 @@
             spe_output<<"@type xydy\n";
             double fe,dfe,fp,dfp;
             flugT->currentResult(j,fe,dfe);
-            if( fe > 0 ) dfe = 100*dfe/fe;
-            else dfe = 100;
+            if (fe > 0) {
+                dfe = 100*dfe/fe;
+            }
+            else {
+                dfe = 100;
+            }
             egsInformation(" total fluence [cm-2] = %10.4le +/- %-7.3lf\%\n\n",
                            fe*norm/flu_a,dfe);
             egsInformation("   Emid/MeV    Flu/(MeV*cm2)   DFlu/(MeV*cm2)\n"
                            "---------------------------------------------\n");
-            for(int i=0; i<flu_nbin; i++) {
+            for (int i=0; i<flu_nbin; i++) {
                 flug[j]->currentResult(i,fe,dfe);
                 EGS_Float e = (i+0.5-flu_b)/flu_a;
-                if( flu_s ) e = exp(e);
-                spe_output<<e<<" "<<fe*norm<<" "<<dfe*norm<< "\n";
+                if (flu_s) {
+                    e = exp(e);
+                }
+                spe_output<<e<<" "<<fe *norm<<" "<<dfe *norm<< "\n";
                 egsInformation("%11.6f  %14.6e  %14.6e\n",
                                e,fe*norm,dfe*norm);
             }
@@ -739,10 +839,12 @@
         double flu = source->getFluence(),
                mCV = kerma_r[0] ? mass[0][active_reg]:mass_cv[0];
         norm = flu > 0 ? 1.602e-10*count/(flu*mCV) : 0;
-        if (kerma_r[0])
-           kerma_r[0]->currentScore(active_reg,sum,sum2);
-        else
-           kerma->currentScore(0,sum,sum2);
+        if (kerma_r[0]) {
+            kerma_r[0]->currentScore(active_reg,sum,sum2);
+        }
+        else {
+            kerma->currentScore(0,sum,sum2);
+        }
     };

     /* Select photon mean-free-path */
@@ -760,11 +862,10 @@
         // region are also ray-traced.
         //******************************************************************
         //if ( fd_geom && !the_stack->latch[np] && // TAKES ONLY PRIMARIES!!!!
-        if ( fd_geom && the_stack->latch[np] >= 0 && // TAKES ALL PHOTONS !!!
-            (is_sensitive[ig][ireg] ||
-             fd_geom->howfar(-1,x,u,tstep,&newmed)>= 0 ||
-             fd_geom->isInside(x)) )
-        {
+        if (fd_geom && the_stack->latch[np] >= 0 &&  // TAKES ALL PHOTONS !!!
+                (is_sensitive[ig][ireg] ||
+                 fd_geom->howfar(-1,x,u,tstep,&newmed)>= 0 ||
+                 fd_geom->isInside(x))) {
             /* Photon at or aimed at cavity */
             int errK = scoreInCV();
         }
@@ -778,19 +879,23 @@
     /*! Start a new shower.  */
     int startNewShower() {
         int res = EGS_Application::startNewShower();
-        if( res ) return res;
-        if( current_case != last_case ) {
-            if( ncg > 0 ) {
-                for(int j=0; j<ncg; j++)
+        if (res) {
+            return res;
+        }
+        if (current_case != last_case) {
+            if (ncg > 0) {
+                for (int j=0; j<ncg; j++)
                     scg[j] += kerma->thisHistoryScore(gind1[j])*
                               kerma->thisHistoryScore(gind2[j]);
             }
             kerma->setHistory(current_case);
-            for(int j=0; j<ngeom; j++) {
-               if (kerma_r[j]) kerma_r[j]->setHistory(current_case);
-            }
-            if( flug ) {
-                for(int j=0; j<ngeom; j++) {
+            for (int j=0; j<ngeom; j++) {
+                if (kerma_r[j]) {
+                    kerma_r[j]->setHistory(current_case);
+                }
+            }
+            if (flug) {
+                for (int j=0; j<ngeom; j++) {
                     flug[j]->setHistory(current_case);
                 }
                 flugT->setHistory(current_case);
@@ -833,17 +938,17 @@
     /****************************************************************/

     EGS_ScoringArray **flug;    // photon fluence
-    EGS_ScoringArray * flugT;   // total photon fluence
+    EGS_ScoringArray *flugT;    // total photon fluence
     EGS_Float       flu_a,
                     flu_b,
                     flu_xmin,
                     flu_xmax;
     int             flu_s,
                     flu_nbin;
-    EGS_Float*      rho_cv;       // mass density of scoring volume
-    EGS_Float*      mass_cv;      // mass of scoring volume material
+    EGS_Float      *rho_cv;       // mass density of scoring volume
+    EGS_Float      *mass_cv;      // mass of scoring volume material
     EGS_Float       **mass;       // masses of the CV regions.
-    int*            n_scoring_r; // Number of scoring regions in geometry.
+    int            *n_scoring_r; // Number of scoring regions in geometry.
     int             max_sc_reg;  // Largest scoring region in all geometries
     int             active_reg;  // Scoring region in first geometry shown in progress

@@ -873,15 +978,15 @@
 F77_OBJ_(select_photon_mfp,SELECT_PHOTON_MFP)(EGS_Float *dpmfp) {
     EGS_Application *a = EGS_Application::activeApplication();
     EGS_KermaApplication *app = dynamic_cast<EGS_KermaApplication *>(a);
-    if( !app ) egsFatal("select_photon_mfp called with active application "
-                            " not being of type EGS_KermaApplication!\n");
+    if (!app) egsFatal("select_photon_mfp called with active application "
+                           " not being of type EGS_KermaApplication!\n");
     app->selectPhotonMFP(*dpmfp);
 }

 int EGS_KermaApplication::initScoring() {

     EGS_Input *options = input->takeInputItem("scoring options");
-    if( options ) {
+    if (options) {

         //
         // *********** calculation geometries
@@ -897,20 +1002,22 @@
         vector<EGS_AffineTransform *> transformations;
         EGS_Input *aux;
         EGS_BaseGeometry::setActiveGeometryList(app_index);
-        while( (aux = options->takeInputItem("calculation geometry")) ) {
+        while ((aux = options->takeInputItem("calculation geometry"))) {

             /* Handle deprecated inputs */

-            string dummy_name; vector<int> dummy_regs; EGS_Float dummy_mass;
+            string dummy_name;
+            vector<int> dummy_regs;
+            EGS_Float dummy_mass;
             int dummy_err = aux->getInput("cavity geometry",dummy_name);
             if (!dummy_err) egsFatal("initScoring: Using deprecated input key 'cavity geometry' \n"
-                                     "use 'FD geometry' instead!!!\n\n");
-                dummy_err = aux->getInput("cavity regions",dummy_regs);
+                                         "use 'FD geometry' instead!!!\n\n");
+            dummy_err = aux->getInput("cavity regions",dummy_regs);
             if (!dummy_err) egsFatal("initScoring: Using deprecated input key 'cavity regions' \n"
-                                     "use 'scoring regions' instead!!!\n\n");
-                dummy_err = aux->getInput("cavity mass",dummy_mass);
+                                         "use 'scoring regions' instead!!!\n\n");
+            dummy_err = aux->getInput("cavity mass",dummy_mass);
             if (!dummy_err) egsFatal("initScoring: Using deprecated input key 'cavity mass' \n"
-                                     "use 'scoring region masses' or 'scoring volume mass' instead!!!\n\n");
+                                         "use 'scoring region masses' or 'scoring volume mass' instead!!!\n\n");

             /* Process inputs */

@@ -924,56 +1031,59 @@
             vector<EGS_Float> cmass;
             int err2 = aux->getInput("scoring region masses",cmass);

-            if( err ) egsWarning("initScoring: missing/wrong 'geometry name' "
+            if (err) egsWarning("initScoring: missing/wrong 'geometry name' "
+                                    "input\n");
+            if (errc) {
+                cgname = "";//Set to empty, i.e., no FD geometry for this
+            }
+            if (err1) egsWarning("initScoring: missing/wrong 'scoring regions' "
                                      "input\n");
-            if (errc){
-               cgname = "";//Set to empty, i.e., no FD geometry for this
-            }
-            if( err1 ) egsWarning("initScoring: missing/wrong 'scoring regions' "
-                                      "input\n");
-            if( err2 ) {
+            if (err2) {
                 err2 = 0;
                 err2 = aux->getInput("scoring volume mass",cmass);
                 if (err2 || cmass.size() != 1)
-                   egsFatal("initScoring: missing/wrong 'scoring region masses'\n"
-                            "             or 'scoring volume mass' input\n");
-            }
-            else{// Warn user. Not needed above.
-              if (cav.size() != cmass.size()){
-                 if (cmass.size() == 1)
-                   egsWarning("\ninitScoring: Only one mass defined. Assuming it is the total mass!\n\n");
-                 else
-                   egsFatal("\n**************************************************************\n"
-                              "initScoring: Number of mass values must match number \n"
-                              "             of scoring regions unless defining total mass!\n"
-                              "**************************************************************\n");
-              }
-            }
-
-            if( err || err1 ) egsWarning("  --> input ignored\n");
+                    egsFatal("initScoring: missing/wrong 'scoring region masses'\n"
+                             "             or 'scoring volume mass' input\n");
+            }
+            else { // Warn user. Not needed above.
+                if (cav.size() != cmass.size()) {
+                    if (cmass.size() == 1) {
+                        egsWarning("\ninitScoring: Only one mass defined. Assuming it is the total mass!\n\n");
+                    }
+                    else
+                        egsFatal("\n**************************************************************\n"
+                                 "initScoring: Number of mass values must match number \n"
+                                 "             of scoring regions unless defining total mass!\n"
+                                 "**************************************************************\n");
+                }
+            }
+
+            if (err || err1) {
+                egsWarning("  --> input ignored\n");
+            }
             else {
                 EGS_BaseGeometry::setActiveGeometryList(app_index);
                 EGS_BaseGeometry *g = EGS_BaseGeometry::getGeometry(gname);
-                if( !g ) egsWarning("initScoring: no geometry named %s -->"
-                                        " input ignored\n",gname.c_str());
+                if (!g) egsWarning("initScoring: no geometry named %s -->"
+                                       " input ignored\n",gname.c_str());
                 else {
                     int nreg = g->regions();
                     int *regs = new int [cav.size()];
                     EGS_Float *m_g  = new EGS_Float [cmass.size()];
                     int ncav = 0;
-                    for(int j=0; j<cav.size(); j++) {
-                        if( cav[j] < 0 || cav[j] >= nreg )
+                    for (int j=0; j<cav.size(); j++) {
+                        if (cav[j] < 0 || cav[j] >= nreg)
                             egsWarning("initScoring: region %d is not within"
                                        " the allowed range of 0...%d -> input"
                                        " ignored\n",cav[j],nreg-1);
-                        else{
+                        else {
                             regs[ncav++] = cav[j];
                         }
                     }
-                    for(int j=0; j<cmass.size(); j++) {
-                       m_g[j] = cmass[j];
-                    }
-                    if( !ncav ) {
+                    for (int j=0; j<cmass.size(); j++) {
+                        m_g[j] = cmass[j];
+                    }
+                    if (!ncav) {
                         egsWarning("initScoring: no ensitive regions "
                                    "specified for geometry %s --> input ignored\n",
                                    gname.c_str());
@@ -990,11 +1100,11 @@
                         transformations.push_back(
                             EGS_AffineTransform::getTransformation(aux));
                         /* excluded regions */
-                        if( !err4 && apert.size() > 0 ) {
+                        if (!err4 && apert.size() > 0) {
                             int *ap = new int [apert.size()];
                             int nap=0;
-                            for(int j=0; j<apert.size(); j++) {
-                                if( apert[j] >= 0 && apert[j] < nreg ) {
+                            for (int j=0; j<apert.size(); j++) {
+                                if (apert[j] >= 0 && apert[j] < nreg) {
                                     ap[nap++] = apert[j];
                                 }
                                 else {
@@ -1018,7 +1128,7 @@
             delete aux;
         }
         ngeom = geometries.size();
-        if( !ngeom ) {
+        if (!ngeom) {
             egsWarning("initScoring: no calculation geometries defined\n");
             return 1;
         }
@@ -1036,15 +1146,15 @@

         max_sc_reg = -1, active_reg = INT_MAX;

-        for(int j=0; j<ngeom; j++) {
+        for (int j=0; j<ngeom; j++) {
             rho_cv[j] = -1;
             geoms[j] = geometries[j]; //geoms[j]->ref();
-            if (!fd_global_gs[j].empty()){
-               EGS_BaseGeometry::setActiveGeometryList(app_index);
-               fd_geoms[j] =  EGS_BaseGeometry::getGeometry(fd_global_gs[j]);
-            }
-            else{
-               fd_geoms[j] = 0;
+            if (!fd_global_gs[j].empty()) {
+                EGS_BaseGeometry::setActiveGeometryList(app_index);
+                fd_geoms[j] =  EGS_BaseGeometry::getGeometry(fd_global_gs[j]);
+            }
+            else {
+                fd_geoms[j] = 0;
             }
             transforms[j] = transformations[j];
             int nreg = geoms[j]->regions();
@@ -1052,65 +1162,73 @@
             is_excluded[j]  = new bool [nreg];
             int i;
             /* Initialize masses */
-            if (n_cavity_masses[j] > 1){
-               mass[j]    = new EGS_Float [nreg];
-               kerma_r[j] = new EGS_ScoringArray(nreg);
-               for(i=0; i<nreg; i++) {
-                  mass[j][i] = -1.0;
-               }
-               mass_cv[j] = 0;
-            }
-            else{
+            if (n_cavity_masses[j] > 1) {
+                mass[j]    = new EGS_Float [nreg];
+                kerma_r[j] = new EGS_ScoringArray(nreg);
+                for (i=0; i<nreg; i++) {
+                    mass[j][i] = -1.0;
+                }
+                mass_cv[j] = 0;
+            }
+            else {
                 mass_cv[j] = cavity_masses[j][0];
                 mass[j]    = 0;
                 kerma_r[j] = 0;
             }
             /* Initialize sensitive and exclude regions */
-            for(i=0; i<nreg; i++) {
+            for (i=0; i<nreg; i++) {
                 is_sensitive[j][i] = false;
                 is_excluded[j][i]  = false;
             }
             int imed = -999;
-            for(i=0; i<n_cavity_regions[j]; i++) {
+            for (i=0; i<n_cavity_regions[j]; i++) {
                 int ireg = cavity_regions[j][i];
                 is_sensitive[j][ireg] = true;
-                if( imed == -999 ) imed = geoms[j]->medium(ireg);
+                if (imed == -999) {
+                    imed = geoms[j]->medium(ireg);
+                }
                 else {
                     int imed1 = geoms[j]->medium(ireg);
-                    if( imed1 != imed )
-                      egsWarning(
-                      "initScoring: different "
-                      "medium %d in region %d compared to medium %d in "
-                      "region %d. Hope you know what you are doing\n",
-                      imed1,ireg,imed,cavity_regions[j][0]);
+                    if (imed1 != imed)
+                        egsWarning(
+                            "initScoring: different "
+                            "medium %d in region %d compared to medium %d in "
+                            "region %d. Hope you know what you are doing\n",
+                            imed1,ireg,imed,cavity_regions[j][0]);
                 }
                 //if (n_cavity_masses[j] > 1){
-                if (mass[j]){
-                   mass[j][ireg] = cavity_masses[j][i];
-                   mass_cv[j]   += cavity_masses[j][i];
+                if (mass[j]) {
+                    mass[j][ireg] = cavity_masses[j][i];
+                    mass_cv[j]   += cavity_masses[j][i];
                 }
                 //Find largest scoring region in all geometries
-                if (ireg > max_sc_reg) max_sc_reg = ireg;
-                if (ireg < active_reg) active_reg = ireg;
+                if (ireg > max_sc_reg) {
+                    max_sc_reg = ireg;
+                }
+                if (ireg < active_reg) {
+                    active_reg = ireg;
+                }
             }
             n_scoring_r[j] = n_cavity_regions[j];
             delete [] cavity_regions[j];
             delete [] cavity_masses[j];
             /* Get cavity mass density */
-            if (rho_cv[j] < 0) rho_cv[j] = the_media->rho[imed];
+            if (rho_cv[j] < 0) {
+                rho_cv[j] = the_media->rho[imed];
+            }
             else {
                 EGS_Float rho_cv_new = the_media->rho[imed];
                 if (rho_cv[j] != rho_cv_new)
                     egsWarning(
-                    "initScoring:\n"
-                    "density of cavity medium in geometry %s is %g g/cm3\n"
-                    "which differs from initial cavity medium density %g g/cm3",
-                    geoms[j]->getName().c_str(), rho_cv_new, rho_cv[j]);
+                        "initScoring:\n"
+                        "density of cavity medium in geometry %s is %g g/cm3\n"
+                        "which differs from initial cavity medium density %g g/cm3",
+                        geoms[j]->getName().c_str(), rho_cv_new, rho_cv[j]);
             }

             //if (n_excluded_regions.size()>0){
-            if ( !n_excluded_regions.empty() ) {
-                for(i=0; i<n_excluded_regions[j]; i++) {
+            if (!n_excluded_regions.empty()) {
+                for (i=0; i<n_excluded_regions[j]; i++) {
                     int areg = excluded_regions[j][i];
                     is_excluded[j][areg] = true;
                 }
@@ -1119,27 +1237,31 @@
         }

         vector<int> cor1, cor2;
-        while( (aux = options->takeInputItem("correlated geometries")) ) {
+        while ((aux = options->takeInputItem("correlated geometries"))) {
             vector<string> gnames;
             int err = aux->getInput("correlated geometries",gnames);
-            if( !err && gnames.size() == 2 ) {
+            if (!err && gnames.size() == 2) {
                 int j1, j2;
-                for(j1=0; j1<ngeom; j1++)
-                    if( gnames[0] == geoms[j1]->getName() ) break;
-                for(j2=0; j2<ngeom; j2++)
-                    if( gnames[1] == geoms[j2]->getName() ) break;
-                if( j1 < ngeom && j2 < ngeom ) {
+                for (j1=0; j1<ngeom; j1++)
+                    if (gnames[0] == geoms[j1]->getName()) {
+                        break;
+                    }
+                for (j2=0; j2<ngeom; j2++)
+                    if (gnames[1] == geoms[j2]->getName()) {
+                        break;
+                    }
+                if (j1 < ngeom && j2 < ngeom) {
                     cor1.push_back(j1);
                     cor2.push_back(j2);
                 }
             }
         }
-        if( cor1.size() > 0 ) {
+        if (cor1.size() > 0) {
             ncg = cor1.size();
             gind1 = new int [ncg];
             gind2 = new int [ncg];
             scg = new double [ncg];
-            for(int j=0; j<ncg; j++) {
+            for (int j=0; j<ncg; j++) {
                 scg[j] = 0;
                 gind1[j] = cor1[j];
                 gind2[j] = cor2[j];
@@ -1147,7 +1269,7 @@
         }

         aux = options->takeInputItem("fluence scoring");
-        if( aux ) {
+        if (aux) {
             EGS_Float flu_Emin, flu_Emax;
             int er1 = aux->getInput("minimum energy",flu_Emin);
             int er2 = aux->getInput("maximum energy",flu_Emax);
@@ -1163,13 +1285,13 @@
                            flu_Emax = Emax + 2*(flu_Emax - flu_Emin)/flu_nbin;
                            flu_nbin += 2;
                         }*/
-            if( !er1 && !er2 && !er3 ) {
+            if (!er1 && !er2 && !er3) {
                 flug  = new EGS_ScoringArray * [ngeom];
                 flugT = new EGS_ScoringArray(ngeom);
-                for(int j=0; j<ngeom; j++) {
+                for (int j=0; j<ngeom; j++) {
                     flug[j] = new EGS_ScoringArray(flu_nbin);
                 }
-                if( flu_s == 0 ) {
+                if (flu_s == 0) {
                     flu_xmin = flu_Emin;
                     flu_xmax = flu_Emax;
                 }
@@ -1191,51 +1313,53 @@

         string emuen_file;
         int errKmuen = options->getInput("emuen file",emuen_file);
-        if( errKmuen )
-        { // Handle legacy option
-          errKmuen = options->getInput("muen file",emuen_file);
-          if( errKmuen )
-              egsFatal(
-              "\n\n***  Wrong/missing 'emuen file' input for a "
-              "Kerma calculation\n    This is a fatal error\n\n");
+        if (errKmuen) {
+            // Handle legacy option
+            errKmuen = options->getInput("muen file",emuen_file);
+            if (errKmuen)
+                egsFatal(
+                    "\n\n***  Wrong/missing 'emuen file' input for a "
+                    "Kerma calculation\n    This is a fatal error\n\n");
         }
         //Check for environment variable at beginning of file name
-         std::size_t p1= emuen_file.find_first_of("$");
-        if (p1 != emuen_file.npos){
-           string str = emuen_file;
-           std::size_t p2 = str.find_first_of("/");
-           string envvar = str.substr(p1+1,p2-1);
-           //egsInformation(" Found env var: %s\n",envvar.c_str());
-           char*  envloc = getenv(envvar.c_str());
-           //egsInformation(" %s points to: %s\n",envvar.c_str(),envloc);
-           emuen_file.replace(p1,p2+1,envloc);
-           //egsInformation("\n-> Kerma calculated using E*muen/rho file : %s\n\n",emuen_file.c_str());
+        std::size_t p1= emuen_file.find_first_of("$");
+        if (p1 != emuen_file.npos) {
+            string str = emuen_file;
+            std::size_t p2 = str.find_first_of("/");
+            string envvar = str.substr(p1+1,p2-1);
+            //egsInformation(" Found env var: %s\n",envvar.c_str());
+            char  *envloc = getenv(envvar.c_str());
+            //egsInformation(" %s points to: %s\n",envvar.c_str(),envloc);
+            emuen_file.replace(p1,p2+1,envloc);
+            //egsInformation("\n-> Kerma calculated using E*muen/rho file : %s\n\n",emuen_file.c_str());

         }

         //emuen_file = egsExpandPath(emuen_file);

         ifstream muen_data(emuen_file.c_str());
-        if( !muen_data ) {
+        if (!muen_data) {
             egsFatal(
                 "\n\n***  Failed to open emuen file %s\n"
                 "     This is a fatal error\n",emuen_file.c_str());
         }
-        else{
+        else {
             egsInformation(
                 "\n\n=============== Kerma Scoring ===============\n"
-                    "E*muen/rho file: %s\n"
-                    "=============================================\n\n",
-                    emuen_file.c_str());
+                "E*muen/rho file: %s\n"
+                "=============================================\n\n",
+                emuen_file.c_str());
         }
         int ndat;
         muen_data >> ndat;
-        if( ndat < 2 || muen_data.fail() ) egsFatal(
+        if (ndat < 2 || muen_data.fail()) egsFatal(
                 "\n\n*** Failed to read emuen data file\n");
         EGS_Float *xmuen = new EGS_Float [ndat];
         EGS_Float *fmuen = new EGS_Float [ndat];
-        for(int j=0; j<ndat; j++) muen_data >> xmuen[j] >> fmuen[j];
-        if( muen_data.fail() ) egsFatal(
+        for (int j=0; j<ndat; j++) {
+            muen_data >> xmuen[j] >> fmuen[j];
+        }
+        if (muen_data.fail()) egsFatal(
                 "\n\n*** Failed to read emuen data file\n");
         E_Muen_Rho = new EGS_Interpolator(ndat,log(xmuen[0]),
                                           log(xmuen[ndat-1]),fmuen);
@@ -1244,21 +1368,21 @@
         // Global FD definition
         string fd_global_g;
         int errGFDgeom = options->getInput("Default FD geometry",fd_global_g);
-        if( !errGFDgeom ) {
+        if (!errGFDgeom) {
             EGS_BaseGeometry::setActiveGeometryList(app_index);
             fd_geom = EGS_BaseGeometry::getGeometry(fd_global_g);
-            if( fd_geom ) {
-              // Use global FD geometry for calc geom without one
-              for (int i = 0; i < ngeom; i++){
-                  if (!fd_geoms[i]){
-                     fd_geoms[i] = fd_geom;
-                  }
-              }
-            }
-        }
-        else{
+            if (fd_geom) {
+                // Use global FD geometry for calc geom without one
+                for (int i = 0; i < ngeom; i++) {
+                    if (!fd_geoms[i]) {
+                        fd_geoms[i] = fd_geom;
+                    }
+                }
+            }
+        }
+        else {
             errGFDgeom = options->getInput("cavity geometry",fd_global_g);
-            if (!errGFDgeom){
+            if (!errGFDgeom) {
                 egsFatal("Using deprecated input key 'cavity geometry' use 'Default FD geometry' instead!!!");
             }
         }
@@ -1278,49 +1402,52 @@
     egsInformation("**********************************************\n"
                    "   Volumetric Track-length Kerma estimation \n"
                    "**********************************************\n\n");
-    for(int j=0; j<ngeom; j++) {
+    for (int j=0; j<ngeom; j++) {
         egsInformation("Calculation geometry: %s\n",
                        geoms[j]->getName().c_str());
         geoms[j]->printInfo();
         if (fd_geoms[j])
-           egsInformation("---> Scoring using forced detection (FD)\n"
-                       "     for photons aimed at or inside geometry %s\n",
-                       fd_geoms[j]->getName().c_str());
-        else
-           egsInformation("\n---> Scoring only when photon enters volume\n");
-                       //"     including those scattered inside the geometry.\n");
-                       //"     Fluence is equivalent to FLURZ total fluence!\n");
+            egsInformation("---> Scoring using forced detection (FD)\n"
+                           "     for photons aimed at or inside geometry %s\n",
+                           fd_geoms[j]->getName().c_str());
+        else {
+            egsInformation("\n---> Scoring only when photon enters volume\n");
+        }
+        //"     including those scattered inside the geometry.\n");
+        //"     Fluence is equivalent to FLURZ total fluence!\n");
         egsInformation("     Sensitive regions in %s :",
-                      getMediumName(geoms[j]->medium(active_reg)));
-        for(int i=0; i<geoms[j]->regions(); i++) {
-            if( is_sensitive[j][i] ) {
+                       getMediumName(geoms[j]->medium(active_reg)));
+        for (int i=0; i<geoms[j]->regions(); i++) {
+            if (is_sensitive[j][i]) {
                 egsInformation(" %d", i);
             }
         }
         egsInformation("\n");
-        if ( kerma_r[j] ){
-           egsInformation("     Scoring in individual regions\n");
-        }
-        else{
-           egsInformation("     Scoring in whole scoring volume\n");
+        if (kerma_r[j]) {
+            egsInformation("     Scoring in individual regions\n");
+        }
+        else {
+            egsInformation("     Scoring in whole scoring volume\n");
         }
         egsInformation("     Exclude contributions from photons entering regions : ");
         int nexcl = 0;
-        for(int i = 0; i < geoms[j]->regions(); i++) {
+        for (int i = 0; i < geoms[j]->regions(); i++) {
             if (is_excluded[j][i]) {
                 egsInformation(" %d",i);
                 nexcl++;
             }
         }
-        if (!nexcl) egsInformation(" NONE");
+        if (!nexcl) {
+            egsInformation(" NONE");
+        }
         egsInformation("\n\n");
     }
 }

 #ifdef BUILD_APP_LIB
-APP_LIB(EGS_KermaApplication);
+    APP_LIB(EGS_KermaApplication);
 #else
-APP_MAIN(EGS_KermaApplication);
+    APP_MAIN(EGS_KermaApplication);
 #endif
 // int main(int argc, char **argv) {
 //


Separate unimplemented branches for METADATA_ERR_NONE.

--- src/clustering/administration/main/import.cc
+++ src/clustering/administration/main/import.cc
@@ -152,12 +152,16 @@
     const char *error;
     std::map<namespace_id_t, deletable_t<namespace_semilattice_metadata_t<rdb_protocol_t> > >::iterator it = searcher.find_uniq(namespace_predicate_t(table_name, db_id), &error);

-    if (error != METADATA_SUCCESS) {
-        *namespace_out = namespace_id_t();
-        return false;
-    } else {
+    if (error == METADATA_SUCCESS) {
         *namespace_out = it->first;
         return true;
+    } else if (error == METADATA_ERR_NONE) {
+        // TODO(sam):  impl this.
+        *namespace_out = namespace_id_t();
+        return false;
+    } else {
+        *namespace_out = namespace_id_t();
+        return false;
     }
 }

@@ -168,13 +172,17 @@
     const char *error;
     std::map<database_id_t, deletable_t<database_semilattice_metadata_t> >::iterator it = searcher.find_uniq(db_name, &error);

-    if (error != METADATA_SUCCESS) {
+    if (error == METADATA_SUCCESS) {
+        *db_out = it->first;
+        return true;
+    } else if (error == METADATA_ERR_NONE) {
+        // TODO(sam): Impl this.
+        *db_out = database_id_t();
+        return false;
+    } else {
         // TODO(sam): Actually support _creating_ the database.
         *db_out = database_id_t();
         return false;
-    } else {
-        *db_out = it->first;
-        return true;
     }
 }


Fixed model index not being converted through sort filter proxy model, before calling custom function in model (ModelView concept in systems parameter widget) Resolves #1518

--- HopsanGUI/Widgets/SystemParametersWidget.cpp
+++ HopsanGUI/Widgets/SystemParametersWidget.cpp
@@ -516,7 +516,8 @@
     if (!idxList.isEmpty())
     {
         CoreParameterData data;
-        mpModel->getFullParameterData(idxList.first(), data);
+        QModelIndex sourceIndex = mpProxyModel->mapToSource(idxList.front());
+        mpModel->getFullParameterData(sourceIndex, data);

         mpAddParameterDialog = new QDialog(this);
         mpAddParameterDialog->setWindowTitle("Edit System Parameter");


Fix a test that was broken by the removal of history().

--- ksp_plugin_test/plugin_compatibility_test.cpp
+++ ksp_plugin_test/plugin_compatibility_test.cpp
@@ -271,7 +271,8 @@
   auto const& trajectory = vessel.trajectory();
   auto history = trajectory.segments().begin();
   auto psychohistory = vessel.psychohistory();
-  EXPECT_THAT(trajectory, SizeIs(435'927));
+  EXPECT_THAT(trajectory, SizeIs(435'929));
+  EXPECT_THAT(*history, SizeIs(435'927));
   EXPECT_THAT(*psychohistory, SizeIs(3));

   // Evaluate a point in each of the two segments.
@@ -314,6 +315,7 @@
         ParseFromBytes<serialization::DiscreteTrajectory>(serialized_message);
     auto const trajectory = DiscreteTrajectory<Barycentric>::ReadFromMessage(
         message, /*tracked=*/{&history, &psychohistory});
+    EXPECT_THAT(trajectory, SizeIs(435'929));
     EXPECT_THAT(*history, SizeIs(435'927));
     EXPECT_THAT(*psychohistory, SizeIs(3));
   }


Fixes #163: Spotlights were not rendered correctly.

--- Infrastructure/src/graphics/mdfmaterials.cpp
+++ Infrastructure/src/graphics/mdfmaterials.cpp
@@ -166,7 +166,7 @@
 					++directionalCount;
 				else if (light.type == Light3dType::Point)
 					++pointCount;
-				else if (light.type == Light3dType::Directional)
+				else if (light.type == Light3dType::Spot)
 					++spotCount;
 			}

@@ -183,7 +183,7 @@
 					lightIdx = directionalCount++;
 				else if (light.type == Light3dType::Point)
 					lightIdx = pointFirstIdx + pointCount++;
-				else if (light.type == Light3dType::Directional)
+				else if (light.type == Light3dType::Spot)
 					lightIdx = spotFirstIdx + spotCount++;
 				else
 					continue;


Fix 683507 - assertion fired when constructing a Vector with the wrong number of parameters (r=edwsmith)

--- core/VectorClass.cpp
+++ core/VectorClass.cpp
@@ -245,10 +245,9 @@
     {
         Toplevel* toplevel = this->toplevel();

-        // Vector only takes 1 type argument
-        AvmAssert(argc==1);
         if (argc != 1)
         {
+            // Vector only takes 1 type argument
             toplevel->typeErrorClass()->throwError(kWrongTypeArgCountError, traits()->formatClassName(), core()->toErrorString(1), core()->toErrorString(argc));
         }


logging branch: Added clearing of testbuffer

svn path=/branches/experiments/libavg_logging_refactor/; revision=8707

--- src/base/testbase.cpp
+++ src/base/testbase.cpp
@@ -945,6 +945,7 @@
             AVG_TRACE(logging::category::NONE, logging::level::INFO, msg);
             std::cerr.rdbuf(sbuf);
             TEST(buffer.str().find(msg) != string::npos);
+            buffer.str(string());
         }
         {
             std::cerr.rdbuf(buffer.rdbuf());
@@ -955,6 +956,7 @@
             AVG_TRACE(AWESOME_CAT, logging::level::INFO, msg);
             std::cerr.rdbuf(sbuf);
             TEST(buffer.str().find(msg) != string::npos);
+            buffer.str(string());
         }
         {
             std::cerr.rdbuf(buffer.rdbuf());
@@ -963,6 +965,7 @@
             AVG_LOG_INFO(msg);
             std::cerr.rdbuf(sbuf);
             TEST(buffer.str().find(msg) == string::npos);
+            buffer.str(string());
         }
     }
 };


Allow 'for $x in () return $x/node-test'

--- src/compiler/expression/expr_static_type.cpp
+++ src/compiler/expression/expr_static_type.cpp
@@ -601,7 +601,7 @@

   xqtref_t sourceType = theSteps[0]->return_type(sctx);

-  if (TypeOps::is_empty (*sourceType))
+  if (TypeOps::is_empty (*sourceType) || TypeOps::is_none (*sourceType))
     return sourceType;

   if (sourceType->type_kind() != XQType::NODE_TYPE_KIND)


ENH: print CG info on one line

ENH: print CG info on one line

--- lib/smurff-cpp/SmurffCpp/Priors/MacauPrior.cpp
+++ lib/smurff-cpp/SmurffCpp/Priors/MacauPrior.cpp
@@ -174,8 +174,7 @@
       if (needs_gb > 1.0) os << " (needing " << needs_gb << " GB of memory)";
       os << std::endl;
    } else {
-      os << "CG Solver" << std::endl;
-      os << indent << "  with tolerance: " << std::scientific << tol << std::fixed << std::endl;
+      os << "CG Solver with tolerance: " << std::scientific << tol << std::fixed << std::endl;
    }
    os << indent << " BetaPrecision: " << beta_precision << std::endl;
    return os;


reduce duplicate constant value

reduce duplicate constant value

--- src/compiler/glsl/ir_print_spirv_visitor.cpp
+++ src/compiler/glsl/ir_print_spirv_visitor.cpp
@@ -395,29 +395,20 @@
          f->sampler_id[type->sampler_dimensionality] = sampled_image_id;
       }
       return f->sampler_id[type->sampler_dimensionality];
-   }
-
-   unsigned int vector_id;
-   unsigned int* ids;
-   if (type->is_array()) {
+   } else if (type->is_array()) {

       ir_constant ir_array_size(type->array_size());
       ir_array_size.ir_value = 0;
       visit(&ir_array_size);

       unsigned int base_type_id = visit_type(type->fields.array);
-      vector_id = f->id++;
+      unsigned int vector_id = f->id++;
       f->types.push(SpvOpTypeArray | (4 << SpvWordCountShift));
       f->types.push(vector_id);
       f->types.push(base_type_id);
       f->types.push(ir_array_size.ir_value);

       return vector_id;
-   }
-   if (type->is_float()) {
-      ids = f->float_id;
-   } else if (type->is_integer()) {
-      ids = f->int_id;
    } else if (type->is_boolean()) {
       if (f->bool_id == 0) {
          f->bool_id = f->id++;
@@ -425,6 +416,21 @@
          f->types.push(f->bool_id);
       }
       return f->bool_id;
+   } else if (type->is_void()) {
+      if (f->void_id == 0) {
+         f->void_id = f->id++;
+         f->types.push(SpvOpTypeVoid | (2 << SpvWordCountShift));
+         f->types.push(f->void_id);
+      }
+      return f->void_id;
+   }
+
+   unsigned int vector_id;
+   unsigned int* ids;
+   if (type->is_float()) {
+      ids = f->float_id;
+   } else if (type->is_integer()) {
+      ids = f->int_id;
    } else {
       return 0;
    }
@@ -505,14 +511,17 @@
       return 0;
    }

-   unsigned int vector_id;
-   unsigned int* ids;
-   if (type->is_array()) {
+   if (type->is_sampler()) {
+      if (f->pointer_sampler_id[type->sampler_dimensionality] == 0) {
+         f->pointer_sampler_id[type->sampler_dimensionality] = f->id++;
+         f->types.push(SpvOpTypePointer | (4 << SpvWordCountShift));
+         f->types.push(f->pointer_sampler_id[type->sampler_dimensionality]);
+         f->types.push(SpvStorageClassUniformConstant);
+         f->types.push(point_to);
+      }
+      return f->pointer_sampler_id[type->sampler_dimensionality];
+   } else if (type->is_array()) {
       return visit_type_pointer(type->fields.array, mode, point_to);
-   } else if (type->is_float()) {
-      ids = f->pointer_float_id;
-   } else if (type->is_integer()) {
-      ids = f->pointer_int_id;
    } else if (type->is_boolean()) {
       if (f->pointer_bool_id[mode] == 0) {
          f->pointer_bool_id[mode] = f->id++;
@@ -522,15 +531,14 @@
          f->types.push(point_to);
       }
       return f->pointer_bool_id[mode];
-   } else if (type->is_sampler()) {
-      if (f->pointer_sampler_id[type->sampler_dimensionality] == 0) {
-         f->pointer_sampler_id[type->sampler_dimensionality] = f->id++;
-         f->types.push(SpvOpTypePointer | (4 << SpvWordCountShift));
-         f->types.push(f->pointer_sampler_id[type->sampler_dimensionality]);
-         f->types.push(SpvStorageClassUniformConstant);
-         f->types.push(point_to);
-      }
-      return f->pointer_sampler_id[type->sampler_dimensionality];
+   }
+
+   unsigned int vector_id;
+   unsigned int* ids;
+   if (type->is_float()) {
+      ids = f->pointer_float_id;
+   } else if (type->is_integer()) {
+      ids = f->pointer_int_id;
    } else {
       return 0;
    }
@@ -564,15 +572,15 @@

          unsigned int uniform_type = visit_type(ir->type);
          unsigned int type_pointer_id = visit_type_pointer(ir->type, ir_var_uniform, uniform_type);
-         unsigned int access_id = f->id++;
+         unsigned int pointer_id = f->id++;

          f->functions.push(SpvOpAccessChain | (5 << SpvWordCountShift));
          f->functions.push(type_pointer_id);
-         f->functions.push(access_id);
+         f->functions.push(pointer_id);
          f->functions.push(f->uniform_id);
          f->functions.push(ir_uniform.ir_value);

-         ir->ir_pointer = access_id;
+         ir->ir_pointer = pointer_id;
       }
       if (ir->ir_pointer != 0) {
          unsigned int type_id = visit_type(ir->type);
@@ -797,17 +805,7 @@
 void ir_print_spirv_visitor::visit(ir_function_signature *ir)
 {
    // TypeVoid
-   unsigned int type_id;
-   if (ir->return_type->base_type == GLSL_TYPE_VOID) {
-      if (f->void_id == 0) {
-         f->void_id = f->id++;
-         f->types.push(SpvOpTypeVoid | (2 << SpvWordCountShift));
-         f->types.push(f->void_id);
-      }
-      type_id = f->void_id;
-   } else {
-      return;
-   }
+   unsigned int type_id = visit_type(ir->return_type);

    // TypeFunction
    unsigned int function_id = f->id++;
@@ -878,7 +876,7 @@
       visit_value(ir->operands[i]);
    }

-   unsigned int return_id = visit_type(ir->type);
+   unsigned int type_id = visit_type(ir->type);

    if (ir->operation == ir_unop_saturate) {
       if (ir->get_num_operands() != 1)
@@ -893,7 +891,7 @@

       unsigned int value_id = f->id++;
       f->functions.push(SpvOpExtInst | (8 << SpvWordCountShift));
-      f->functions.push(return_id);
+      f->functions.push(type_id);
       f->functions.push(value_id);
       f->functions.push(f->import_id);
       f->functions.push(GLSLstd450FClamp);
@@ -910,7 +908,7 @@
       default:
       case ir_unop_neg:
          f->functions.push(SpvOpFNegate | (4 << SpvWordCountShift));
-         f->functions.push(return_id);
+         f->functions.push(type_id);
          f->functions.push(value_id);
          break;
       case ir_unop_rcp: {
@@ -919,7 +917,7 @@
          visit(&ir);

          f->functions.push(SpvOpFDiv | (5 << SpvWordCountShift));
-         f->functions.push(return_id);
+         f->functions.push(type_id);
          f->functions.push(value_id);
          f->functions.push(ir.ir_value);
          break;
@@ -941,7 +939,7 @@
       case ir_unop_sin:
       case ir_unop_cos:
          f->functions.push(SpvOpExtInst | (6 << SpvWordCountShift));
-         f->functions.push(return_id);
+         f->functions.push(type_id);
          f->functions.push(value_id);
          f->functions.push(f->import_id);
          switch (ir->operation) {
@@ -1001,7 +999,7 @@
          case ir_binop_nequal:      f->functions.push(SpvOpFOrdNotEqual | (5 << SpvWordCountShift));            break;
          case ir_binop_dot:         f->functions.push(SpvOpDot | (5 << SpvWordCountShift));                     break;
          }
-         f->functions.push(return_id);
+         f->functions.push(type_id);
          f->functions.push(value_id);
          break;
       case ir_binop_min:
@@ -1009,7 +1007,7 @@
       case ir_binop_pow:
       case ir_binop_ldexp:
          f->functions.push(SpvOpExtInst | (7 << SpvWordCountShift));
-         f->functions.push(return_id);
+         f->functions.push(type_id);
          f->functions.push(value_id);
          f->functions.push(f->import_id);
          switch (ir->operation) {
@@ -1034,7 +1032,7 @@
       case ir_triop_fma:
       case ir_triop_lrp:
          f->functions.push(SpvOpExtInst | (8 << SpvWordCountShift));
-         f->functions.push(return_id);
+         f->functions.push(type_id);
          f->functions.push(value_id);
          f->functions.push(f->import_id);
          switch (ir->operation) {
@@ -1205,7 +1203,7 @@
 void ir_print_spirv_visitor::visit(ir_dereference_variable *ir)
 {
    ir_variable *var = ir->variable_referenced();
-   if ((f->shader_stage != MESA_SHADER_VERTEX || strcmp (var->name, "gl_Position") != 0) && var->data.mode != ir_var_uniform)
+   if (is_gl_identifier(var->name) == false && var->data.mode != ir_var_uniform)
       unique_name(var);

    switch (var->data.mode) {
@@ -1283,14 +1281,14 @@

             f->per_vertices.push(type_id);

-            unsigned int access_id = f->id++;
+            unsigned int pointer_id = f->id++;
             f->functions.push(SpvOpAccessChain | (5 << SpvWordCountShift));
             f->functions.push(type_pointer_id);
-            f->functions.push(access_id);
+            f->functions.push(pointer_id);
             f->functions.push(variable_id);
             f->functions.push(constant_id);

-            var->ir_initialized = access_id;
+            var->ir_initialized = pointer_id;
          }

          ir->ir_pointer = var->ir_initialized;
@@ -1312,7 +1310,7 @@
    visit_value(ir->array_index);

    unsigned int type_id = visit_type(ir->type);
-   unsigned int return_id = f->id++;
+   unsigned int pointer_id = f->id++;
    if (ir->array->ir_uniform) {
       ir_constant ir_uniform(ir->array->ir_uniform - 1);
       ir_uniform.ir_value = 0;
@@ -1321,7 +1319,7 @@
       unsigned int type_id_pointer = visit_type_pointer(ir->type, ir_var_uniform, type_id);
       f->functions.push(SpvOpAccessChain | (6 << SpvWordCountShift));
       f->functions.push(type_id_pointer);
-      f->functions.push(return_id);
+      f->functions.push(pointer_id);
       f->functions.push(f->uniform_id);
       f->functions.push(ir_uniform.ir_value);
       f->functions.push(ir->array_index->ir_value);
@@ -1329,12 +1327,12 @@
       unsigned int type_id_pointer = visit_type_pointer(ir->type, ir_var_auto, type_id);
       f->functions.push(SpvOpAccessChain | (5 << SpvWordCountShift));
       f->functions.push(type_id_pointer);
-      f->functions.push(return_id);
+      f->functions.push(pointer_id);
       f->functions.push(ir->array->ir_pointer);
       f->functions.push(ir->array_index->ir_value);
    }

-   ir->ir_pointer = return_id;
+   ir->ir_pointer = pointer_id;
 }

 void ir_print_spirv_visitor::visit(ir_dereference_record *ir)
@@ -1450,46 +1448,24 @@
          default:
             break;
          }
-      }
-      if (ir->ir_value)
-         return;
-
-      binary_buffer ids;
-      for (unsigned i = 0; i < ir->type->components(); i++) {
-         unsigned int type_id = visit_type(ir->type->get_base_type());
+         if (ir->ir_value)
+            return;
+
+         unsigned int type_id = visit_type(ir->type);
          unsigned int constant_id = f->id++;
          f->types.push(SpvOpConstant | (4 << SpvWordCountShift));
          f->types.push(type_id);
          f->types.push(constant_id);
          switch (ir->type->base_type) {
-         case GLSL_TYPE_UINT:  f->types.push(ir->value.u[i]); break;
-         case GLSL_TYPE_INT:   f->types.push(ir->value.i[i]); break;
-         case GLSL_TYPE_FLOAT: f->types.push(*(int*)&ir->value.f[i]);  break;
+         case GLSL_TYPE_UINT:  f->types.push(ir->value.u[0]); break;
+         case GLSL_TYPE_INT:   f->types.push(ir->value.i[0]); break;
+         case GLSL_TYPE_FLOAT: f->types.push(*(int*)&ir->value.f[0]); break;
          default:
-            f->types.push(0u);
+            f->types.push(0u);
             unreachable("Invalid constant type");
          }
-         ids.push(constant_id);
-      }
-      unsigned int value_id = 0;
-      unsigned int type_id = visit_type(ir->type);
-      if (ids.count() == 1) {
-         value_id = ids[0];
-      } else {
-         value_id = f->id++;
-         f->types.push(SpvOpConstantComposite | ((3 + ids.count()) << SpvWordCountShift));
-         f->types.push(type_id);
-         f->types.push(value_id);
-         for (unsigned i = 0; i < ids.count(); i++) {
-            f->types.push(ids[i]);
-         }
-      }
-      ir->ir_value = value_id;
-#if 0
-      visit_precision(ir->ir_value, ir->type->base_type, GLSL_PRECISION_NONE);
-#endif
-
-      if (ir->type->components() == 1) {
+         ir->ir_value = constant_id;
+
          switch (ir->type->base_type) {
          case GLSL_TYPE_UINT:
             if (ir->value.u[0] <= 15)
@@ -1506,7 +1482,48 @@
          default:
             break;
          }
-      }
+      } else {
+         binary_buffer ids;
+         for (unsigned int i = 0; i < ir->type->components(); i++) {
+            switch (ir->type->base_type) {
+            case GLSL_TYPE_UINT: {
+               ir_constant ir_const(ir->value.u[i]);
+               ir_const.ir_value = 0;
+               visit(&ir_const);
+               ids.push(ir_const.ir_value);
+               break;
+            }
+            case GLSL_TYPE_INT: {
+               ir_constant ir_const(ir->value.i[i]);
+               ir_const.ir_value = 0;
+               visit(&ir_const);
+               ids.push(ir_const.ir_value);
+               break;
+            }
+            case GLSL_TYPE_FLOAT:  {
+               ir_constant ir_const(ir->value.f[i]);
+               ir_const.ir_value = 0;
+               visit(&ir_const);
+               ids.push(ir_const.ir_value);
+               break;
+            }
+            default:
+               unreachable("Invalid constant type");
+            }
+         }
+         unsigned int value_id = f->id++;
+         unsigned int type_id = visit_type(ir->type);
+         f->types.push(SpvOpConstantComposite | ((3 + ids.count()) << SpvWordCountShift));
+         f->types.push(type_id);
+         f->types.push(value_id);
+         for (unsigned i = 0; i < ids.count(); i++) {
+            f->types.push(ids[i]);
+         }
+         ir->ir_value = value_id;
+      }
+#if 0
+      visit_precision(ir->ir_value, ir->type->base_type, GLSL_PRECISION_NONE);
+#endif
    }
 }


add missing include

add missing include

--- lib/smurff-cpp/SmurffCpp/Utils/TensorUtils.cpp
+++ lib/smurff-cpp/SmurffCpp/Utils/TensorUtils.cpp
@@ -1,3 +1,5 @@
+#include <numeric>
+
 #include "TensorUtils.h"

 #include <SmurffCpp/Utils/Error.h>


Add Vector3d support for loading GDL

Add Vector3d support for loading GDL

--- core/gluonobject.cpp
+++ core/gluonobject.cpp
@@ -419,7 +419,7 @@
     if(theTypeName == "string") {
         value = theValue;
     } else if(theTypeName == "bool") {
-        value = theValue.toFloat();
+        value = theValue == "true" ? true : false;
     } else if(theTypeName == "float") {
         value = theValue.toFloat();
     } else if(theTypeName == "int") {
@@ -429,15 +429,25 @@
         value = QVariant(QUrl(theValue));
     } else if(theTypeName == "vector2d") {
         float x = 0.0f, y = 0.0f;
-        //, z = 0.0f;
+
         QStringList splitValues = theValue.split(";");
         if(splitValues.length() > 0)
         {
             x = splitValues.at(0).toFloat();
             y = splitValues.at(1).toFloat();
-            //z = splitValues.at(2).toFloat();
         }
         value = QPointF(x, y);
+    } else if(theTypeName == "vector3d") {
+        float x = 0.0f, y = 0.0f, z = 0.0f;
+
+        QStringList splitValues = theValue.split(";");
+        if(splitValues.length() > 0)
+        {
+            x = splitValues.at(0).toFloat();
+            y = splitValues.at(1).toFloat();
+            z = splitValues.at(2).toFloat();
+        }
+        value = QVector3D(x, y, z);
     } else if(theTypeName == "rgba") {
         int r = 0, g = 0, b = 0, a = 0;
         QStringList splitValues = theValue.split(";");
@@ -490,7 +500,7 @@
         case QVariant::Vector3D:
         {
             QVector3D aVector = theValue.value<QVector3D>();
-            value = QString("vector3d(%1,%2,%3)").arg(aVector.x()).arg(aVector.y()).arg(aVector.z());
+            value = QString("vector3d(%1;%2;%3)").arg(aVector.x()).arg(aVector.y()).arg(aVector.z());
         }
             break;
         case QVariant::Int:


Added getters to URIContext for the host name (without service) and service. Basically just splits the host string if there is a :

--- libcore/include/sirikata/core/transfer/URI.hpp
+++ libcore/include/sirikata/core/transfer/URI.hpp
@@ -277,6 +277,34 @@
 		return mHost;
 	}

+	/*
+	 * hostname getter -- without port number
+	 */
+	inline const std::string hostname() const {
+	    std::string::size_type colonPos = mHost.find(":");
+	    if (colonPos == std::string::npos) {
+	        return mHost;
+	    } else {
+	        return mHost.substr(0, colonPos);
+	    }
+	}
+
+	/*
+	 * service getter -- returns the "port" of a URI, or empty string
+	 *                   if there is none
+	 * Example:
+	 * http://www.example.com/path -> ""
+	 * meerkat://hostname.edu:8080/path -> "8080"
+	 */
+	inline const std::string service() const {
+	    std::string::size_type colonPos = mHost.find(":");
+	    if (colonPos == std::string::npos) {
+            return "";
+        } else {
+            return mHost.substr(colonPos+1);
+        }
+	}
+

 	inline void setHost(const std::string &host) {
 		mHost = host;


Add locale renames for Hebrew and Indonesian on Windows

Windows does not fully respect ISO 639-1 like other systems,
so we have to override its locale values for those languages.

Also added comments to document the locale provenance.

--- core/translation.cpp
+++ core/translation.cpp
@@ -33,6 +33,14 @@
 #include "io/resource_loader.h"
 #include "os/os.h"
 #include "project_settings.h"
+
+// ISO 639-1 language codes, with the addition of glibc locales with their
+// regional identifiers. This list must match the language names (in English)
+// of locale_names.
+//
+// References:
+// - https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
+// - https://lh.2xlibre.net/locales/

 static const char *locale_list[] = {
 	"aa", //  Afar
@@ -756,8 +764,17 @@
 	0
 };

+// Windows has some weird locale identifiers which do not honor the ISO 639-1
+// standardized nomenclature. Whenever those don't conflict with existing ISO
+// identifiers, we override them.
+//
+// Reference:
+// - https://msdn.microsoft.com/en-us/library/windows/desktop/ms693062(v=vs.85).aspx
+
 static const char *locale_renames[][2] = {
-	{ "no", "nb" },
+	{ "in", "id" }, //  Indonesian
+	{ "iw", "he" }, //  Hebrew
+	{ "no", "nb" }, //  Norwegian Bokmål
 	{ NULL, NULL }
 };


Put logging endl with the output stream instead of the one used to collect output into a single stream. Fixes #419.

--- libcore/include/sirikata/core/util/Logging.hpp
+++ libcore/include/sirikata/core/util/Logging.hpp
@@ -81,10 +81,10 @@
         if (SILOGP(module,lvl)) {                                       \
             std::ostringstream __log_stream;                            \
             __log_stream << value;                                      \
-            (*Sirikata::Logging::SirikataLogStream) << __log_stream.str(); \
+            (*Sirikata::Logging::SirikataLogStream) << __log_stream.str() << std::endl; \
         }                                                               \
     } while (0)
-# define SILOGBARE(module,lvl,value) SILOGNOCR(module,lvl,value << std::endl)
+# define SILOGBARE(module,lvl,value) SILOGNOCR(module,lvl,value)
 #else
 # define SILOGP(module,lvl) false
 # define SILOGNOCR(module,lvl,value)


Minor fix to normals/tangents

Minor fix to normals/tangents

--- Source/RuntimeMeshComponent/Private/Providers/RuntimeMeshProviderStatic.cpp
+++ Source/RuntimeMeshComponent/Private/Providers/RuntimeMeshProviderStatic.cpp
@@ -33,7 +33,12 @@
 	SectionData.Tangents.Append(Normals, Tangents);
 	if (SectionData.Tangents.Num() < SectionData.Positions.Num())
 	{
-		SectionData.Tangents.SetNum(SectionData.Positions.Num());
+		int32 Count = SectionData.Tangents.Num();
+		SectionData.Tangents.SetNum(SectionData.Positions.Num());
+		for (int32 Index = Count; Index < SectionData.Tangents.Num(); Index++)
+		{
+			SectionData.Tangents.SetTangents(Index, FVector(1, 0, 0), FVector(0, 1, 0), FVector(0, 0, 1));
+		}
 	}
 	SectionData.Colors.Append(VertexColors);
 	if (SectionData.Colors.Num() < SectionData.Positions.Num())
@@ -76,7 +81,12 @@
 	SectionData.Tangents.Append(Normals, Tangents);
 	if (SectionData.Tangents.Num() < SectionData.Positions.Num())
 	{
-		SectionData.Tangents.SetNum(SectionData.Positions.Num());
+		int32 Count = SectionData.Tangents.Num();
+		SectionData.Tangents.SetNum(SectionData.Positions.Num());
+		for (int32 Index = Count; Index < SectionData.Tangents.Num(); Index++)
+		{
+			SectionData.Tangents.SetTangents(Index, FVector(1, 0, 0), FVector(0, 1, 0), FVector(0, 0, 1));
+		}
 	}
 	SectionData.Colors.Append(VertexColors);
 	if (SectionData.Colors.Num() < SectionData.Positions.Num())
@@ -115,7 +125,12 @@
 	SectionData.Tangents.Append(Normals, Tangents);
 	if (SectionData.Tangents.Num() < SectionData.Positions.Num())
 	{
-		SectionData.Tangents.SetNum(SectionData.Positions.Num());
+		int32 Count = SectionData.Tangents.Num();
+		SectionData.Tangents.SetNum(SectionData.Positions.Num());
+		for (int32 Index = Count; Index < SectionData.Tangents.Num(); Index++)
+		{
+			SectionData.Tangents.SetTangents(Index, FVector(1, 0, 0), FVector(0, 1, 0), FVector(0, 0, 1));
+		}
 	}
 	SectionData.Colors.Append(VertexColors);
 	if (SectionData.Colors.Num() < SectionData.Positions.Num())
@@ -150,7 +165,12 @@
 	SectionData.Tangents.Append(Normals, Tangents);
 	if (SectionData.Tangents.Num() < SectionData.Positions.Num())
 	{
-		SectionData.Tangents.SetNum(SectionData.Positions.Num());
+		int32 Count = SectionData.Tangents.Num();
+		SectionData.Tangents.SetNum(SectionData.Positions.Num());
+		for (int32 Index = Count; Index < SectionData.Tangents.Num(); Index++)
+		{
+			SectionData.Tangents.SetTangents(Index, FVector(1, 0, 0), FVector(0, 1, 0), FVector(0, 0, 1));
+		}
 	}
 	SectionData.Colors.Append(VertexColors);
 	if (SectionData.Colors.Num() < SectionData.Positions.Num())
@@ -183,7 +203,12 @@
 	SectionData.Tangents.Append(Normals, Tangents);
 	if (SectionData.Tangents.Num() < SectionData.Positions.Num())
 	{
-		SectionData.Tangents.SetNum(SectionData.Positions.Num());
+		int32 Count = SectionData.Tangents.Num();
+		SectionData.Tangents.SetNum(SectionData.Positions.Num());
+		for (int32 Index = Count; Index < SectionData.Tangents.Num(); Index++)
+		{
+			SectionData.Tangents.SetTangents(Index, FVector(1, 0, 0), FVector(0, 1, 0), FVector(0, 0, 1));
+		}
 	}
 	SectionData.Colors.Append(VertexColors);
 	if (SectionData.Colors.Num() < SectionData.Positions.Num())
@@ -219,7 +244,12 @@
 	SectionData.Tangents.Append(Normals, Tangents);
 	if (SectionData.Tangents.Num() < SectionData.Positions.Num())
 	{
-		SectionData.Tangents.SetNum(SectionData.Positions.Num());
+		int32 Count = SectionData.Tangents.Num();
+		SectionData.Tangents.SetNum(SectionData.Positions.Num());
+		for (int32 Index = Count; Index < SectionData.Tangents.Num(); Index++)
+		{
+			SectionData.Tangents.SetTangents(Index, FVector(1, 0, 0), FVector(0, 1, 0), FVector(0, 0, 1));
+		}
 	}
 	SectionData.Colors.Append(VertexColors);
 	if (SectionData.Colors.Num() < SectionData.Positions.Num())
@@ -252,7 +282,12 @@
 	SectionData.Tangents.Append(Normals, Tangents);
 	if (SectionData.Tangents.Num() < SectionData.Positions.Num())
 	{
-		SectionData.Tangents.SetNum(SectionData.Positions.Num());
+		int32 Count = SectionData.Tangents.Num();
+		SectionData.Tangents.SetNum(SectionData.Positions.Num());
+		for (int32 Index = Count; Index < SectionData.Tangents.Num(); Index++)
+		{
+			SectionData.Tangents.SetTangents(Index, FVector(1, 0, 0), FVector(0, 1, 0), FVector(0, 0, 1));
+		}
 	}
 	SectionData.Colors.Append(VertexColors);
 	if (SectionData.Colors.Num() < SectionData.Positions.Num())
@@ -282,7 +317,12 @@
 	SectionData.Tangents.Append(Normals, Tangents);
 	if (SectionData.Tangents.Num() < SectionData.Positions.Num())
 	{
-		SectionData.Tangents.SetNum(SectionData.Positions.Num());
+		int32 Count = SectionData.Tangents.Num();
+		SectionData.Tangents.SetNum(SectionData.Positions.Num());
+		for (int32 Index = Count; Index < SectionData.Tangents.Num(); Index++)
+		{
+			SectionData.Tangents.SetTangents(Index, FVector(1, 0, 0), FVector(0, 1, 0), FVector(0, 0, 1));
+		}
 	}
 	SectionData.Colors.Append(VertexColors);
 	if (SectionData.Colors.Num() < SectionData.Positions.Num())


Support typed actors

Support typed actors

--- libvast/vast/detail/spawn_container_source.hpp
+++ libvast/vast/detail/spawn_container_source.hpp
@@ -19,15 +19,15 @@

 namespace vast::detail {

-template <class Container>
-caf::actor spawn_container_source(caf::actor_system& system, caf::actor dst,
+template <class Handle, class Container>
+caf::actor spawn_container_source(caf::actor_system& system, Handle dst,
                                   Container elements) {
   using namespace caf;
   struct outer_state {
     /// Name of this actor in log events.
     const char* name = "container-source";
   };
-  auto f = [](stateful_actor<outer_state>* self, actor dest, Container xs) {
+  auto f = [](stateful_actor<outer_state>* self, Handle dest, Container xs) {
     using iterator = typename Container::iterator;
     using value_type = typename Container::value_type;
     struct state {