Skip to content

Commit

Permalink
more fixes for ticket:5507
Browse files Browse the repository at this point in the history
- give defaults for 'extent' and 'textString' also in the Text record
other changes
- split execstat in NFApi for better performance info
- display the OMEdit log numbers with better formatting
  • Loading branch information
adrpo committed May 31, 2019
1 parent 716cbd9 commit dbbd56e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions OMCompiler/Compiler/FrontEnd/Constants.mo
Expand Up @@ -332,8 +332,8 @@ record Text
Real lineThickness = 0.25 \"Line thickness\";
// end FilledShape
Real extent[2,2]/*(each final unit=\"mm\")*/;
String textString;
Real extent[2,2]/*(each final unit=\"mm\")*/ = {{-10, -10}, {10, 10}};
String textString = \"\";
Real fontSize = 0 \"unit pt\";
Integer textColor[3] = {-1, -1, -1} \"defaults to fillColor\";
String fontName = \"\";
Expand Down
2 changes: 2 additions & 0 deletions OMCompiler/Compiler/Script/NFApi.mo
Expand Up @@ -565,9 +565,11 @@ algorithm
(program, top) := mkTop(absynProgram);

name := Absyn.pathString(classPath);
execStat("NFApi.mkTop("+ name +")");

// Look up the class to instantiate and mark it as the root class.
cls := Lookup.lookupClassName(classPath, top, Absyn.dummyInfo, checkAccessViolations = false);
execStat("NFApi.lookup("+ name +")");
cls := InstNode.setNodeType(InstNodeType.ROOT_CLASS(InstNode.EMPTY_NODE()), cls);

// Initialize the storage for automatically generated inner elements.
Expand Down
5 changes: 3 additions & 2 deletions OMEdit/OMEdit/OMEditGUI/OMC/OMCProxy.cpp
Expand Up @@ -355,6 +355,7 @@ void OMCProxy::logCommand(QString command, QTime *commandTime, bool saveToHistor
*/
void OMCProxy::logResponse(QString command, QString response, QTime *responseTime)
{
double elapsed = (double)responseTime->elapsed() / 1000.0;
QString firstLine("");
for (int i = 0; i < command.length(); i++)
if (command[i] != '\n')
Expand All @@ -372,9 +373,9 @@ void OMCProxy::logResponse(QString command, QString response, QTime *responseTim
Utilities::insertText(mpOMCLoggerTextBox, response + "\n\n", format);
// write the log to communication log file
if (mpCommunicationLogFile) {
mTotalOMCCallsTime += elapsed;
fputs(QString("%1 %2\n").arg(response).arg(responseTime->currentTime().toString("hh:mm:ss:zzz")).toUtf8().constData(), mpCommunicationLogFile);
mTotalOMCCallsTime += (double)responseTime->elapsed() / 1000;
fputs(QString("#s#; %1; %2; \'%3\'\n\n").arg(QString::number((double)responseTime->elapsed() / 1000)).arg(QString::number(mTotalOMCCallsTime)).arg(firstLine).toUtf8().constData(), mpCommunicationLogFile);
fputs(QString("#s#; %1; %2; \'%3\'\n\n").arg(QString::number(elapsed, 'f', 6)).arg(QString::number(mTotalOMCCallsTime, 'f', 6)).arg(firstLine).toUtf8().constData(), mpCommunicationLogFile);
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions OMEdit/OMEdit/OMEditGUI/OMS/OMSProxy.cpp
Expand Up @@ -165,6 +165,7 @@ void OMSProxy::logCommand(QTime *commandTime, QString command)
*/
void OMSProxy::logResponse(QString command, oms_status_enu_t status, QTime *responseTime)
{
double elapsed = (double)responseTime->elapsed() / 1000.0;
QString firstLine("");
for (int i = 0; i < command.length(); i++) {
if (command[i] != '\n') {
Expand All @@ -176,9 +177,9 @@ void OMSProxy::logResponse(QString command, oms_status_enu_t status, QTime *resp

// write the log to communication log file
if (mpCommunicationLogFile) {
mTotalOMSCallsTime += elapsed;
fputs(QString("%1 %2\n").arg(status).arg(responseTime->currentTime().toString("hh:mm:ss:zzz")).toUtf8().constData(), mpCommunicationLogFile);
mTotalOMSCallsTime += (double)responseTime->elapsed() / 1000;
fputs(QString("#s#; %1; %2; \'%3\'\n\n").arg(QString::number((double)responseTime->elapsed() / 1000)).arg(QString::number(mTotalOMSCallsTime)).arg(firstLine).toUtf8().constData(), mpCommunicationLogFile);
fputs(QString("#s#; %1; %2; \'%3\'\n\n").arg(QString::number(elapsed, 'f', 6)).arg(QString::number(mTotalOMSCallsTime, 'f', 6)).arg(firstLine).toUtf8().constData(), mpCommunicationLogFile);
}

MainWindow::instance()->printStandardOutAndErrorFilesMessages();
Expand Down

0 comments on commit dbbd56e

Please sign in to comment.