libdap: incremental check of new ugrid_restrict code. Removed \#if 0 blocks from new implementation.

--- gridfields_functions.cc
+++ gridfields_functions.cc
@@ -1888,6 +1888,9 @@
 }

+/**
+ * Process the functions arguments and return the structure containing their values.
+ */
 static UgridRestrictArgs processUgrArgs(int argc, BaseType * argv[]){

 	UgridRestrictArgs args;
@@ -2179,165 +2182,7 @@
     return rankTwoCells;

-#if 0
-
-    // 2) For each k, find the k-cells
-    // k = 2, for now
-    DBG(cerr << "Reading 2-cells" << endl);
-    GF::CellArray *twocells = NULL;
-
-    for (DDS::Vars_iter vi = dds.var_begin(); vi != dds.var_end(); vi++) {
-        BaseType *bt = *vi;
-        // TODO Allow variables that are not Arrays; ignore as above
-        if (bt->type() != dods_array_c)
-            continue;
-
-        Array &arr = dynamic_cast<Array&>(*bt);
-        DBG(cerr << "Array: " << arr.name() << endl);
-
-        AttrTable &at = arr.get_attr_table();
-
-        // FIXME
-        // There is no longer a 'cell_type' attribute in the spec...
-        AttrTable::Attr_iter iter_cell_type = at.simple_find("cell_type");
-
-        if (iter_cell_type != at.attr_end()) {
-            string cell_type = at.get_attr(iter_cell_type, 0);
-            DBG(cerr << cell_type << endl);
-            if (cell_type == "tri_ccw") {
-                // Ok, we expect triangles
-                // which means a shape of 3xN
-                // FIXME: The loop below checks that the array is 3xN and
-                // stores the size of the second dimension in twocell_count
-                int twocell_count = -1, i=0;
-                // FIXME total_size is only used in the loop below when the attribute
-                // 'index_origin' is found but that attribute is not defined in the spec.
-                // Do we need this?
-                int total_size = 1;
-                rank_dimensions[2] = vector<Array::dimension>();
-                for (Array::Dim_iter di = arr.dim_begin(); di!= arr.dim_end(); di++) {
-                    total_size *= di->c_size;
-                    rank_dimensions[2].push_back(*di);
-                    if (i == 0) {
-                        if (di->c_size != 3) {
-                            DBG(cerr << "Cell array of type 'tri_ccw' must have a shape of 3xN, since triangles have three nodes." << endl);
-                            throw Error(malformed_expr,"Cell array of type 'tri_ccw' must have a shape of 3xN, since triangles have three nodes.");
-                        }
-                    }
-                    if (i == 1) {
-                        twocell_count = di->c_size;
-                    }
-                    if (i>1) {
-                        DBG(cerr << "Too many dimensions for a cell array of type 'tri_ccw'.  Expected shape of 3XN" << endl);
-                        throw Error(malformed_expr,"Too many dimensions for a cell array of type 'tri_ccw'.  Expected shape of 3XN");
-                    }
-                    i++;
-                }
-
-                // interpret the array data as triangles
-                // FIXME Can allocate cellids without copying arr's values
-                GF::Node *cellids = extract_array<GF::Node>(&arr);
-                GF::Node *cellids2 = extract_array<GF::Node>(&arr);
-                // FIXME
-                // This loop appears to reorganize cellids so that it contains
-                // in in three consecutive values (0,1,2; 3,4,5; ...) the values
-                // from cellids2 0,N,2N; 1,1+N,1+2N; ...
-                // But cellids2 is never used anywhere else; consider rewriting
-                // so it does this repacking operation.
-                for (int j=0;j<twocell_count;j++) {   cellids[3*j]=cellids2[j];
-                    cellids[3*j+1]=cellids2[j+twocell_count];
-                    cellids[3*j+2]=cellids2[j+2*twocell_count];
-                }
-
-                // adjust for index origin
-                // FIXME There's no 'index_origin' attribute in the spec.
-                AttrTable::Attr_iter iter_index_origin = at.simple_find("index_origin");
-                if (iter_index_origin != at.attr_end()) {
-                    DBG(cerr << "Found an index origin attribute." << endl);
-                    AttrTable::entry *index_origin_entry = *iter_index_origin;
-                    int index_origin;
-                    if (index_origin_entry->attr->size() == 1) {
-                        AttrTable::entry *index_origin_entry = *iter_index_origin;
-                        string val = (*index_origin_entry->attr)[0];
-                        DBG(cerr << "Value: " << val << endl);
-                        stringstream buffer(val);
-                        // what happens if string cannot be converted to an integer?
-                        buffer >> index_origin;
-                        DBG(cerr << "converted: " << index_origin << endl);
-                        if (index_origin != 0) {
-                            for (int j=0; j<total_size; j++) {
-                                cellids[j] -= index_origin;
-                            }
-                        }
-                    }
-                    else {
-                        throw Error(malformed_expr,"Index origin attribute exists, but either no value supplied, or more than one value supplied.");
-                    }
-                }
-
-                // Create the cell array
-                // TODO Is this '3' the same as the '3' in '3xN'?
-                twocells = new GF::CellArray(cellids, twocell_count, 3);
-
-                return twocells;
-            }
-        }
-    }
-
-    throw Error("Could not find cell array of CCW triangles");
-
-#endif
-
-}
-
-#if 0
-static void addInputCells(Array *arr, int gridDimKey, GF::GridField *input)
-{
-	DBG(cerr << "Adding Data Array: " << arr->name() << " to GridField gridDimKey: " << gridDimKey << endl);
-	GF::Array *gfa = extract_gridfield_array(arr);
-	input->AddAttribute(gridDimKey, gfa);
-
-
-
-#if 0
-    // 3) For each var, bind it to the appropriate dimension
-
-    // For each variable in the data source:
-    GF::GridField *input = new GF::GridField(G);
-
-	DBG(cerr << "Data Array: " << arr->name() << endl);
-	GF::Array *gfa = extract_gridfield_array(arr);
-
-	// Each rank is associated with a sequence of dimensions
-	// Vars that have the same dimensions should be bound to the grid at that rank
-	// (Note that in gridfields, Dimension and rank are synonyms.  We
-	// use the latter here to avoid confusion).
-	map<GF::Dim_t, vector<Array::dimension> >::iterator iter;
-	for( iter = rank_dimensions.begin(); iter != rank_dimensions.end(); ++iter ) {
-		int gridDimKey = iter->first; // either 0 or 2
-		vector<Array::dimension> arrDims = iter->second;
-		bool same = same_dimensions(arr, arrDims);
-		if (same) {
-			// This var should be bound to rank k
-			// TODO This code sets AddAttribute(0, <grid_location --> 'node'>)
-			// (which occurs three times in test4.nc - X, Y, and nodedata) and
-			// AddAttribute(2, <the 3xN var>).
-			DBG(cerr << "Adding Attribute: " << gfa->sname() << endl);
-			input->AddAttribute(gridDimKey, gfa);
-		}
-		else {
-			// This array does not appear to be associated with any
-			// rank of the unstructured grid. Ignore for now.
-			// TODO Anything else we should do?
-			// FIXME Free the storage!!
-		}
-	}
-
-    return input;
-#endif
-
-}
-#endif
+}

 /**
@@ -2434,56 +2279,6 @@

 	return resultFcnDapArray;
-
-
-#if 0
-
-	// Scott's method
-	//GF::CellArray* Inb=(GF::CellArray*)(resultGridField->GetGrid()->getKCells(2));
-	Int32 *witnessn4 = new Int32(sourceMeshArray->name());
-	Array *resultMeshArray = new Array(sourceMeshArray->name(),witnessn4);
-	//vector< vector<int> > nodes2 = Inb->makeArrayInts();
-	vector<dods_int32> node1;
-	vector<dods_int32> node2;
-	vector<dods_int32> node3;
-	for (unsigned int j=0; j < nodes2.size(); j++) {
-		node1.push_back(nodes2.at(j).at(0));
-		node2.push_back(nodes2.at(j).at(1));
-		node3.push_back(nodes2.at(j).at(2));
-	}
-	Int32 *witnessn1=new Int32("nodes1");
-	Int32 *witnessn2=new Int32("nodes2");
-	Int32 *witnessn3=new Int32("nodes3");
-	Array *Node1=new Array("trinode1",witnessn1);
-	Array *Node2=new Array("trinode2",witnessn2);
-	Array *Node3=new Array("trinode3",witnessn3);
-	Node1->append_dim(node1.size(),"dim-1");
-
-	Node2->append_dim(node2.size(),"dim-1");
-	Node3->append_dim(node3.size(),"dim-1");
-
-	Node1->set_value(node1,node1.size());
-	Node2->set_value(node2,node2.size());
-	Node3->set_value(node3,node3.size());
-
-	resultMeshArray->append_dim(3,"three");
-	resultMeshArray->append_dim(node1.size(),"tris");
-	resultMeshArray->reserve_value_capacity(3*node1.size());
-	resultMeshArray->set_value_slice_from_row_major_vector(*Node1,0);
-	resultMeshArray->set_value_slice_from_row_major_vector(*Node2,Node1->length());
-	resultMeshArray->set_value_slice_from_row_major_vector(*Node3,Node1->length()+Node2->length());
-	AttrTable &arrattr1 = sourceMeshArray->get_attr_table();
-	resultMeshArray->set_attr_table(arrattr1);
-
-	DBG(cerr<<endl<<endl;
-		cerr << "Scott's resultMeshArray with data values: "<< endl;
-		resultMeshArray->print_val(cerr);
-	    cerr<<endl<<endl;
-	   )
-
-	//return resultMeshArray;
-
-#endif

 }

@@ -2551,8 +2346,6 @@
  */
 static Structure *convertUgridResultToDapObject(GF::GridField *resultGridField, BaseType *meshTopologyVar, Array *rangeVar, vector<Array *> *coordinateVars, Array *sourceFaceNodeConnectivityArray)
 {
-
-
 	resultGridField->GetGrid()->normalize();

 	//FIXME Change the name of this structure to "ugr_result"
@@ -2579,104 +2372,6 @@
 	construct->add_var_nocopy(resultFaceNodeConnectivityDapArray);

     return construct;
-
-
-#if 0
-
-    // 4) Convert back to a DDS BaseType
-
-    // Create variables for each cell dimension
-    // Create variables for each attribute at each rank
-
-    R->GetGrid()->normalize();
-
-    Structure *construct = new Structure("construct");
-
-    // FIXME This code loops through the DDS and finds the variables
-    // that were the sources of information used by Gridfields (there are four)
-    // and uses those names to make the names of the four result variables.
-    // It also copies the attribute table from those variables.
-    for (DDS::Vars_iter vi = dds.var_begin(); vi != dds.var_end(); vi++) {
-        BaseType *bt = *vi;
-        if (bt->type() == dods_array_c) {
-            Array *arr = (Array *)bt;
-            map<GF::Dim_t, vector<Array::dimension> >::iterator iter;
-
-            AttrTable &arrattr2 = arr->get_attr_table();
-
-            if(arrattr2.simple_find("cell_type")!=arrattr2.attr_end())
-            {
-                GF::CellArray* Inb=(GF::CellArray*)(R->GetGrid()->getKCells(2));
-                Int32 *witnessn4 = new Int32(arr->name());
-                Array *Nodes = new Array(arr->name(),witnessn4);
-                vector< vector<int> > nodes2 = Inb->makeArrayInts();
-                vector<dods_int32> node1;
-                vector<dods_int32> node2;
-                vector<dods_int32> node3;
-                for (unsigned int j=0; j < nodes2.size(); j++) {
-                    node1.push_back(nodes2.at(j).at(0));
-                    node2.push_back(nodes2.at(j).at(1));
-                    node3.push_back(nodes2.at(j).at(2));
-                }
-                Int32 *witnessn1=new Int32("nodes1");
-                Int32 *witnessn2=new Int32("nodes2");
-                Int32 *witnessn3=new Int32("nodes3");
-                Array *Node1=new Array("trinode1",witnessn1);
-                Array *Node2=new Array("trinode2",witnessn2);
-                Array *Node3=new Array("trinode3",witnessn3);
-                Node1->append_dim(node1.size(),"dim-1");
-
-                Node2->append_dim(node2.size(),"dim-1");
-                Node3->append_dim(node3.size(),"dim-1");
-
-                Node1->set_value(node1,node1.size());
-                Node2->set_value(node2,node2.size());
-                Node3->set_value(node3,node3.size());
-
-                Nodes->append_dim(3,"three");
-                Nodes->append_dim(node1.size(),"tris");
-                Nodes->reserve_value_capacity(3*node1.size());
-                Nodes->set_value_slice_from_row_major_vector(*Node1,0);
-                Nodes->set_value_slice_from_row_major_vector(*Node2,Node1->length());
-                Nodes->set_value_slice_from_row_major_vector(*Node3,Node1->length()+Node2->length());
-                AttrTable &arrattr1 = arr->get_attr_table();
-                Nodes->set_attr_table(arrattr1);
-
-                construct->add_var_nocopy(Nodes);
-            }
-            else {
-                for( iter = rank_dimensions.begin(); iter != rank_dimensions.end(); ++iter ) {
-                    bool same = same_dimensions(arr, iter->second);
-                    if (same) {
-                        // This var should be bound to rank k
-                        Float64 *witness2 = new Float64(arr->name());
-
-                        GF::Array* gfa = R->GetAttribute(iter->first, arr->name());
-
-                        vector<dods_float64> GFA = gfa->makeArrayf();
-
-                        Array *Nodes = new Array(arr->name(), witness2);
-                        Nodes->append_dim(GFA.size(), "nodes");
-                        Nodes->set_value(GFA,GFA.size());
-
-                        AttrTable &arrattr1 = arr->get_attr_table();
-                        Nodes->set_attr_table(arrattr1);
-                        // AttrTable &arrattr = Nodes->get_attr_table();
-
-                        construct->add_var_nocopy(Nodes);
-                    }
-                    else {
-                        // This array does not appear to be associated with
-                        // any rank of the unstructured grid. Ignore for now.
-                        // Anything else we should do?
-                    }
-                }
-            }
-        }
-    }
-
-    return construct;
-#endif
 }


Updated deprecated bulk write calls. Removed commented out code

--- plugins/mongo_db_plugin/mongo_db_plugin.cpp
+++ plugins/mongo_db_plugin/mongo_db_plugin.cpp
@@ -338,7 +338,7 @@
    auto find_transaction(mongocxx::collection& trans, const string& id) {
       using bsoncxx::builder::stream::document;
       document find_trans{};
-      find_trans << "trans_id" << id;
+      find_trans << "trx_id" << id;
       return trans.find_one(find_trans.view());
    }

@@ -588,23 +588,23 @@
    auto now = std::chrono::duration_cast<std::chrono::milliseconds>(
          std::chrono::microseconds{fc::time_point::now().time_since_epoch().count()});

-   const auto trans_id = t->id;
-   const auto trans_id_str = trans_id.str();
+   const auto trx_id = t->id;
+   const auto trx_id_str = trx_id.str();
    const auto& trx = t->trx;
    const chain::transaction_header& trx_header = trx;

-   const auto existing = find_transaction(trans, trans_id_str);
+   const auto existing = find_transaction(trans, trx_id_str);

    bool actions_to_write = false;
    mongocxx::options::bulk_write bulk_opts;
    bulk_opts.ordered(false);
-   mongocxx::bulk_write bulk_actions{bulk_opts};
+   mongocxx::bulk_write bulk_actions = actions.create_bulk_write(bulk_opts);

    int32_t act_num = 0;
-   auto process_action = [&](const std::string& trans_id_str, const chain::action& act, bsoncxx::builder::basic::array& act_array) -> auto {
+   auto process_action = [&](const std::string& trx_id_str, const chain::action& act, bsoncxx::builder::basic::array& act_array) -> auto {
       auto act_doc = bsoncxx::builder::basic::document();
       act_doc.append(kvp("action_num", b_int32{act_num}),
-                     kvp("trans_id", trans_id_str));
+                     kvp("trx_id", trx_id_str));
       act_doc.append(kvp("account", act.account.to_string()));
       act_doc.append(kvp("name", act.name.to_string()));
       act_doc.append(kvp("authorization", [&act](bsoncxx::builder::basic::sub_array subarr) {
@@ -627,7 +627,7 @@
    if (existing) {
       FC_ASSERT("Should only get accept transaction once.");
    } else {
-      trans_doc.append( kvp( "trans_id", trans_id_str ),
+      trans_doc.append( kvp( "trx_id", trx_id_str ),
                         kvp( "irreversible", b_bool{false} ) );

       string signing_keys_json;
@@ -657,7 +657,7 @@
       if( !trx.actions.empty()) {
          bsoncxx::builder::basic::array action_array;
          for( const auto& act : trx.actions ) {
-            process_action( trans_id_str, act, action_array );
+            process_action( trx_id_str, act, action_array );
          }
          trans_doc.append( kvp( "actions", action_array ) );
       }
@@ -666,7 +666,7 @@
       if( !trx.context_free_actions.empty()) {
          bsoncxx::builder::basic::array action_array;
          for( const auto& cfa : trx.context_free_actions ) {
-            process_action( trans_id_str, cfa, action_array );
+            process_action( trx_id_str, cfa, action_array );
          }
          trans_doc.append( kvp( "context_free_actions", action_array ) );
       }
@@ -706,13 +706,13 @@
       trans_doc.append( kvp( "createdAt", b_date{now} ));

       if( !trans.insert_one( trans_doc.view())) {
-         elog( "Failed to insert trans ${id}", ("id", trans_id));
+         elog( "Failed to insert trans ${id}", ("id", trx_id));
       }

       if (actions_to_write) {
-         auto result = actions.bulk_write(bulk_actions);
+         auto result = bulk_actions.execute();
          if (!result) {
-            elog("Bulk actions insert failed for transaction: ${id}", ("id", trans_id_str));
+            elog("Bulk actions insert failed for transaction: ${id}", ("id", trx_id_str));
          }
       }

@@ -729,10 +729,10 @@
    auto now = std::chrono::duration_cast<std::chrono::milliseconds>(
          std::chrono::microseconds{fc::time_point::now().time_since_epoch().count()});

-   const auto trans_id = t->id;
-   const auto trans_id_str = trans_id.str();
-
-   const auto existing = find_transaction(trans_traces, trans_id_str);
+   const auto trx_id = t->id;
+   const auto trx_id_str = trx_id.str();
+
+   const auto existing = find_transaction(trans_traces, trx_id_str);

    if (existing) {
       FC_ASSERT("Should only get applied transaction once.");
@@ -749,7 +749,7 @@
       }

       if( !trans_traces.insert_one( trans_traces_doc.view())) {
-         elog( "Failed to insert trans ${id}", ("id", trans_id));
+         elog( "Failed to insert trans ${id}", ("id", trx_id));
       }
    }
 }
@@ -759,17 +759,8 @@
    using namespace bsoncxx::builder;
    using bsoncxx::builder::basic::kvp;

-   mongocxx::options::bulk_write bulk_opts;
-   bulk_opts.ordered(false);
-   mongocxx::bulk_write bulk_trans{bulk_opts};
-
    auto block_states = mongo_conn[db_name][block_states_col];
    auto blocks = mongo_conn[db_name][blocks_col];
-   auto trans = mongo_conn[db_name][trans_col];
-
-   if (bs->block->transactions.size() > 1) {
-      std::cout << fc::json::to_pretty_string( *bs ) << std::endl;
-   }

    auto block_doc = bsoncxx::builder::basic::document{};
    auto block_state_doc = bsoncxx::builder::basic::document{};
@@ -818,202 +809,6 @@
    if (!blocks.insert_one(block_doc.view())) {
       elog("Failed to insert block ${bid}", ("bid", block_id));
    }
-
-/* todo
-   int32_t msg_num = -1;
-   bool actions_to_write = false;
-   auto process_action = [&](const std::string& trans_id_str, mongocxx::bulk_write& bulk_msgs, const chain::action& msg) -> auto {
-      auto msg_oid = bsoncxx::oid{};
-      auto msg_doc = bsoncxx::builder::basic::document{};
-      msg_doc.append(kvp("_id", b_oid{msg_oid}),
-                     kvp("action_id", b_int32{msg_num}),
-                     kvp("transaction_id", trans_id_str));
-      msg_doc.append(kvp("authorization", [&msg](bsoncxx::builder::basic::sub_array subarr) {
-         for (const auto& auth : msg.authorization) {
-            subarr.append([&auth](bsoncxx::builder::basic::sub_document subdoc) {
-               subdoc.append(kvp("actor", auth.actor.to_string()),
-                             kvp("permission", auth.permission.to_string()));
-            });
-         }
-      }));
-      msg_doc.append(kvp("handler_account_name", msg.account.to_string()));
-      msg_doc.append(kvp("name", msg.name.to_string()));
-      add_data(msg_doc, accounts, msg);
-      msg_doc.append(kvp("createdAt", b_date{now}));
-      mongocxx::model::insert_one insert_msg{msg_doc.view()};
-      bulk_msgs.append(insert_msg);
-      actions_to_write = true;
-      ++msg_num;
-      return msg_oid;
-   };
-
-   bool action_traces_to_write = false;
-   auto process_action_trace = [&](const std::string& trans_id_str,
-                                   mongocxx::bulk_write& bulk_acts,
-                                   const chain::action_trace& act,
-                                   const auto& msg_oid)
-   {
-//      auto act_oid = bsoncxx::oid{};
-      auto act_doc = bsoncxx::builder::basic::document{};
-      act_doc.append(kvp("_id", b_oid{act_oid}),
-                     kvp("transaction_id", trans_id_str),
-                     kvp("receiver", act.receipt.receiver.to_string()),
-                     kvp("action", b_oid{msg_oid}),
-                     kvp("console", act.console));
-      act_doc.append(kvp("data_access", [&act](bsoncxx::builder::basic::sub_array subarr) {
-         for (const auto& data : act.data_access) {
-            subarr.append([&data](bsoncxx::builder::basic::sub_document subdoc) {
-               subdoc.append(kvp("type", data.type == chain::data_access_info::read ? "read" : "write"),
-                             kvp("code", data.code.to_string()),
-                             kvp("scope", data.scope.to_string()),
-                             kvp("sequence", b_int64{static_cast<int64_t>(data.sequence)}));
-            });
-         }
-      }));
-      act_doc.append(kvp("createdAt", b_date{now}));
-      mongocxx::model::insert_one insert_act{act_doc.view()};
-      bulk_acts.append(insert_act);
-      action_traces_to_write = true;
-   };
-
-   int32_t trx_num = 0;
-   std::map<chain::transaction_id_type, std::string> trx_status_map;
-   bool transactions_in_block = false;
-
-   auto process_trx = [&](const chain::transaction& trx) -> auto {
-      auto txn_oid = bsoncxx::oid{};
-      auto doc = bsoncxx::builder::basic::document{};
-      auto trx_id = trx.id();
-      const auto trans_id_str = trx_id.str();
-      doc.append(kvp("_id", txn_oid),
-                 kvp("transaction_id", trans_id_str),
-                 kvp("sequence_num", b_int32{trx_num}),
-                 kvp("block_id", block_id_str),
-                 kvp("ref_block_num", b_int32{static_cast<int32_t >(trx.ref_block_num)}),
-                 kvp("ref_block_prefix", b_int32{static_cast<int32_t >(trx.ref_block_prefix)}),
-                 kvp("status", trx_status_map[trx_id]),
-                 kvp("expiration",
-                     b_date{std::chrono::milliseconds{std::chrono::seconds{trx.expiration.sec_since_epoch()}}}),
-                 kvp("pending", b_bool{true})
-      );
-      doc.append(kvp("createdAt", b_date{now}));
-
-      if (!trx.actions.empty()) {
-         mongocxx::bulk_write bulk_msgs{bulk_opts};
-         msg_num = 0;
-         for (const auto& msg : trx.actions) {
-            process_action(trans_id_str, bulk_msgs, msg);
-         }
-         auto result = msgs.bulk_write(bulk_msgs);
-         if (!result) {
-            elog("Bulk action insert failed for block: ${bid}, transaction: ${trx}",
-                 ("bid", block_id)("trx", trx_id));
-         }
-      }
-      transactions_in_block = true;
-      return doc;
-   };
-*/
-   mongocxx::bulk_write bulk_msgs{bulk_opts};
-   mongocxx::bulk_write bulk_acts{bulk_opts};
-
-
-   /* todo
-   trx_num = 1000000;
-   for (const auto& rt: bt.region_traces) {
-      for (const auto& ct: rt.cycle_traces) {
-         for (const auto& st: ct.shard_traces) {
-            for (const auto& trx_trace: st.transaction_traces) {
-               std::string trx_status = (trx_trace.status == chain::transaction_receipt::executed) ? "executed" :
-                                        (trx_trace.status == chain::transaction_receipt::soft_fail) ? "soft_fail" :
-                                        (trx_trace.status == chain::transaction_receipt::hard_fail) ? "hard_fail" :
-                                        "unknown";
-               trx_status_map[trx_trace.id] = trx_status;
-
- //              for (const auto& req : trx_trace.deferred_transaction_requests) {
-                  if ( req.contains<chain::deferred_transaction>() ) {
-                     auto trx = req.get<chain::deferred_transaction>();
-                     auto doc = process_trx(trx);
-                     doc.append(kvp("type", "deferred"),
-                                kvp("sender_id", b_int64{static_cast<int64_t>(trx.sender_id)}),
-                                kvp("sender", trx.sender.to_string()),
-                                kvp("execute_after", b_date{std::chrono::milliseconds{
-                                         std::chrono::seconds{trx.execute_after.sec_since_epoch()}}}));
-                     mongocxx::model::insert_one insert_op{doc.view()};
-                     bulk_trans.append(insert_op);
-                     ++trx_num;
-                  } else {
-                     auto cancel = req.get<chain::deferred_reference>();
-                     auto doc = bsoncxx::builder::basic::document{};
-                     doc.append(kvp("type", "cancel_deferred"),
-                                kvp("sender_id", b_int64{static_cast<int64_t>(cancel.sender_id)}),
-                                kvp("sender", cancel.sender.to_string())
-                     );
-                  }
-               }
-               if (!trx_trace.action_traces.empty()) {
-                  actions_to_write = true;
-                  msg_num = 1000000;
-                  for (const auto& act_trace : trx_trace.action_traces) {
-                     const auto& msg = act_trace.act;
-                     auto msg_oid = process_action(trx_trace.id.str(), bulk_msgs, msg);
-                     if (trx_trace.status == chain::transaction_receipt::executed) {
-                        if (act_trace.receiver == chain::config::system_account_name) {
-                           reversible_actions[trx_trace.id.str()].emplace_back(msg);
-                        }
-                     }
-                     process_action_trace(trx_trace.id.str(), bulk_acts, act_trace, msg_oid);
-                  }
-               }
-
-               // TODO: handle canceled_deferred
-            }
-         }
-      }
-   }
-
-   trx_num = 0;
-   for (const auto& packed_trx : block.input_transactions) {
-      const signed_transaction& trx = packed_trx.get_signed_transaction();
-      auto doc = process_trx(trx);
-      doc.append(kvp("type", "input"));
-      doc.append(kvp("signatures", [&trx](bsoncxx::builder::basic::sub_array subarr) {
-         for (const auto& sig : trx.signatures) {
-            subarr.append(fc::variant(sig).as_string());
-         }
-      }));
-      mongocxx::model::insert_one insert_op{doc.view()};
-      bulk_trans.append(insert_op);
-      ++trx_num;
-   }
-
-   for (const auto& implicit_trx : bt.implicit_transactions ){
-      auto doc = process_trx(implicit_trx);
-      doc.append(kvp("type", "implicit"));
-      mongocxx::model::insert_one insert_op{doc.view()};
-      bulk_trans.append(insert_op);
-      ++trx_num;
-   }
-
-   if (actions_to_write) {
-      auto result = msgs.bulk_write(bulk_msgs);
-      if (!result) {
-         elog("Bulk actions insert failed for block: ${bid}", ("bid", block_id));
-      }
-   }
-   if (action_traces_to_write) {
-      auto result = action_traces.bulk_write(bulk_acts);
-      if (!result) {
-         elog("Bulk action traces insert failed for block: ${bid}", ("bid", block_id));
-      }
-   }
-   if (transactions_in_block) {
-      auto result = trans.bulk_write(bulk_trans);
-      if (!result) {
-         elog("Bulk transaction insert failed for block: ${bid}", ("bid", block_id));
-      }
-   }
-    */
 }

 void mongo_db_plugin_impl::_process_irreversible_block(const chain::block_state_ptr& bs)
@@ -1051,19 +846,19 @@
    auto bulk = trans.create_bulk_write(bulk_opts);

    for (const auto& receipt : bs->block->transactions) {
-      string trans_id_str;
+      string trx_id_str;
       if( receipt.trx.contains<packed_transaction>()) {
          const auto& pt = receipt.trx.get<packed_transaction>();
          // get id via get_raw_transaction() as packed_transaction.id() mutates inernal transaction state
          const auto& raw = pt.get_raw_transaction();
          const auto& id = fc::raw::unpack<transaction>(raw).id();
-         trans_id_str = id.str();
+         trx_id_str = id.str();
       } else {
          const auto& id = receipt.trx.get<transaction_id_type>();
-         trans_id_str = id.str();
-      }
-
-      auto ir_trans = find_transaction(trans, trans_id_str);
+         trx_id_str = id.str();
+      }
+
+      auto ir_trans = find_transaction(trans, trx_id_str);

       if (ir_trans) {
          auto update_doc = make_document( kvp( "$set", make_document( kvp( "irreversible", b_bool{true} ),
@@ -1079,41 +874,11 @@
    }

    if (transactions_in_block) {
-      auto result = trans.bulk_write(bulk);
+      auto result = bulk.execute();
       if (!result) {
          elog("Bulk transaction insert failed for block: ${bid}", ("bid", block_id));
       }
    }
-
-
-/* todo
-   for (const auto& r: block.regions) {
-      for (const auto& cs: r.cycles_summary) {
-         for (const auto& ss: cs) {
-            for (const auto& trx_receipt: ss.transactions) {
-               const auto trans_id_str = trx_receipt.id.str();
-               auto ir_trans = find_transaction(trans, trans_id_str);
-
-               document update_trans{};
-               update_trans << "$set" << open_document << "pending" << b_bool{false}
-                            << "updatedAt" << b_date{now}
-                            << close_document;
-
-               trans.update_one(document{} << "_id" << ir_trans.view()["_id"].get_oid() << finalize,
-                                update_trans.view());
-
-               // actions are irreversible, so update account document
-               if (ir_trans.view()["status"].get_utf8().value.to_string() == "executed") {
-                  for (const auto& msg : reversible_actions[trans_id_str]) {
-                     update_account(msg);
-                  }
-               }
-               reversible_actions.erase(trans_id_str);
-            }
-         }
-      }
-   }
-*/
 }

 mongo_db_plugin_impl::mongo_db_plugin_impl()
@@ -1178,10 +943,10 @@

       // transactions indexes
       auto trans = mongo_conn[db_name][trans_col]; // Transactions
-      trans.create_index(bsoncxx::from_json(R"xxx({ "trans_id" : 1 })xxx"));
+      trans.create_index(bsoncxx::from_json(R"xxx({ "trx_id" : 1 })xxx"));

       auto actions = mongo_conn[db_name][actions_col];
-      actions.create_index(bsoncxx::from_json(R"xxx({ "trans_id" : 1 })xxx"));
+      actions.create_index(bsoncxx::from_json(R"xxx({ "trx_id" : 1 })xxx"));
    }
 }


Add handling for std::alloc

Add handling for std::alloc

--- plugins/producer_plugin/producer_plugin.cpp
+++ plugins/producer_plugin/producer_plugin.cpp
@@ -47,6 +47,9 @@
 #define LOG_AND_DROP()  \
    catch ( const guard_exception& e ) { \
       chain_plugin::handle_guard_exception(e); \
+   } catch ( const std::bad_alloc& ) { \
+      elog( "std::bad_alloc" ); \
+      throw; \
    } catch ( boost::interprocess::bad_alloc& ) { \
       chain_plugin::handle_db_exhaustion(); \
    } catch( fc::exception& er ) { \


Add missing handling of guard exception by using a custom LOG_AND_DROP macro

--- plugins/producer_plugin/producer_plugin.cpp
+++ plugins/producer_plugin/producer_plugin.cpp
@@ -43,6 +43,28 @@
 using std::vector;
 using std::deque;
 using boost::signals2::scoped_connection;
+
+#undef FC_LOG_AND_DROP
+#define LOG_AND_DROP()  \
+   catch ( const guard_exception& e ) { \
+      chain_plugin::handle_guard_exception(e); \
+   } catch ( boost::interprocess::bad_alloc& ) { \
+      chain_plugin::handle_db_exhaustion(); \
+   } catch( fc::exception& er ) { \
+      wlog( "${details}", ("details",er.to_detail_string()) ); \
+   } catch( const std::exception& e ) {  \
+      fc::exception fce( \
+                FC_LOG_MESSAGE( warn, "std::exception: ${what}: ",("what",e.what()) ), \
+                fc::std_exception_code,\
+                BOOST_CORE_TYPEID(e).name(), \
+                e.what() ) ; \
+      wlog( "${details}", ("details",fce.to_detail_string()) ); \
+   } catch( ... ) {  \
+      fc::unhandled_exception e( \
+                FC_LOG_MESSAGE( warn, "unknown: ",  ), \
+                std::current_exception() ); \
+      wlog( "${details}", ("details",e.to_detail_string()) ); \
+   }

 const fc::string logger_name("producer_plugin");
 fc::logger _log;
@@ -342,7 +364,7 @@
                _unapplied_transactions.add_forked( forked_branch );
             } );
          } catch ( const guard_exception& e ) {
-            chain_plug->handle_guard_exception(e);
+            chain_plugin::handle_guard_exception(e);
             return;
          } catch( const fc::exception& e ) {
             elog((e.to_detail_string()));
@@ -521,7 +543,7 @@
             }

          } catch ( const guard_exception& e ) {
-            chain_plug->handle_guard_exception(e);
+            chain_plugin::handle_guard_exception(e);
          } catch ( boost::interprocess::bad_alloc& ) {
             chain_plugin::handle_db_exhaustion();
          } CATCH_AND_CALL(send_response);
@@ -703,6 +725,7 @@
 { try {
    my->chain_plug = app().find_plugin<chain_plugin>();
    EOS_ASSERT( my->chain_plug, plugin_config_exception, "chain_plugin not found" );
+   chain_plugin* chain_plug = my->chain_plug;
    my->_options = &options;
    LOAD_VALUE_SET(options, "producer-name", my->_producers)

@@ -801,13 +824,13 @@
    my->_incoming_block_subscription = app().get_channel<incoming::channels::block>().subscribe([this](const signed_block_ptr& block){
       try {
          my->on_incoming_block(block);
-      } FC_LOG_AND_DROP();
+      } LOG_AND_DROP();
    });

    my->_incoming_transaction_subscription = app().get_channel<incoming::channels::transaction>().subscribe([this](const transaction_metadata_ptr& trx){
       try {
          my->on_incoming_transaction_async(trx, false, [](const auto&){});
-      } FC_LOG_AND_DROP();
+      } LOG_AND_DROP();
    });

    my->_incoming_block_sync_provider = app().get_method<incoming::methods::block_sync>().register_provider([this](const signed_block_ptr& block){
@@ -1420,7 +1443,7 @@
       }

       chain.start_block( block_time, blocks_to_confirm, features_to_activate );
-   } FC_LOG_AND_DROP();
+   } LOG_AND_DROP();

    if( chain.is_building_block() ) {
       auto pending_block_time = chain.pending_block_time();
@@ -1516,10 +1539,7 @@
                      itr = _unapplied_transactions.erase( itr );
                      continue;
                   }
-               } catch( const guard_exception& e ) {
-                  chain_plug->handle_guard_exception( e );
-                  return start_block_result::failed;
-               } FC_LOG_AND_DROP();
+               } LOG_AND_DROP();
                ++itr;
             }

@@ -1623,10 +1643,7 @@
                   } else {
                      num_applied++;
                   }
-               } catch ( const guard_exception& e ) {
-                  chain_plug->handle_guard_exception(e);
-                  return start_block_result::failed;
-               } FC_LOG_AND_DROP();
+               } LOG_AND_DROP();

                _incoming_trx_weight += _incoming_defer_ratio;
                if (!orig_pending_txn_size) _incoming_trx_weight = 0.0;
@@ -1664,6 +1681,9 @@
             return start_block_result::succeeded;
          }

+      } catch ( const guard_exception& e ) {
+         chain_plugin::handle_guard_exception(e);
+         return start_block_result::failed;
       } catch ( boost::interprocess::bad_alloc& ) {
          chain_plugin::handle_db_exhaustion();
          return start_block_result::failed;
@@ -1788,17 +1808,9 @@
    });

    try {
-      try {
-         produce_block();
-         return true;
-      } catch ( const guard_exception& e ) {
-         chain_plug->handle_guard_exception(e);
-         return false;
-      } FC_LOG_AND_DROP();
-   } catch ( boost::interprocess::bad_alloc&) {
-      chain_plugin::handle_db_exhaustion();
-      return false;
-   }
+      produce_block();
+      return true;
+   } LOG_AND_DROP();

    fc_dlog(_log, "Aborting block due to produce_block error");
    chain::controller& chain = chain_plug->chain();


[JNI] Temporary bug fix.

[JNI] Temporary bug fix.

--- jni/src/main/native/ops/jvm_callback_op.cc
+++ jni/src/main/native/ops/jvm_callback_op.cc
@@ -86,7 +86,7 @@
       const Tensor& t = call->inputs[i];
       TFE_TensorHandle* tensor;
 //      if (call->gpu) {
-//        // TODO: Obtain the device from the tensor itself, rather than from the call.
+//        // TODO: !!! [CALLBACK] Obtain the device from the tensor itself, rather than from the call.
 //        tensor = new TFE_TensorHandle(t, call->device, call->device);
 //      } else {
 //        tensor = new TFE_TensorHandle(t, nullptr, nullptr);
@@ -295,10 +295,11 @@
     REGISTER_KERNEL_BUILDER(Name("JVMCallback").Device(DEVICE_CPU), JVMCallbackOp);
     REGISTER_KERNEL_BUILDER(Name("JVMCallbackStateless").Device(DEVICE_CPU), JVMCallbackOp);
   }
-  if (reg->find(strings::StrCat("JVMCallback:", DeviceTypeString(DEVICE_GPU), ":")) == reg->end()) {
-    REGISTER_KERNEL_BUILDER(Name("JVMCallback").Device(DEVICE_GPU), JVMCallbackOp);
-    REGISTER_KERNEL_BUILDER(Name("JVMCallbackStateless").Device(DEVICE_GPU), JVMCallbackOp);
-  }
+  // TODO: !!! [CALLBACK] Temporary.
+//  if (reg->find(strings::StrCat("JVMCallback:", DeviceTypeString(DEVICE_GPU), ":")) == reg->end()) {
+//    REGISTER_KERNEL_BUILDER(Name("JVMCallback").Device(DEVICE_GPU), JVMCallbackOp);
+//    REGISTER_KERNEL_BUILDER(Name("JVMCallbackStateless").Device(DEVICE_GPU), JVMCallbackOp);
+//  }
   return 0;
 }();
 }


Fixed small bug that prevented the freeing of resources when the driver is
closed

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

--- plugins/sound/driver/coreaudio/casnddrv.cpp
+++ plugins/sound/driver/coreaudio/casnddrv.cpp
@@ -104,7 +104,7 @@

     // Creation went ok, copy to local variables
     soundRender = render;
-    isStereo = true;
+    isStereo = (outStreamDesc.mChannelsPerFrame == 2);
     is16Bit = true;
     frequency = (int) outStreamDesc.mSampleRate;

@@ -121,9 +121,11 @@
     status = AudioDeviceStart(audioDevice, AudioProc);
     if (status != 0)
         return false;
-
-
-  return true;
+
+    // Indicate that Initialization has completed
+    isPlaying = true;
+
+    return true;
 }

@@ -210,9 +212,10 @@
     // Create new samples
     soundRender->MixingFunction();

-    // Copy and scale Crystal Space samples to float the CoreAudio can use
+    // Copy and scale Crystal Space samples to the floats that CoreAudio can use
+    float scaleFactor = 1.0f / SHRT_MAX;
     for (int i = 0; i < SAMPLES_PER_BUFFER; i++)
-        buffer[i] = memory[i] * (1.0f / SHRT_MAX);
+        buffer[i] = memory[i] * scaleFactor;
 };


Got interpolation working as spline interpolation again.

--- src/IECoreMaya/FloatSplineParameterHandler.cpp
+++ src/IECoreMaya/FloatSplineParameterHandler.cpp
@@ -161,7 +161,9 @@

 		s = pointPlug.child( 0 ).setValue( it->first ); assert( s );
 		s = pointPlug.child( 1 ).setValue( it->second ); assert( s );
-		s = pointPlug.child( 2 ).setValue( MRampAttribute::kSpline ); assert( s );
+		// hardcoding interpolation of 3 (spline) because the MRampAttribute::MInterpolation enum values don't actually
+		// correspond to the necessary plug values at all.
+		s = pointPlug.child( 2 ).setValue( 3 ); assert( s );

 		numExpectedPoints++;
 	}


Implement cross-platform build for ogre profiling code.

--- src/Core/OgreRenderingModule/OgreRenderingModule.cpp
+++ src/Core/OgreRenderingModule/OgreRenderingModule.cpp
@@ -47,10 +47,13 @@

 #ifdef OGRE_HAS_PROFILER_HOOKS

+#ifdef WIN32
 DWORD mainThreadId;
+#endif
+
 void Profiler_BeginBlock(const char *name)
 {
-#ifdef PROFILING
+#if defined(PROFILING) && defined(WIN32)
     if (GetCurrentThreadId() != mainThreadId)
         return;
     Framework *fw = Framework::Instance();
@@ -62,7 +65,7 @@

 void Profiler_EndBlock()
 {
-#ifdef PROFILING
+#if defined(PROFILING) && defined(WIN32)
     if (GetCurrentThreadId() != mainThreadId)
         return;
     Framework *fw = Framework::Instance();
@@ -83,7 +86,9 @@
     IModule("OgreRendering")
 {
 #ifdef OGRE_HAS_PROFILER_HOOKS
+#ifdef WIN32
     mainThreadId = GetCurrentThreadId();
+#endif
     OgreProfiler_BeginBlock = Profiler_BeginBlock;
     OgreProfiler_EndBlock = Profiler_EndBlock;
 #endif


Replace deprecated llvm::Optional methods

Generated by applying -Wdeprecated-declarations fixes from clang.

These are removed in https://github.com/llvm/llvm-project/commit/4b6b248731b81deb471838ff79392993aeb6c621

PiperOrigin-RevId: 490693728

--- sair_ops.cc
+++ sair_ops.cc
@@ -963,7 +963,7 @@
     }
   }

-  if (op.getInstances().has_value() && op.getInstances().getValue().empty()) {
+  if (op.getInstances().has_value() && op.getInstances().value().empty()) {
     return op.emitOpError() << "must have an instance";
   }


Small simplification

Small simplification

--- tools/jxl_from_tree.cc
+++ tools/jxl_from_tree.cc
@@ -419,8 +419,7 @@
   *metadata = io.metadata;
   JXL_RETURN_IF_ERROR(metadata->size.Set(io.xsize(), io.ysize()));

-  metadata->m.xyb_encoded =
-      cparams.color_transform == ColorTransform::kXYB ? true : false;
+  metadata->m.xyb_encoded = cparams.color_transform == ColorTransform::kXYB;

   JXL_RETURN_IF_ERROR(WriteHeaders(metadata.get(), &writer, nullptr));
   writer.ZeroPadToByte();


llvm-pta-ben: make it compile

llvm-pta-ben: make it compile

There were a lot of changes since the PR.

--- tools/llvm-pta-ben.cpp
+++ tools/llvm-pta-ben.cpp
@@ -3,6 +3,7 @@
 #endif

 #include <set>
+#include <vector>
 #include <string>
 #include <iostream>
 #include <sstream>
@@ -39,22 +40,25 @@
 #pragma GCC diagnostic pop
 #endif

-#include "llvm/analysis/PointsTo/PointsTo.h"
-#include "analysis/PointsTo/PointsToFlowInsensitive.h"
-#include "analysis/PointsTo/PointsToFlowSensitive.h"
-#include "analysis/PointsTo/Pointer.h"
+#include "dg/llvm/analysis/PointsTo/PointerAnalysis.h"
+#include "dg/analysis/PointsTo/PointerAnalysisFI.h"
+#include "dg/analysis/PointsTo/PointerAnalysisFS.h"
+#include "dg/analysis/PointsTo/PointerAnalysisFSInv.h"
+#include "dg/analysis/PointsTo/Pointer.h"

 #include "TimeMeasure.h"

 using namespace dg;
 using namespace dg::analysis::pta;
+using dg::debug::TimeMeasure;
 using llvm::errs;

-static bool verbose;
+std::unique_ptr<PointerAnalysis> PA;

 enum PTType {
-  FLOW_SENSITIVE = 1,
-  FLOW_INSENSITIVE,
+    FLOW_SENSITIVE = 1,
+    FLOW_INSENSITIVE,
+    WITH_INVALIDATE,
 };

 static std::string
@@ -75,32 +79,8 @@
   return ostr.str();
 }

-void printPSNodeType(enum PSNodeType type)
-{
-#define ELEM(t) case t: do {printf("%s", #t); }while(0); break;
-  switch(type) {
-    ELEM(ALLOC)
-      ELEM(DYN_ALLOC)
-      ELEM(LOAD)
-      ELEM(STORE)
-      ELEM(GEP)
-      ELEM(PHI)
-      ELEM(CAST)
-      ELEM(FUNCTION)
-      ELEM(CALL)
-      ELEM(CALL_FUNCPTR)
-      ELEM(CALL_RETURN)
-      ELEM(ENTRY)
-      ELEM(RETURN)
-      ELEM(CONSTANT)
-      ELEM(NOOP)
-      ELEM(MEMCPY)
-      ELEM(NULL_ADDR)
-      ELEM(UNKNOWN_MEM)
-  default:
-      printf("unknown PointerSubgraph type");
-  };
-#undef ELEM
+void printPSNodeType(enum PSNodeType type) {
+    printf("%s", PSNodeTypeToCString(type));
 }

 static void
@@ -141,205 +121,6 @@
       putchar('\\');

     putchar(name[i]);
-  }
-}
-
-static void
-dumpMemoryObject(MemoryObject *mo, int ind, bool dot)
-{
-  for (auto& it : mo->pointsTo) {
-    for (const Pointer& ptr : it.second) {
-      // print indentation
-      printf("%*s", ind, "");
-
-      if (it.first.isUnknown())
-	printf("[UNKNOWN] -> ");
-      else
-	printf("[%lu] -> ", *it.first);
-
-      printName(ptr.target, dot);
-
-      if (ptr.offset.isUnknown())
-	puts(" + UNKNOWN");
-      else
-	printf(" + %lu", *ptr.offset);
-
-      if (dot)
-	printf("\\n");
-      else
-	putchar('\n');
-    }
-  }
-}
-
-static void
-dumpMemoryMap(PointsToFlowSensitive::MemoryMapT *mm, int ind, bool dot)
-{
-  for (auto it : *mm) {
-    // print the key
-    const Pointer& key = it.first;
-    if (!dot)
-      printf("%*s", ind, "");
-
-    putchar('[');
-    printName(key.target, dot);
-
-    if (key.offset.isUnknown())
-      puts(" + UNKNOWN]:");
-    else
-      printf(" + %lu]:", *key.offset);
-
-    if (dot)
-      printf("\\n");
-    else
-      putchar('\n');
-
-    for (MemoryObject *mo : it.second)
-      dumpMemoryObject(mo, ind + 4, dot);
-  }
-}
-
-static void
-dumpPointerSubgraphData(PSNode *n, PTType type, bool dot = false)
-{
-  assert(n && "No node given");
-  if (type == FLOW_INSENSITIVE) {
-    MemoryObject *mo = n->getData<MemoryObject>();
-    if (!mo)
-      return;
-
-    if (dot)
-      printf("\\n    Memory: ---\\n");
-    else
-      printf("    Memory: ---\n");
-
-    dumpMemoryObject(mo, 6, dot);
-
-    if (!dot)
-      printf("    -----------\n");
-  } else {
-    PointsToFlowSensitive::MemoryMapT *mm
-      = n->getData<PointsToFlowSensitive::MemoryMapT>();
-    if (!mm)
-      return;
-
-    if (dot)
-      printf("\\n    Memory map: ---\\n");
-    else
-      printf("    Memory map: ---\n");
-
-    dumpMemoryMap(mm, 6, dot);
-
-    if (!dot)
-      printf("    ----------------\n");
-  }
-}
-
-static void
-dumpPSNode(PSNode *n, PTType type)
-{
-  printf("NODE: ");
-  printName(n, false);
-
-  if (n->getSize() || n->isHeap() || n->isZeroInitialized())
-    printf(" [size: %lu, heap: %u, zeroed: %u]",
-	   n->getSize(), n->isHeap(), n->isZeroInitialized());
-
-  if (n->pointsTo.empty()) {
-    puts(" -- no points-to");
-    return;
-  } else
-    putchar('\n');
-
-  for (const Pointer& ptr : n->pointsTo) {
-    printf("    -> ");
-    printName(ptr.target, false);
-    if (ptr.offset.isUnknown())
-      puts(" + UNKNOWN_OFFSET");
-    else
-      printf(" + %lu\n", *ptr.offset);
-  }
-  if (verbose) {
-    dumpPointerSubgraphData(n, type);
-  }
-}
-
-static void
-dumpPointerSubgraphdot(LLVMPointerAnalysis *pta, PTType type)
-{
-  std::set<PSNode *> nodes;
-  pta->getNodes(nodes);
-
-  printf("digraph \"Pointer State Subgraph\" {\n");
-
-  /* dump nodes */
-  for (PSNode *node : nodes) {
-    printf("\tNODE%p [label=\"", node);
-    printName(node, true);
-
-    if (node->getSize() || node->isHeap() || node->isZeroInitialized())
-      printf("\\n[size: %lu, heap: %u, zeroed: %u]",
-	     node->getSize(), node->isHeap(), node->isZeroInitialized());
-
-    if (verbose && node->getOperandsNum() > 0) {
-      printf("\\n--- operands ---\\n");
-      for (PSNode *op : node->getOperands()) {
-	printName(op, true);
-	printf("\\n");
-      }
-      printf("------\\n");
-    }
-
-    for (const Pointer& ptr : node->pointsTo) {
-      printf("\\n    -> ");
-      printName(ptr.target, true);
-      printf(" + ");
-      if (ptr.offset.isUnknown())
-	printf("UNKNOWN_OFFSET");
-      else
-	printf("%lu", *ptr.offset);
-    }
-
-    if (verbose)
-      dumpPointerSubgraphData(node, type, true /* dot */);
-
-    printf("\"");
-    if (node->getType() != STORE) {
-      printf(", shape=box");
-      if (node->pointsTo.size() == 0
-	  && (node->getType() == LOAD ||
-	      node->getType() == GEP))
-	printf(", style=filled, fillcolor=red");
-    } else {
-      printf(", shape=cds");
-    }
-
-    printf("]\n");
-  }
-
-  /* dump edges */
-  for (PSNode *node : nodes) {
-    for (PSNode *succ : node->getSuccessors())
-      printf("\tNODE%p -> NODE%p [penwidth=2]\n", node, succ);
-  }
-
-  printf("}\n");
-}
-
-static void
-dumpPointerSubgraph(LLVMPointerAnalysis *pta, PTType type, bool todot)
-{
-  assert(pta);
-
-  if (todot)
-    dumpPointerSubgraphdot(pta, type);
-  else {
-    std::set<PSNode *> nodes;
-    pta->getNodes(nodes);
-
-    for (PSNode *node : nodes) {
-      dumpPSNode(node, type);
-    }
   }
 }

@@ -362,14 +143,14 @@
   printf("\n");
   if (ptr1.target->isUnknownMemory()) return MayAlias;
   if (ptr2.target->isUnknownMemory()) return MayAlias;
-  if (ptr1.offset == UNKNOWN_OFFSET) return MayAlias;
-  if (ptr2.offset == UNKNOWN_OFFSET) return MayAlias;
+  if (ptr1.offset == Offset::UNKNOWN) return MayAlias;
+  if (ptr2.offset == Offset::UNKNOWN) return MayAlias;
   if (ptr1.target == ptr2.target
       && ptr1.offset == ptr2.offset) return MustAlias;
   return NoAlias;
 }

-static int check_pointer(const Pointer& ptr, char *name)
+static int check_pointer(const Pointer& ptr, const char *name)
 {
   printf("target %s=", name);
   printName(ptr.target, 0);
@@ -384,7 +165,7 @@
   printf("\n");
   return NoAlias;
 }
-static int dump_pointer(const Pointer& ptr, char *name)
+static int dump_pointer(const Pointer& ptr, const char *name)
 {
   printf("target %s=", name);
   printName(ptr.target, 0);
@@ -423,8 +204,8 @@
     }
     return MayAlias;
   }
-  Pointer ptr1(UNKNOWN_MEMORY, UNKNOWN_OFFSET);
-  Pointer ptr2(UNKNOWN_MEMORY, UNKNOWN_OFFSET);
+  Pointer ptr1(UNKNOWN_MEMORY, Offset::UNKNOWN);
+  Pointer ptr2(UNKNOWN_MEMORY, Offset::UNKNOWN);
   if (count1 == 0 && count2 == 0) {
     return NoAlias;
   }
@@ -485,11 +266,11 @@
 }

 static void
-evalPSNode(LLVMPointerAnalysis *pta, PSNode *node, PTType type)
+evalPSNode(LLVMPointerAnalysis *pta, PSNode *node)
 {
   //  printf("EvalPSNode\n");
   enum PSNodeType nodetype = node->getType();
-  if (nodetype != CALL) {
+  if (nodetype != PSNodeType::CALL) {
     return;
   }
   if (node->isNull()) {
@@ -605,93 +386,87 @@
 }

 static void
-evalPTA(LLVMPointerAnalysis *pta, PTType type)
-{
-
-  std::set<PSNode *> nodes;
-  pta->getNodes(nodes);
-
-  for (PSNode *node : nodes) {
-    evalPSNode(pta, node, type);
-  }
-}
-
-
-
+evalPTA(LLVMPointerAnalysis *pta)
+{
+  for (auto& node : pta->getNodes()) {
+    evalPSNode(pta, node.get());
+  }
+}

 int main(int argc, char *argv[])
 {
-  llvm::Module *M;
-  llvm::LLVMContext context;
-  llvm::SMDiagnostic SMD;
-  bool todot = false;
-  const char *module = nullptr;
-  PTType type = FLOW_INSENSITIVE;
-  uint64_t field_senitivity = UNKNOWN_OFFSET;
-
-  // parse options
-  for (int i = 1; i < argc; ++i) {
-    // run given points-to analysis
-    if (strcmp(argv[i], "-pta") == 0) {
-      if (strcmp(argv[i+1], "fs") == 0)
-	type = FLOW_SENSITIVE;
-    } else if (strcmp(argv[i], "-pta-field-sensitive") == 0) {
-      field_senitivity = (uint64_t) atoll(argv[i + 1]);
-    } else if (strcmp(argv[i], "-dot") == 0) {
-      todot = true;
-    } else if (strcmp(argv[i], "-v") == 0) {
-      verbose = true;
+    llvm::Module *M;
+    llvm::LLVMContext context;
+    llvm::SMDiagnostic SMD;
+    const char *module = nullptr;
+    const char *entry_func = "main";
+    PTType type = FLOW_INSENSITIVE;
+    uint64_t field_senitivity = Offset::UNKNOWN;
+
+    // parse options
+    for (int i = 1; i < argc; ++i) {
+        // run given points-to analysis
+        if (strcmp(argv[i], "-pta") == 0) {
+            if (strcmp(argv[i+1], "fs") == 0)
+                type = FLOW_SENSITIVE;
+            else if (strcmp(argv[i+1], "inv") == 0)
+                type = WITH_INVALIDATE;
+        } else if (strcmp(argv[i], "-pta-field-sensitive") == 0) {
+            field_senitivity = static_cast<uint64_t>(atoll(argv[i + 1]));
+        } else if (strcmp(argv[i], "-entry") == 0) {
+            entry_func = argv[i + 1];
+        } else {
+            module = argv[i];
+        }
+    }
+
+    if (!module) {
+        errs() << "Usage: % IR_module [output_file]\n";
+        return 1;
+    }
+
+#if ((LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR <= 5))
+    M = llvm::ParseIRFile(module, SMD, context);
+#else
+    auto _M = llvm::parseIRFile(module, SMD, context);
+    // _M is unique pointer, we need to get Module *
+    M = _M.get();
+#endif
+
+    if (!M) {
+        llvm::errs() << "Failed parsing '" << module << "' file:\n";
+        SMD.print(argv[0], errs());
+        return 1;
+    }
+
+    TimeMeasure tm;
+
+    LLVMPointerAnalysis PTA(M, entry_func, field_senitivity);
+
+    tm.start();
+
+    // use createAnalysis instead of the run() method so that we won't delete
+    // the analysis data (like memory objects) which may be needed
+    if (type == FLOW_INSENSITIVE) {
+        PA = std::unique_ptr<PointerAnalysis>(
+            PTA.createPTA<analysis::pta::PointerAnalysisFI>()
+            );
+    } else if (type == WITH_INVALIDATE) {
+        PA = std::unique_ptr<PointerAnalysis>(
+            PTA.createPTA<analysis::pta::PointerAnalysisFSInv>()
+            );
     } else {
-      module = argv[i];
-    }
-  }
-
-  if (!module) {
-    errs() << "Usage: % IR_module [output_file]\n";
-    return 1;
-  }
-
-#if ((LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR <= 5))
-  M = llvm::ParseIRFile(module, SMD, context);
-#else
-  auto _M = llvm::parseIRFile(module, SMD, context);
-  // _M is unique pointer, we need to get Module *
-  M = _M.get();
-#endif
-
-  if (!M) {
-    llvm::errs() << "Failed parsing '" << module << "' file:\n";
-    SMD.print(argv[0], errs());
-    return 1;
-  }
-
-  debug::TimeMeasure tm;
-
-  LLVMPointerAnalysis PTA(M, field_senitivity);
-  std::unique_ptr<PointerAnalysis> PA;
-
-  tm.start();
-
-  // use createAnalysis instead of the run() method so that we won't delete
-  // the analysis data (like memory objects) which may be needed
-  if (type == FLOW_INSENSITIVE) {
-    PA = std::unique_ptr<PointerAnalysis>(
-					  PTA.createPTA<analysis::pta::PointsToFlowInsensitive>()
-					  );
-  } else {
-    PA = std::unique_ptr<PointerAnalysis>(
-					  PTA.createPTA<analysis::pta::PointsToFlowSensitive>()
-					  );
-  }
-
-  // run the analysis
-  PA->run();
-
-  tm.stop();
-  tm.report("INFO: Points-to analysis [new] took");
-  dumpPointerSubgraph(&PTA, type, todot);
-
-  evalPTA(&PTA, type);
-
-  return 0;
-}
+        PA = std::unique_ptr<PointerAnalysis>(
+            PTA.createPTA<analysis::pta::PointerAnalysisFS>()
+            );
+    }
+
+    PA->run();
+
+    tm.stop();
+    tm.report("INFO: Points-to analysis [new] took");
+
+    evalPTA(&PTA);
+
+    return 0;
+}


Implemented the ability to add shortcut for Project -> Reload Current Project.

--- editor/editor_node.cpp
+++ editor/editor_node.cpp
@@ -6302,7 +6302,7 @@
 	tool_menu->add_item(TTR("Orphan Resource Explorer..."), TOOLS_ORPHAN_RESOURCES);

 	p->add_separator();
-	p->add_item(TTR("Reload Current Project"), RUN_RELOAD_CURRENT_PROJECT);
+	p->add_shortcut(ED_SHORTCUT("editor/reload_current_project", TTR("Reload Current Project")), RUN_RELOAD_CURRENT_PROJECT);
 #ifdef OSX_ENABLED
 	p->add_shortcut(ED_SHORTCUT("editor/quit_to_project_list", TTR("Quit to Project List"), KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_Q), RUN_PROJECT_MANAGER, true);
 #else


Fixed XDK build break

Fixed XDK build break

--- GamePadTest/Game.cpp
+++ GamePadTest/Game.cpp
@@ -20,7 +20,7 @@
 #include <GameInput.h>
 #elif defined(USING_WINDOWS_GAMING_INPUT)
 #include <Windows.UI.Core.h>
-#else
+#elif !defined(_XBOX_ONE)
 #include <xinput.h>
 #endif


Add the easiest 80386 extensions: PUSH/POP FS/GS and longer conditional jumps.

--- InstructionSets/x86/Decoder.cpp
+++ InstructionSets/x86/Decoder.cpp
@@ -433,18 +433,33 @@
 			// 0x24: MOV Td, Rd
 			// 0x26: MOV Rd, Td

-			// 0x8x: long-displacement jumps: JO, JNO, JB, JNB, JZ, JNZ, JBE, JNBE, JS, JNS, JP, JNP, JL, JNL, JLE, JNLE
+			case 0x70: RequiresMin(i80386);	Jump(JO, data_size_);	break;
+			case 0x71: RequiresMin(i80386);	Jump(JNO, data_size_);	break;
+			case 0x72: RequiresMin(i80386);	Jump(JB, data_size_);	break;
+			case 0x73: RequiresMin(i80386);	Jump(JNB, data_size_);	break;
+			case 0x74: RequiresMin(i80386);	Jump(JE, data_size_);	break;
+			case 0x75: RequiresMin(i80386);	Jump(JNE, data_size_);	break;
+			case 0x76: RequiresMin(i80386);	Jump(JBE, data_size_);	break;
+			case 0x77: RequiresMin(i80386);	Jump(JNBE, data_size_);	break;
+			case 0x78: RequiresMin(i80386);	Jump(JS, data_size_);	break;
+			case 0x79: RequiresMin(i80386);	Jump(JNS, data_size_);	break;
+			case 0x7a: RequiresMin(i80386);	Jump(JP, data_size_);	break;
+			case 0x7b: RequiresMin(i80386);	Jump(JNP, data_size_);	break;
+			case 0x7c: RequiresMin(i80386);	Jump(JL, data_size_);	break;
+			case 0x7d: RequiresMin(i80386);	Jump(JNL, data_size_);	break;
+			case 0x7e: RequiresMin(i80386);	Jump(JLE, data_size_);	break;
+			case 0x7f: RequiresMin(i80386);	Jump(JNLE, data_size_);	break;

 			// [0x90, 0x97]: byte set on condition Eb: SETO, SETNO, SETB, SETNB, SETZ, SETNZ, SETBE, SETNBE
 			// [0x98, 0x9f]: SETS, SETNS, SETP, SETNP, SETL, SETNL, SETLE, SETNLE

-			// 0xa0: PUSH FS
-			// 0xa1: POP FS
+			case 0xa0:	RequiresMin(i80386);	Complete(PUSH, FS, None, data_size_);	break;
+			case 0xa1:	RequiresMin(i80386);	Complete(POP, FS, None, data_size_);	break;
 			// 0xa3: BT Ev, Gv
 			// 0xa4: SHLD EvGvIb
 			// 0xa5: SHLD EvGcCL
-			// 0xa8: PUSH GS
-			// 0xa9: POP GS
+			case 0xa8:	RequiresMin(i80386);	Complete(PUSH, GS, None, data_size_);	break;
+			case 0xa9:	RequiresMin(i80386);	Complete(POP, GS, None, data_size_);	break;
 			// 0xab: BTS Ev, Gv
 			// 0xac: SHRD EvGvIb
 			// 0xad: SHRD EvGvCL


Extra debugging for bug #24522

Extra debugging for bug #24522

svn path=/trunk/kdepim/; revision=93647

--- kpilot/conduits/popmail/popmail-conduit.cc
+++ kpilot/conduits/popmail/popmail-conduit.cc
@@ -85,6 +85,13 @@
 #include <kaboutdata.h>
 #endif

+#ifndef _KTEMPFILE_H
+#include <ktempfile.h>
+#endif
+
+#ifndef _DCOPCLIENT_H
+#include <dcopclient.h>
+#endif

 #ifndef _PILOT_SOURCE_H_
 #include <pi-source.h>
@@ -394,7 +401,7 @@
 int PopMailConduit::sendPendingMail(int mode)
 {
 	FUNCTIONSETUP;
-	int count=0;
+	int count=-1;

 	if (mode == PopMailConduit::SEND_SMTP)
@@ -405,15 +412,25 @@
 	{
 		count=sendViaSendmail();
 	}
-
-#ifdef DEBUG
-	if (debug_level & SYNC_MINOR)
-	{
-		kdDebug() << fname << ": Sent "
-			<< count << " messages"
+	if (mode==PopMailConduit::SEND_KMAIL)
+	{
+		count=sendViaKMail();
+	}
+
+	if (count < 0)
+	{
+		kdWarning() << __FUNCTION__
+			<< ": Mail was not sent at all!"
 			<< endl;
 	}
-#endif
+	else
+	{
+		DEBUGCONDUIT << fname
+			<< ": Sent "
+			<< count
+			<< " messages"
+			<< endl;
+	}

 	return count;
 }
@@ -505,12 +522,34 @@
 	// longer than 1024 characters.
 	//
 	//
-	getdomainname(buffer+1024,1024);
+	ret = getdomainname(buffer+1024,1024);
+	if (ret)
+	{
+		ret=errno;
+		kdWarning() << __FUNCTION__
+			<< ": getdomainname: "
+			<< strerror(ret)
+			<< endl;
+	}
+	else
+	{
+		DEBUGCONDUIT << fname
+			<< ": Got domain name "
+			<< buffer+1024
+			<< endl;
+	}
+
 	sprintf(buffer, "EHLO %s\r\n",buffer+1024);
 #else
 	{
 		struct utsname u;
 		(void) uname(&u);
+
+		DEBUGCONDUIT << fname
+			<< ": Got uname.nodename "
+			<< u.nodename
+			<< endl;
+
 		sprintf(buffer,"EHLO %s\r\n",u.nodename);
 	}
 #endif
@@ -745,7 +784,7 @@
 	    }
 	  currentDest = "Mailing: ";
 	  currentDest += theMail.to;
-	  sendMessage(sendf, theMail);
+	  writeMessageToFile(sendf, theMail);
 	  pclose(sendf);
 	  // Mark it as filed...
 	  pilotRec->setCat(3);
@@ -770,11 +809,154 @@
 	return count;
 }

+
+
+
+/*
+ * This function uses KMail's DCOP interface to put all the
+ * outgoing mail into the outbox.
+ */
+int PopMailConduit::sendViaKMail()
+{
+	FUNCTIONSETUP;
+	int count=0;
+	bool sendImmediate = true;
+
+	{
+	KConfig& config = KPilotConfig::getConfig(PopMailOptions::PopGroup);
+	sendImmediate = config.readBoolEntry("SendImmediate",true);
+	}
+
+
+
+	DCOPClient *dcopptr = KApplication::kApplication()->
+		dcopClient();
+	if (!dcopptr)
+	{
+		kdWarning() << __FUNCTION__
+			<< ": Can't get DCOP client."
+			<< endl;
+		KMessageBox::error(0L,
+			i18n("Couldn't connect to DCOP server for\n"
+				"the KMail connection."),
+			i18n("Error Sending Mail"));
+		return -1;
+	}
+
+	while (PilotRecord *pilotRec = readNextRecordInCategory(1))
+	{
+		DEBUGCONDUIT << fname
+			<< ": Reading "
+			<< count + 1
+			<< "th message"
+			<< endl;
+
+		if (pilotRec->isDeleted() || pilotRec->isArchived())
+		{
+			DEBUGCONDUIT << fname
+				<< ": Skipping record."
+				<< endl;
+			continue;
+		}
+
+		struct Mail theMail;
+		KTempFile t;
+		t.setAutoDelete(true);
+
+		if (t.status())
+		{
+			kdWarning() << __FUNCTION__
+				<< ": Can't open temp file."
+				<< endl;
+			KMessageBox::error(0L,
+				i18n("Cannot open temporary file to store\n"
+					"mail from Pilot in."),
+				i18n("Error Sending Mail"));
+			continue;
+		}
+
+		FILE *sendf = t.fstream();
+
+		if (!sendf)
+		{
+			kdWarning() << __FUNCTION__
+				<< ": Can't open temporary file for writing!"
+				<< endl;
+			KMessageBox::error(0L,
+				i18n("Cannot open temporary file to store\n"
+					"mail from Pilot in."),
+				i18n("Error Sending Mail"));
+			continue;
+		}
+
+		unpack_Mail(&theMail,
+			(unsigned char*)pilotRec->getData(),
+			pilotRec->getLen());
+		writeMessageToFile(sendf, theMail);
+
+
+		QByteArray data,returnValue;
+		QCString returnType;
+		QDataStream arg(data,IO_WriteOnly);
+
+		arg << QString("outbox")
+			<< t.name();
+
+		if (dcopptr->call("kmail",
+			"KMailIface",
+			"dcopAddMessage",
+			data,
+			returnType,
+			returnValue,
+			true))
+		{
+			kdWarning() << __FUNCTION__
+				<< ": DCOP call failed."
+				<< endl;
+
+			KMessageBox::error(0L,
+				i18n("DCOP connection with KMail failed."),
+				i18n("Error Sending Mail"));
+			continue;
+		}
+
+		DEBUGCONDUIT << fname
+			<< ": DCOP call returned "
+			<< returnType
+			<< " of "
+			<< (const char *)returnValue
+			<< endl;
+
+		// Mark it as filed...
+		pilotRec->setCat(3);
+		pilotRec->setAttrib(pilotRec->getAttrib() & ~dlpRecAttrDirty);
+		writeRecord(pilotRec);
+		delete pilotRec;
+		// This is ok since we got the mail with unpack mail..
+		free_Mail(&theMail);
+
+		count++;
+	}
+
+	if ((count > 0)  && sendImmediate)
+	{
+		QByteArray data;
+		if (dcopptr->send("kmail","KMailIface","sendQueued",data))
+		{
+			kdWarning() << __FUNCTION__
+				<< ": Couldn't flush queue."
+				<< endl;
+		}
+	}
+
+	return count;
+}
+
 // From pilot-link-0.8.7 by Kenneth Albanowski
 // additional changes by Michael Kropfberger

 void
-PopMailConduit::sendMessage(FILE* sendf, struct Mail& theMail)
+PopMailConduit::writeMessageToFile(FILE* sendf, struct Mail& theMail)
 {
 	FUNCTIONSETUP;

@@ -1672,11 +1854,17 @@
 	a.setConduit(&conduit);

 	return a.exec();
+
+	/* NOTREACHED */
+	(void) popmail_conduit_id;
 }

 // $Log$
+// Revision 1.19  2001/03/09 09:46:14  adridg
+// Large-scale #include cleanup
+//
 // Revision 1.18  2001/03/06 12:13:32  adridg
 // Fixed Solaris compilation problems (again?)
 //


add percentage updates to ShellScriptCallback

--- apps/AppSupport.cpp
+++ apps/AppSupport.cpp
@@ -239,6 +239,8 @@
     {
         std::string output;
         int stat = pdal::Utils::run_shell_command(m_command + " " + boost::lexical_cast<std::string>(static_cast<int>(currPerc)), output);
+        m_lastMajorPerc = currPerc;
+        m_lastMinorPerc = currPerc;
     }
     else if (currPerc >= m_lastMinorPerc + 2.0)
     {


Hide some unused gui

Hide some unused gui

--- src/Interface/Modules/Render/Ospray/VolumeViewer.cpp
+++ src/Interface/Modules/Render/Ospray/VolumeViewer.cpp
@@ -927,15 +927,11 @@
   // Connect the "play timesteps" timer.
   connect(&playTimeStepsTimer, SIGNAL(timeout()), this, SLOT(nextTimeStep()));

+#if 0
   // Add the "add geometry" widget and callback.
   QAction *addGeometryAction = new QAction("Add geometry", this);
   connect(addGeometryAction, SIGNAL(triggered()), this, SLOT(addGeometry()));
   toolbar->addAction(addGeometryAction);
-
-  // Add the "screenshot" widget and callback.
-  QAction *screenshotAction = new QAction("Screenshot", this);
-  connect(screenshotAction, SIGNAL(triggered()), this, SLOT(screenshot()));
-  toolbar->addAction(screenshotAction);

   // Create the transfer function editor dock widget, this widget modifies the transfer function directly.
   QDockWidget *transferFunctionEditorDockWidget = new QDockWidget("Transfer Function", this);
@@ -962,6 +958,21 @@
   connect(isosurfaceEditor, SIGNAL(isovaluesChanged(std::vector<float>)), this, SLOT(setIsovalues(std::vector<float>)));
   addDockWidget(Qt::LeftDockWidgetArea, isosurfaceEditorDockWidget);

+  // Default to showing transfer function tab widget.
+  transferFunctionEditorDockWidget->raise();
+  // Tabify dock widgets.
+  tabifyDockWidget(transferFunctionEditorDockWidget, sliceEditorDockWidget);
+  tabifyDockWidget(transferFunctionEditorDockWidget, isosurfaceEditorDockWidget);
+  tabifyDockWidget(transferFunctionEditorDockWidget, lightEditorDockWidget);
+  tabifyDockWidget(transferFunctionEditorDockWidget, probeDockWidget);
+
+#endif
+
+  // Add the "screenshot" widget and callback.
+  QAction *screenshotAction = new QAction("Screenshot", this);
+  connect(screenshotAction, SIGNAL(triggered()), this, SLOT(screenshot()));
+  toolbar->addAction(screenshotAction);
+
   // Create the light editor dock widget, this widget modifies the light directly.
   QDockWidget *lightEditorDockWidget = new QDockWidget("Lights", this);
   lightEditor = new LightEditor(ambientLight, directionalLight);
@@ -975,18 +986,9 @@
   probeDockWidget->setWidget(probeWidget);
   addDockWidget(Qt::LeftDockWidgetArea, probeDockWidget);

-  // Tabify dock widgets.
-  tabifyDockWidget(transferFunctionEditorDockWidget, sliceEditorDockWidget);
-  tabifyDockWidget(transferFunctionEditorDockWidget, isosurfaceEditorDockWidget);
-  tabifyDockWidget(transferFunctionEditorDockWidget, lightEditorDockWidget);
-  tabifyDockWidget(transferFunctionEditorDockWidget, probeDockWidget);
-
   // Tabs on top.
   setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::North);

-  // Default to showing transfer function tab widget.
-  transferFunctionEditorDockWidget->raise();
-
   // Add the current OSPRay object file label to the bottom status bar.
   statusBar()->addWidget(&currentFilenameInfoLabel);
 }


eeschema: plot minor bug

eeschema: plot minor bug

--- eeschema/class_pin.cpp
+++ eeschema/class_pin.cpp
@@ -798,16 +798,16 @@
                                        GR_TEXT_VJUSTIFY_CENTER,
                                        aWidth, false, false );
                 }
-                if( DrawPinNum )
-                {
-                    plotter->text( wxPoint( (x1 + pin_pos.x) / 2,
-                                            y1 - TXTMARGE ),
-                                   NumColor, StringPinNum,
-                                   TEXT_ORIENT_HORIZ, PinNumSize,
-                                   GR_TEXT_HJUSTIFY_CENTER,
-                                   GR_TEXT_VJUSTIFY_BOTTOM,
-                                   aWidth, false, false );
-                }
+            }
+            if( DrawPinNum )
+            {
+                plotter->text( wxPoint( (x1 + pin_pos.x) / 2,
+                                        y1 - TXTMARGE ),
+                               NumColor, StringPinNum,
+                               TEXT_ORIENT_HORIZ, PinNumSize,
+                               GR_TEXT_HJUSTIFY_CENTER,
+                               GR_TEXT_VJUSTIFY_BOTTOM,
+                               aWidth, false, false );
             }
         }
         else         /* Its a vertical line. */


Cleanup.

Cleanup.

--- examples/33-pom/pom.cpp
+++ examples/33-pom/pom.cpp
@@ -365,7 +365,6 @@
 	bgfx::TextureHandle m_textureColor;
 	bgfx::TextureHandle m_textureNormal;
 	bgfx::TextureHandle m_textureDepth;
-	bool m_instancingSupported;

 	entry::MouseState m_mouseState;

@@ -376,7 +375,7 @@
 	int64_t m_timeOffset;

 	int32_t m_shading_type;
-	bool m_show_diffuse_texture;
+	bool    m_show_diffuse_texture;
 	int32_t m_parallax_scale;
 	int32_t m_num_steps;
 };


'auto const &' used for range-based loops

--- include/cereal/details/polymorphic_impl.hpp
+++ include/cereal/details/polymorphic_impl.hpp
@@ -244,10 +244,10 @@
             };

             Relations unregisteredRelations;
-            for( auto baseIt : baseMap )
-              for( auto derivedIt : baseIt.second )
+            for( auto const & baseIt : baseMap )
+              for( auto const & derivedIt : baseIt.second )
               {
-                for( auto otherBaseIt : baseMap )
+                for( auto const & otherBaseIt : baseMap )
                 {
                   if( baseIt.first == otherBaseIt.first ) // only interested in chained relations
                     continue;
@@ -286,7 +286,7 @@
           {
             unregisteredRelations = findChainableRelations();
             // Insert chained relations
-            for( auto it : unregisteredRelations )
+            for( auto const & it : unregisteredRelations )
             {
               auto & derivedMap = baseMap.find( it.first )->second;
               derivedMap[it.second.first] = it.second.second;


overriding OnSwapBuffersAsync

overriding OnSwapBuffersAsync

--- egl_surface_factory.cc
+++ egl_surface_factory.cc
@@ -102,7 +102,12 @@
     return native_window_;
   }

-  virtual bool OnSwapBuffers() override
+  virtual bool OnSwapBuffers() override
+  {
+    return true;
+  }
+
+  virtual bool OnSwapBuffersAsync(const SwapCompletionCallback& callback) override
   {
     return true;
   }


Propagate usage of std:unique_ptr a bit. NFC.

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

--- tools/driver/cc1as_main.cpp
+++ tools/driver/cc1as_main.cpp
@@ -255,8 +255,9 @@
   return Success;
 }

-static raw_ostream *GetOutputStream(AssemblerInvocation &Opts,
-                                    DiagnosticsEngine &Diags, bool Binary) {
+static std::unique_ptr<raw_fd_ostream>
+getOutputStream(AssemblerInvocation &Opts, DiagnosticsEngine &Diags,
+                bool Binary) {
   if (Opts.OutputPath.empty())
     Opts.OutputPath = "-";

@@ -266,12 +267,11 @@
     sys::RemoveFileOnSignal(Opts.OutputPath);

   std::error_code EC;
-  raw_fd_ostream *Out = new raw_fd_ostream(
+  auto Out = llvm::make_unique<raw_fd_ostream>(
       Opts.OutputPath, EC, (Binary ? sys::fs::F_None : sys::fs::F_Text));
   if (EC) {
     Diags.Report(diag::err_fe_unable_to_open_output) << Opts.OutputPath
                                                      << EC.message();
-    delete Out;
     return nullptr;
   }

@@ -315,7 +315,7 @@
     MAI->setCompressDebugSections(true);

   bool IsBinary = Opts.OutputType == AssemblerInvocation::FT_Obj;
-  std::unique_ptr<raw_ostream> Out(GetOutputStream(Opts, Diags, IsBinary));
+  std::unique_ptr<raw_fd_ostream> Out = getOutputStream(Opts, Diags, IsBinary);
   if (!Out)
     return true;


support crt static delete size and delete[] size

--- kk-win-lib/checker/kk-win-lib-checker-memory-operation-mismatch-server.cpp
+++ kk-win-lib/checker/kk-win-lib-checker-memory-operation-mismatch-server.cpp
@@ -1426,6 +1426,138 @@
                     }
                     break;

+                case kOperationCRTStaticDeleteSize:
+                    {
+                        bool negative = false;
+
+                        if ( 0 == memory.pointer && false == pThis->mNeedBreakDeallocNull )
+                        {
+                            // skip
+                        }
+                        else
+                        {
+                            mapRecord::iterator it = mapMemory.find( memory.pointer );
+                            if ( mapMemory.end() == it )
+                            {
+                                // error
+                                action.header.size = sizeof(action);
+                                action.header.mode = kModeAction;
+                                if ( pThis->mDoBreak )
+                                {
+                                    action.data.action = kActionBreak;
+                                }
+                                else
+                                {
+                                    action.data.action = kActionNone;
+                                }
+                                pThis->mNamedPipe.send( (char*)&action, sizeof(action), sendedSize );
+                                negative = true;
+                            }
+                            else
+                            {
+                                if ( kOperationCRTStaticNew != it->second )
+                                {
+                                    // error
+                                    action.header.size = sizeof(action);
+                                    action.header.mode = kModeAction;
+                                    if ( pThis->mDoBreak )
+                                    {
+                                        action.data.action = kActionBreak;
+                                    }
+                                    else
+                                    {
+                                        action.data.action = kActionNone;
+                                    }
+                                    pThis->mNamedPipe.send( (char*)&action, sizeof(action), sendedSize );
+                                    negative = true;
+                                }
+                                it->second = kOperationCRTStaticNew;
+                            }
+                        }
+
+                        if ( negative )
+                        {
+                        }
+                        else
+                        {
+                            action.header.size = sizeof(action);
+                            action.header.mode = kModeAction;
+                            action.data.action = kActionNone;
+                            pThis->mNamedPipe.send( (char*)&action, sizeof(action), sendedSize );
+                        }
+
+                    }
+                    break;
+                case kOperationCRTStaticDeleteArraySize:
+                    {
+                        bool negative = false;
+
+                        if ( 0 == memory.pointer && false == pThis->mNeedBreakDeallocNull )
+                        {
+                            // skip
+                        }
+                        else
+                        {
+                            mapRecord::iterator it = mapMemory.find( memory.pointer );
+                            if ( mapMemory.end() == it )
+                            {
+                                // error
+                                action.header.size = sizeof(action);
+                                action.header.mode = kModeAction;
+                                if ( pThis->mDoBreak )
+                                {
+                                    action.data.action = kActionBreak;
+                                }
+                                else
+                                {
+                                    action.data.action = kActionNone;
+                                }
+                                pThis->mNamedPipe.send( (char*)&action, sizeof(action), sendedSize );
+                                negative = true;
+                            }
+                            else
+                            {
+                                if ( kOperationCRTStaticNewArray != it->second )
+                                {
+                                    if ( luckNewArray )
+                                    {
+                                        // warn?
+                                    }
+                                    else
+                                    {
+                                        // error
+                                        action.header.size = sizeof(action);
+                                        action.header.mode = kModeAction;
+                                        if ( pThis->mDoBreak )
+                                        {
+                                            action.data.action = kActionBreak;
+                                        }
+                                        else
+                                        {
+                                            action.data.action = kActionNone;
+                                        }
+                                        pThis->mNamedPipe.send( (char*)&action, sizeof(action), sendedSize );
+                                        negative = true;
+                                    }
+                                }
+                                it->second = kOperationCRTStaticNewArray;
+                            }
+                        }
+
+                        if ( negative )
+                        {
+                        }
+                        else
+                        {
+                            action.header.size = sizeof(action);
+                            action.header.mode = kModeAction;
+                            action.data.action = kActionNone;
+                            pThis->mNamedPipe.send( (char*)&action, sizeof(action), sendedSize );
+                        }
+
+                    }
+                    break;
+
                 default:
                     assert( false );
                     break;
@@ -1433,11 +1565,6 @@
             }
             break;

-        case kOperationCRTStaticDeleteSize:
-        case kOperationCRTStaticDeleteArraySize:
-            assert( false );
-            break;
-
         default:
             assert( false );
             break;


[llvm-mca] Make ViewOptions static. NFCI

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

--- tools/llvm-mca/llvm-mca.cpp
+++ tools/llvm-mca/llvm-mca.cpp
@@ -52,7 +52,7 @@

 using namespace llvm;

-llvm::cl::OptionCategory ViewOptions("View Options");
+static llvm::cl::OptionCategory ViewOptions("View Options");

 static cl::opt<std::string>
     InputFilename(cl::Positional, cl::desc("<input file>"), cl::init("-"));


BUG: Calling SetQuery() on an instance that was instantiated directly, instead of coming from vtkSQLDatabase::GetQueryInstance, was causing a crash.  Fix that so that it only prints an error about how naughty you've been.

--- IO/vtkMySQLQuery.cxx
+++ IO/vtkMySQLQuery.cxx
@@ -482,7 +482,7 @@

 // ----------------------------------------------------------------------

-vtkCxxRevisionMacro(vtkMySQLQuery, "1.10");
+vtkCxxRevisionMacro(vtkMySQLQuery, "1.11");
 vtkStandardNewMacro(vtkMySQLQuery);

 // ----------------------------------------------------------------------
@@ -966,7 +966,11 @@

   vtkMySQLDatabase *dbContainer =
     static_cast<vtkMySQLDatabase *>(this->Database);
-  assert(dbContainer != NULL);
+  if (!dbContainer)
+    {
+    vtkErrorMacro(<< "SetQuery: No database connection set!  This usually happens if you have instantiated vtkMySQLQuery directly.  Don't do that.  Call vtkSQLDatabase::GetQueryInstance instead.");
+    return;
+    }

   MYSQL *db = dbContainer->Private->Connection;
   assert(db != NULL);


BUG: fixed phase x and animating purely real modes

Change-Id: I91d456d58515ab6510098a0b39e3ee3c049015b3

--- IO/vtkSLACReader.cxx
+++ IO/vtkSLACReader.cxx
@@ -1238,77 +1238,69 @@
       = this->ReadPointDataArray(modeFD, varId);
     if (!dataArray) continue;

-    // Check for imaginary component of mode data.
+
+    // Handle the imaginary component of mode data:
+    // If simulation is purely real, all imaginary components would be zero.
+    // Saving all the zeroes would waste space, so they aren't saved.  So
+    // missing imaginary components in the file means we should know to use
+    // zeroes.
+    // (TLDR: load imaginary components if provided, or use zeroes if not.)
     if (this->FrequencyModes)
       {
+      vtkIdType numTuples = dataArray->GetNumberOfTuples();
+      vtkSmartPointer<vtkDataArray> imagDataArray= 0;
+
+      // I am assuming here that the imaginary data has the same dimensions as
+      // the real data.
       if (nc_inq_varid(modeFD, (name+"_imag").c_str(), &varId) == NC_NOERR)
+        imagDataArray = this->ReadPointDataArray(modeFD, varId);
+
+      // allocate space for complex magnitude data
+      vtkSmartPointer<vtkDataArray> cplxMagArray;
+      cplxMagArray.TakeReference(vtkDataArray::CreateDataArray(VTK_DOUBLE));
+      cplxMagArray->SetNumberOfComponents(1);
+      cplxMagArray->SetNumberOfTuples(numTuples);
+
+      // allocate space for phase data
+      vtkSmartPointer<vtkDataArray> phaseArray;
+      phaseArray.TakeReference(vtkDataArray::CreateDataArray(VTK_DOUBLE));
+      phaseArray->SetNumberOfComponents(3);
+      phaseArray->SetNumberOfTuples(numTuples);
+
+      int numComponents = dataArray->GetNumberOfComponents();
+      for (vtkIdType i = 0; i < numTuples; i++)
         {
-        // I am assuming here that the imaginary data (if it exists) has the
-        // same dimensions as the real data.
-        vtkSmartPointer<vtkDataArray> imagDataArray
-          = this->ReadPointDataArray(modeFD, varId);
-        if (imagDataArray)
+        double accumulated_mag= 0.0;
+        for (int j = 0; j < numComponents; j++)
           {
-          vtkIdType numTuples = dataArray->GetNumberOfTuples();
-
-          // allocate space for complex magnitude data
-          vtkSmartPointer<vtkDataArray> cplxMagArray;
-          cplxMagArray.TakeReference(vtkDataArray::CreateDataArray(VTK_DOUBLE));
-          cplxMagArray->SetNumberOfComponents(1);
-          cplxMagArray->SetNumberOfTuples(numTuples);
-
-          // allocate space for phase data
-          vtkSmartPointer<vtkDataArray> phaseArray;
-          phaseArray.TakeReference(vtkDataArray::CreateDataArray(VTK_DOUBLE));
-          phaseArray->SetNumberOfComponents(3);
-          phaseArray->SetNumberOfTuples(numTuples);
-
-          int numComponents = dataArray->GetNumberOfComponents();
-          for (vtkIdType i = 0; i < numTuples; i++)
-            {
-            double accum_mag= 0.0;
-            for (int j = 0; j < numComponents; j++)
-              {
-              double real = dataArray->GetComponent(i, j);
-              double imag = imagDataArray->GetComponent(i, j);
-
-              double mag2 = real*real + imag*imag;
-              accum_mag += mag2;
-              double mag= sqrt(mag2);
-
-              double startphase = atan2(imag, real);
-              dataArray->SetComponent(i, j, mag*cos(startphase + this->Phase));
-              phaseArray->SetComponent(i, j, startphase);
-              }
-            cplxMagArray->SetComponent(i, 0, sqrt(accum_mag));
-            phaseArray->SetComponent(i, 0, sqrt(accum_mag));
-            }
-
-          // add complex magnitude data to the point data
-          vtkStdString cplxMagName= name + "_cplx_mag";
-          cplxMagArray->SetName(cplxMagName);
-          pd->AddArray(cplxMagArray);
-
-          vtkStdString phaseName= name + "_phase";
-          phaseArray->SetName(phaseName);
-          pd->AddArray(phaseArray);
+          double real = dataArray->GetComponent(i, j);
+          double imag = 0.0;
+
+          // when values are purely real, no imaginary component is saved in the
+          // data file, because all those zeroes would waste space.  So if
+          // imaginary values are provided, use them, otherwise use 0.0.
+          if (imagDataArray)
+            imag = imagDataArray->GetComponent(i, j);
+
+          double mag2 = real*real + imag*imag;
+          accumulated_mag += mag2;
+          double mag= sqrt(mag2);
+
+          double startphase = atan2(imag, real);
+          dataArray->SetComponent(i, j, mag*cos(startphase + this->Phase));
+          phaseArray->SetComponent(i, j, startphase);
           }
+        cplxMagArray->SetComponent(i, 0, sqrt(accumulated_mag));
         }
-      else
-        {
-        int numComponents = dataArray->GetNumberOfComponents();
-        vtkIdType numTuples = dataArray->GetNumberOfTuples();
-        for (vtkIdType i = 0; i < numTuples; i++)
-          {
-          for (int j = 0; j < numComponents; j++)
-            {
-            double real = dataArray->GetComponent(i, j);
-            double mag= fabs(real);
-            double startphase = (real >= 0 )? 0.0 : vtkMath::Pi();
-            dataArray->SetComponent(i, j, mag*cos(startphase + this->Phase));
-            }
-          }
-        }
+
+      // add complex magnitude data to the point data
+      vtkStdString cplxMagName= name + "_cplx_mag";
+      cplxMagArray->SetName(cplxMagName);
+      pd->AddArray(cplxMagArray);
+
+      vtkStdString phaseName= name + "_phase";
+      phaseArray->SetName(phaseName);
+      pd->AddArray(phaseArray);
       }

     // Add the data to the point data.