Skip to content

Commit

Permalink
Change Error_rml to do the same thing Error_omc does (it works as lon…
Browse files Browse the repository at this point in the history
…g as you call the functions through dynload)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@20439 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed May 7, 2014
1 parent bf16b24 commit fc34bd1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
16 changes: 0 additions & 16 deletions Compiler/runtime/Error_omc.cpp
Expand Up @@ -44,22 +44,6 @@ extern "C" {

extern "C" {

/* Handle ModelicaFormatError called during translation (external Modelica packages, print to Error.mo instead of stdout) */
void OpenModelica_ErrorModule_ModelicaVFormatError(const char *fmt, va_list ap)
{
char *str;
vasprintf(&str, fmt, ap);
c_add_message(NULL,0,ErrorType_runtime,ErrorLevel_error,str,NULL,0);
free(str);
MMC_THROW();
}

void OpenModelica_ErrorModule_ModelicaError(const char *str)
{
c_add_message(NULL,0,ErrorType_runtime,ErrorLevel_error,str,NULL,0);
MMC_THROW();
}

void Error_registerModelicaFormatError()
{
OpenModelica_ModelicaError = OpenModelica_ErrorModule_ModelicaError;
Expand Down
3 changes: 2 additions & 1 deletion Compiler/runtime/Error_rml.cpp
Expand Up @@ -195,7 +195,8 @@ RML_BEGIN_LABEL(ErrorExt__setShowErrorMessages)

RML_BEGIN_LABEL(ErrorExt__registerModelicaFormatError)
{
/* Bootstrapped compiler only */
OpenModelica_ModelicaError = OpenModelica_ErrorModule_ModelicaError;
OpenModelica_ModelicaVFormatError = OpenModelica_ErrorModule_ModelicaVFormatError;
RML_TAILCALLK(rmlSC);
}

Expand Down
25 changes: 24 additions & 1 deletion Compiler/runtime/errorext.cpp
Expand Up @@ -37,7 +37,10 @@
#include <stdlib.h>
#include <utility>
#include "errorext.h"
#include <openmodelica.h>
#include "openmodelica.h"
#include "meta_modelica.h"
#include "util/omc_error.h"
#include "util/ModelicaUtilitiesExtra.h"

using namespace std;

Expand Down Expand Up @@ -489,3 +492,23 @@ int showErrorMessages(threadData_t *threadData)
{
return getMembers(threadData)->showErrorMessages;
}

/* Handle ModelicaFormatError called during translation (external Modelica packages, print to Error.mo instead of stdout) */
extern "C" {

void OpenModelica_ErrorModule_ModelicaVFormatError(const char *fmt, va_list ap)
{
char *str;
vasprintf(&str, fmt, ap);
c_add_message(NULL,0,ErrorType_runtime,ErrorLevel_error,str,NULL,0);
free(str);
MMC_THROW();
}

void OpenModelica_ErrorModule_ModelicaError(const char *str)
{
c_add_message(NULL,0,ErrorType_runtime,ErrorLevel_error,str,NULL,0);
MMC_THROW();
}

}

0 comments on commit fc34bd1

Please sign in to comment.