Skip to content

Commit

Permalink
Use omc_error instead of the simulation streams (since expressions ca…
Browse files Browse the repository at this point in the history
…n be called from the function run-time)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@19234 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Feb 21, 2014
1 parent 9df0539 commit 33aeef4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion SimulationRuntime/c/simulation_data.h
Expand Up @@ -49,7 +49,6 @@ typedef void* f2c_integer_ptr;
typedef integer* f2c_integer_ptr;
#endif

#define omc_dummyFileInfo {"",-1,-1,-1,-1,1}
#define omc_dummyVarInfo {-1,"","",omc_dummyFileInfo}
#define omc_dummyEquationInfo {-1,0,"",-1,NULL}
#define omc_dummyFunctionInfo {-1,"",omc_dummyFileInfo}
Expand Down
6 changes: 5 additions & 1 deletion SimulationRuntime/c/util/base_array.c
Expand Up @@ -33,6 +33,7 @@
#include "base_array.h"
#include "index_spec.h"
#include "memory_pool.h"
#include "omc_error.h"

#include <stdlib.h>
#include <stdio.h>
Expand Down Expand Up @@ -325,7 +326,10 @@ size_t calc_base_index_va(const base_array_t *source, int ndims, va_list ap)
index = 0;
for(i = 0; i < ndims; ++i) {
int dim_i = va_arg(ap, _index_t) - 1;
assertStreamPrint(NULL, dim_i >= 0 && dim_i < source->dim_size[i], "Dimension %d has bounds 1..%d, got array subscript %d", i, source->dim_size[i], dim_i+1);
if (dim_i < 0 || dim_i >= source->dim_size[i]) {
FILE_INFO info = omc_dummyFileInfo;
omc_assert(NULL, info, "Dimension %d has bounds 1..%d, got array subscript %d", i+1, source->dim_size[i], dim_i+1);
}
index = (index * source->dim_size[i]) + dim_i;
}

Expand Down
2 changes: 2 additions & 0 deletions SimulationRuntime/c/util/omc_error.h
Expand Up @@ -53,6 +53,8 @@ typedef struct _FILE_INFO
int readonly;
} FILE_INFO;

#define omc_dummyFileInfo {"",-1,-1,-1,-1,1}

extern void printInfo(FILE *stream, FILE_INFO info);
extern void (*omc_assert)(threadData_t*,FILE_INFO,const char*, ...);
extern void (*omc_assert_warning)(FILE_INFO,const char*, ...);
Expand Down

0 comments on commit 33aeef4

Please sign in to comment.