Skip to content

Commit

Permalink
- Added option +d=shortOutput
Browse files Browse the repository at this point in the history
- Used +d=shortOutput in OMNotebook initialization


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@15008 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Jan 30, 2013
1 parent b350e81 commit e2bb812
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
42 changes: 42 additions & 0 deletions Compiler/FrontEnd/ValuesUtil.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2087,6 +2087,15 @@ algorithm
then
();

case ((r as Values.RECORD(record_ = Absyn.IDENT("SimulationResult"), orderd = xs, comp = ids)))
equation
Print.printBuf("record SimulationResult\n");
(xs,ids) = filterSimulationResults(Flags.isSet(Flags.SHORT_OUTPUT),xs,ids,{},{});
valRecordString(xs,ids);
Print.printBuf("end SimulationResult;");
then
();

case ((r as Values.RECORD(record_ = recordPath, orderd = xs, comp = ids)))
equation
recordName = Absyn.pathStringNoQual(recordPath);
Expand Down Expand Up @@ -2185,6 +2194,39 @@ algorithm
end matchcontinue;
end valString2;

protected function filterSimulationResults
input Boolean filter;
input list<Value> inValues;
input list<String> inIds;
input list<Value> valacc;
input list<String> idacc;
output list<Value> outValues;
output list<String> outIds;
algorithm
(outValues,outIds) := match (filter,inValues,inIds,valacc,idacc)
local
Value v;
list<Value> vrest;
String id,str;
list<String> idrest;
case (_,{},{},_,_) then (listReverse(valacc),listReverse(idacc));
case (true,v::vrest,(id as "messages")::idrest,_,_)
equation
(outValues,outIds) = filterSimulationResults(filter,vrest,idrest,v::valacc,id::idacc);
then (outValues,outIds);
case (true,Values.STRING(str)::vrest,(id as "resultFile")::idrest,_,_)
equation
str = System.basename(str);
(outValues,outIds) = filterSimulationResults(filter,vrest,idrest,Values.STRING(str)::valacc,id::idacc);
then (outValues,outIds);
case (true,_::vrest,_::idrest,_,_)
equation
(outValues,outIds) = filterSimulationResults(filter,vrest,idrest,valacc,idacc);
then (outValues,outIds);
case (false,_,_,_,_) then (inValues,inIds);
end match;
end filterSimulationResults;

protected function valRecordString
"function: valRecordString
This function returns a textual representation of a record,
Expand Down
5 changes: 4 additions & 1 deletion Compiler/Util/Flags.mo
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@ constant DebugFlag DUMP_ENCAPSULATEWHENCONDITIONS = DEBUG_FLAG(115, "dumpEncapsu
Util.gettext("Dumps the results of the preOptModule encapsulateWhenConditions"));
constant DebugFlag ON_RELAXATION = DEBUG_FLAG(116, "onRelaxation",
Util.gettext("perform O(n) Relaxation"));
constant DebugFlag SHORT_OUTPUT = DEBUG_FLAG(117, "shortOutput",
Util.gettext("Enables short output of the simulate() command. Useful for tools like OMNotebook."));

// This is a list of all debug flags, to keep track of which flags are used. A
// flag can not be used unless it's in this list, and the list is checked at
Expand Down Expand Up @@ -518,7 +520,8 @@ constant list<DebugFlag> allDebugFlags = {
INLINE_SOLVER,
DUMP_INLINE_SOLVER,
DUMP_ENCAPSULATEWHENCONDITIONS,
ON_RELAXATION
ON_RELAXATION,
SHORT_OUTPUT
};

// CONFIGURATION FLAGS
Expand Down

0 comments on commit e2bb812

Please sign in to comment.