Skip to content

Commit

Permalink
fixed error messages when plotting.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1584 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Mar 18, 2005
1 parent e873d79 commit 3b5e385
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
3 changes: 1 addition & 2 deletions modeq/inst.rml
Expand Up @@ -5036,8 +5036,7 @@ relation inst_real_binding: (Types.Mod,int list,string) => real option =
-----------------------------------------
inst_real_binding(mod,index_list,bind_name) => SOME(result)

rule
inst_binding(mod,(Types.T_REAL([]),NONE),index_list,bind_name) => NONE
rule inst_binding(mod,(Types.T_REAL([]),NONE),index_list,bind_name) => NONE
-----------------------------------------
inst_real_binding(mod,index_list,bind_name) => NONE

Expand Down
9 changes: 7 additions & 2 deletions modeq/runtime/printimpl.c
Expand Up @@ -20,9 +20,8 @@ void Print_5finit(void)

}

RML_BEGIN_LABEL(Print__print_5ferror_5fbuf)
void print_error_buf_impl(char *str)
{
char* str = RML_STRINGDATA(rmlA0);
/* printf("cursize: %d, nfilled %d, strlen: %d\n",cursize,nfilled,strlen(str));*/

assert(str != NULL);
Expand All @@ -33,6 +32,12 @@ RML_BEGIN_LABEL(Print__print_5ferror_5fbuf)

sprintf((char*)(errorBuf+strlen(errorBuf)),"%s",str);
errorNfilled=strlen(errorBuf);
}

RML_BEGIN_LABEL(Print__print_5ferror_5fbuf)
{
char* str = RML_STRINGDATA(rmlA0);
print_error_buf_impl(str);

/* printf("%s",str);*/

Expand Down
10 changes: 8 additions & 2 deletions modeq/runtime/ptolemyio.cpp
Expand Up @@ -35,6 +35,8 @@ extern "C"
#include "../values.h"
#include <stdio.h>
#include "../absyn_builder/yacclib.h"
void print_error_buf_impl(char*str);


/* Given a file name and an array of variables, return the RML datastructure
in Values for Real[size(vars,1],:] i.e. a matrix of variable values, one column for each variable. */
Expand Down Expand Up @@ -62,10 +64,12 @@ extern "C"
} else {
if( readIntervalSize == 0) {
cerr << "could not read interval size." << endl;
print_error_buf_impl("could not read interval size.\n");
return NULL;
}
if (readIntervalSize != datasize) {
cerr << "intervalsize not matching data size." << endl;
print_error_buf_impl("intervalsize not matching data size.\n");
return NULL;
}
}
Expand All @@ -82,8 +86,10 @@ extern "C"
while( string(buf).find(var) == string(buf).npos) {
if (!stream.getline(buf,255)) {
// if we reached end of file return..
cerr << "variable " << var << " not found in simulation result."
<< endl;
string str=string("variable ")+ vars[i]
+" not found in simulation result.\n";
cerr << str;
print_error_buf_impl((char*)str.c_str());
return NULL;
}
}
Expand Down

0 comments on commit 3b5e385

Please sign in to comment.