Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ lcov:
-$(MAKE) GCOV=1 sure
lcov -c -d . $(LCOV_FLAGS) -o lcovt.info
lcov -a lcovi.info -a lcovt.info -o lcov.info
lcov -r --ignore-errors unused lcov.info */ecolab/* "*.cd" "*.xcd" "*.rcd" "*.tcd" -o lcovr.info
lcov -r lcov.info --ignore-errors unused */ecolab/* "*.cd" "*.xcd" "*.rcd" "*.tcd" -o lcovr.info
Copy link

Copilot AI Nov 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The parameter ordering has been changed - lcov.info now comes before --ignore-errors unused. While both orderings may work with current lcov versions, this change should be verified to ensure it doesn't break the build on systems with different lcov versions. The original ordering appeared to follow the pattern of input file first, then filters.

Suggested change
lcov -r lcov.info --ignore-errors unused */ecolab/* "*.cd" "*.xcd" "*.rcd" "*.tcd" -o lcovr.info
lcov -r lcov.info */ecolab/* "*.cd" "*.xcd" "*.rcd" "*.tcd" --ignore-errors unused -o lcovr.info

Copilot uses AI. Check for mistakes.
genhtml -o coverage lcovr.info

compile_commands.json: Makefile
Expand Down
1 change: 0 additions & 1 deletion gui-js/libs/shared/src/lib/backend/minsky.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,6 @@ export class Minsky extends CppClass {
async t0(...args: number[]): Promise<number> {return this.$callMethod('t0',...args);}
async timeUnit(...args: string[]): Promise<string> {return this.$callMethod('timeUnit',...args);}
async tmax(...args: number[]): Promise<number> {return this.$callMethod('tmax',...args);}
async triggerCheckMemAllocationCallback(): Promise<boolean> {return this.$callMethod('triggerCheckMemAllocationCallback');}
async undo(a1: number): Promise<number> {return this.$callMethod('undo',a1);}
async variableTypes(): Promise<string[]> {return this.$callMethod('variableTypes');}
}
Expand Down
72 changes: 36 additions & 36 deletions model/minsky.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,10 @@ namespace minsky
(*i)->updateBoundingBox();
return false;
});
// disable autosaving on loading a model from storage
auto stashedAutoSaver=std::move(autoSaver);
pushHistory();
autoSaver=std::move(stashedAutoSaver);
}

void Minsky::exportSchema(const string& filename, int schemaLevel)
Expand Down Expand Up @@ -1275,24 +1278,20 @@ namespace minsky
bool Minsky::pushHistory()
{
// do not pushHistory after undo or redo
if (undone)
if (undone || !doPushHistory)
return undone=false;

// go via a schema object, as serialising minsky::Minsky has
// problems due to port management
schema3::Minsky m(*this, false /* don't pack tensor data */);
pack_t buf;
buf<<m;
if (history.empty())
{
history.emplace_back();
buf.swap(history.back());
historyPtr=history.size();
return true;
}
while (history.size()>maxHistory)
history.pop_front();
if (history.empty() || history.back().size()!=buf.size() || memcmp(buf.data(), history.back().data(), buf.size())!=0)
bool stashState=history.empty();
if (!stashState &&
(history.back().size()!=buf.size() ||
memcmp(buf.data(), history.back().data(), buf.size())!=0))
{
// check XML versions differ (slower)
ostringstream prev, curr;
Expand All @@ -1301,33 +1300,34 @@ namespace minsky
schema3::Minsky previousMinsky;
history.back().reseto()>>previousMinsky;
xml_pack(prevXbuf,"Minsky",previousMinsky);

if (curr.str()!=prev.str())
{
// This bit of code outputs an XML representation that can be
// used for debugging issues related to unnecessary
// history pushes.
//buf.reseto()>>m;
//xml_pack_t tb(cout);
//tb.prettyPrint=true;
//xml_pack(tb,"Minsky",m);
//cout<<"------"<<endl;
history.emplace_back();
buf.swap(history.back());
historyPtr=history.size();
if (autoSaver && doPushHistory)
try
{
//autoSaver->packer.prettyPrint=true;
autoSaver->save(m);
}
catch (...)
{
autoSaver.reset();
throw;
}
return true;
}
stashState|=curr.str()!=prev.str();
}

if (stashState)
{
// This bit of code outputs an XML representation that can be
// used for debugging issues related to unnecessary
// history pushes.
//buf.reseto()>>m;
//xml_pack_t tb(cout);
//tb.prettyPrint=true;
//xml_pack(tb,"Minsky",m);
//cout<<"------"<<endl;
history.emplace_back();
buf.swap(history.back());
historyPtr=history.size();
if (autoSaver)
try
{
//autoSaver->packer.prettyPrint=true;
autoSaver->save(m);
}
catch (...)
{
autoSaver.reset();
throw;
}
return true;
}
historyPtr=history.size();
return false;
Expand Down
10 changes: 5 additions & 5 deletions model/minsky.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ namespace minsky
canvas.model.updateTimestamp();
}
void requestReset();
/// requests a redraw of the curren active tab
/// requests a redraw of the current active tab
void requestRedraw();

/// @{ push and pop state of the flags
Expand All @@ -182,6 +182,10 @@ namespace minsky
}
/// @}

/// calls reset() if the reset_flag is set, and the simulation
/// thread is not running
/// @return value of the reset_flag (ie true if reset was rejected
/// by the integrator because the simulation thread is running)
bool resetIfFlagged() override {
if (reset_flag())
reset();
Expand Down Expand Up @@ -519,10 +523,6 @@ namespace minsky
void nameCurrentItem(const std::string& name) {namedItems[name]=canvas.item;}
void itemFromNamedItem(const std::string& name) {canvas.item=namedItems[name].lock();}

/// trigger checkMem callback for testing purposes
bool triggerCheckMemAllocationCallback() const
{return checkMemAllocation(std::numeric_limits<size_t>::max());}

VariablePane variablePane;

/// Used to implement a pause until return pressed for attaching debugger purposes
Expand Down
Loading
Loading