modelica_metatype listAppend(modelica_metatype lst1,modelica_metatype lst2) { int length = 0, i = 0; struct mmc_cons_struct *res = NULL; struct mmc_cons_struct *p = NULL; if (MMC_NILTEST(lst2)) /* If lst2 is empty, simply return lst1; huge performance gain for some uses of listAppend */ return lst1; length = listLength(lst1); if (length == 0) /* We need to check for empty lst1 */ return lst2; res = (struct mmc_cons_struct*)mmc_alloc_words( length * 3 /*(sizeof(struct mmc_cons_struct)/sizeof(void*))*/ ); /* Do one single big alloc. It's cheaper */ for (i=0; i<length-1; i++) { /* Write all except the last element... */ struct mmc_cons_struct *p = res+i; p->header = MMC_STRUCTHDR(2, MMC_CONS_CTOR); p->data[0] = MMC_CAR(lst1); p->data[1] = MMC_TAGPTR(res+i+1); lst1 = MMC_CDR(lst1); } /* The last element is a bit special. It points to lst2. */ p = res+length-1; p->header = MMC_STRUCTHDR(2, MMC_CONS_CTOR); p->data[0] = MMC_CAR(lst1); p->data[1] = lst2; return MMC_TAGPTR(res); }
const char* UnitParserExt_unit2str(void *nums, void *denoms, void *tpnoms, void *tpdenoms, void *tpstrs) { long int i1,i2; string tpParam; Unit unit; unit.unitVec.clear(); unit.typeParamVec.clear(); /* Add baseunits*/ while(MMC_GETHDR(nums) == MMC_CONSHDR) { i1 = MMC_UNTAGFIXNUM(MMC_CAR(nums)); i2 = MMC_UNTAGFIXNUM(MMC_CAR(denoms)); unit.unitVec.push_back(Rational(i1,i2)); nums = MMC_CDR(nums); denoms = MMC_CDR(denoms); } /* Add type parameters*/ while(MMC_GETHDR(tpnoms) == MMC_CONSHDR) { i1 = MMC_UNTAGFIXNUM(MMC_CAR(tpnoms)); i2 = MMC_UNTAGFIXNUM(MMC_CAR(tpdenoms)); tpParam = string(MMC_STRINGDATA(MMC_CAR(tpstrs))); unit.typeParamVec.insert(std::pair<string,Rational>(tpParam,Rational(i1,i2))); tpnoms = MMC_CDR(tpnoms); tpdenoms = MMC_CDR(tpdenoms); } //string res = unitParser->unit2str(unit); string res = unitParser->prettyPrintUnit2str(unit); return strcpy(ModelicaAllocateString(res.size()), res.c_str()); }
modelica_metatype boxptr_listHead(threadData_t *threadData, modelica_metatype lst) { if (!MMC_NILTEST(lst)) { return MMC_CAR(lst); } MMC_THROW_INTERNAL(); }
void boxptr_listSetFirst(threadData_t *threadData, modelica_metatype cellToDestroy, modelica_metatype newContent) { if (MMC_NILTEST(cellToDestroy)) { MMC_THROW_INTERNAL(); } MMC_CAR(cellToDestroy) = newContent; }
extern void BackendDAEEXT_setIncidenceMatrix(modelica_integer nvars, modelica_integer neqns, modelica_integer nz, modelica_metatype incidencematrix) { int i=0; long int i1; int j=0; modelica_integer nelts = MMC_HDRSLOTS(MMC_GETHDR(incidencematrix)); if (col_ptrs) free(col_ptrs); col_ptrs = (int*) malloc((neqns+1) * sizeof(int)); col_ptrs[neqns]=nz; if (col_ids) free(col_ids); col_ids = (int*) malloc(nz * sizeof(int)); for(i=0; i<neqns; ++i) { modelica_metatype ie = MMC_STRUCTDATA(incidencematrix)[i]; col_ptrs[i] = j; while(MMC_GETHDR(ie) == MMC_CONSHDR) { i1 = MMC_UNTAGFIXNUM(MMC_CAR(ie)); if (i1>0) { col_ids[j++] = i1-1; } ie = MMC_CDR(ie); } } }
metamodelica_string stringAppendList(modelica_metatype lst) { /* fprintf(stderr, "stringAppendList(%s)\n", anyString(lst)); */ modelica_integer lstLen = 0, len = 0; unsigned nbytes = 0, header = 0, nwords = 0; modelica_metatype car = NULL, lstHead = NULL, lstTmp = NULL; char *tmp = NULL; struct mmc_string *res = NULL; void *p = NULL; lstLen = 0; nbytes = 0; lstHead = lst; lstTmp = lst; while (!listEmpty(lstTmp)) { MMC_CHECK_STRING(MMC_CAR(lstTmp)); nbytes += MMC_STRLEN(MMC_CAR(lstTmp)); /* fprintf(stderr, "stringAppendList: Has success reading input %d: %s\n", lstLen, MMC_STRINGDATA(MMC_CAR(lst))); */ lstTmp = MMC_CDR(lstTmp); lstLen++; } if (nbytes == 0) return mmc_emptystring; if (lstLen == 1) return MMC_CAR(lstHead); header = MMC_STRINGHDR(nbytes); nwords = MMC_HDRSLOTS(header) + 1; res = (struct mmc_string *) mmc_alloc_words_atomic(nwords); res->header = header; tmp = (char*) res->data; nbytes = 0; lstTmp = lstHead; while (!listEmpty(lstTmp)) { car = MMC_CAR(lstTmp); len = MMC_STRLEN(car); /* fprintf(stderr, "stringAppendList: %s %d %d\n", MMC_STRINGDATA(car), len, strlen(MMC_STRINGDATA(car))); */ /* Might be useful to check this when debugging. String literals are often done wrong :) */ MMC_DEBUG_ASSERT(len == strlen(MMC_STRINGDATA(car))); memcpy(tmp+nbytes,MMC_STRINGDATA(car),len); nbytes += len; lstTmp = MMC_CDR(lstTmp); } tmp[nbytes] = '\0'; /* fprintf(stderr, "stringAppendList(%s)=>%s\n", anyString(lstHead), anyString(MMC_TAGPTR(res))); */ p = MMC_TAGPTR(res); MMC_CHECK_STRING(p); return p; }
modelica_boolean listMember(modelica_metatype obj, modelica_metatype lst) { while (!MMC_NILTEST(lst)) { if (valueEq(MMC_CAR(lst), obj)) { return 1; } lst = MMC_CDR(lst); } return 0; }
extern void Error_addSourceMessage(threadData_t *threadData,int _id, void *msg_type, void *severity, int _sline, int _scol, int _eline, int _ecol, int _read_only, const char* _filename, const char* _msg, void* tokenlst) { ErrorMessage::TokenList tokens; while(MMC_GETHDR(tokenlst) != MMC_NILHDR) { tokens.push_back(string(MMC_STRINGDATA(MMC_CAR(tokenlst)))); tokenlst=MMC_CDR(tokenlst); } add_source_message(threadData,_id, (ErrorType) (MMC_HDRCTOR(MMC_GETHDR(msg_type))-Error__SYNTAX_3dBOX0), (ErrorLevel) (MMC_HDRCTOR(MMC_GETHDR(severity))-Error__INTERNAL_3dBOX0), _msg,tokens,_sline,_scol,_eline,_ecol,_read_only,_filename); }
modelica_metatype listArray(modelica_metatype lst) { int nelts = listLength(lst); void* arr = (struct mmc_struct*)mmc_mk_box_no_assign(nelts, MMC_ARRAY_TAG); void **arrp = MMC_STRUCTDATA(arr); int i = 0; for(i=0; i<nelts; i++) { arrp[i] = MMC_CAR(lst); lst = MMC_CDR(lst); } return arr; }
modelica_metatype listReverse(modelica_metatype lst) { modelica_metatype res = NULL; res = mmc_mk_nil(); while (!MMC_NILTEST(lst)) { res = mmc_mk_cons(MMC_CAR(lst),res); lst = MMC_CDR(lst); } return res; }
extern void Error_addMessage(threadData_t *threadData,int errorID, void *msg_type, void *severity, const char* message, modelica_metatype tokenlst) { ErrorMessage::TokenList tokens; while (MMC_GETHDR(tokenlst) != MMC_NILHDR) { const char* token = MMC_STRINGDATA(MMC_CAR(tokenlst)); tokens.push_back(string(token)); tokenlst=MMC_CDR(tokenlst); } add_source_message(threadData,errorID, (ErrorType) (MMC_HDRCTOR(MMC_GETHDR(msg_type))-Error__SYNTAX_3dBOX0), (ErrorLevel) (MMC_HDRCTOR(MMC_GETHDR(severity))-Error__INTERNAL_3dBOX0), message,tokens,0,0,0,0,0,""); }
modelica_metatype listReverse(modelica_metatype lst) { modelica_metatype res = NULL; if (MMC_NILTEST(lst) || MMC_NILTEST(MMC_CDR(lst))) { // 0/1 elements are already reversed return lst; } res = mmc_mk_nil(); do { res = mmc_mk_cons(MMC_CAR(lst),res); lst = MMC_CDR(lst); } while (!MMC_NILTEST(lst)); return res; }
void Error_addMessage(int errorID, void *msg_type, void *severity, const char* message, modelica_metatype tokenlst) { ErrorMessage::TokenList tokens; if (error_on) { while(MMC_GETHDR(tokenlst) != MMC_NILHDR) { const char* token = MMC_STRINGDATA(MMC_CAR(tokenlst)); tokens.push_back(string(token)); tokenlst=MMC_CDR(tokenlst); } add_message(errorID, (ErrorType) (MMC_HDRCTOR(MMC_GETHDR(msg_type))-Error__SYNTAX_3dBOX0), (ErrorLevel) (MMC_HDRCTOR(MMC_GETHDR(severity))-Error__ERROR_3dBOX0), message,tokens); } }
modelica_metatype boxptr_listGet(threadData_t *threadData,modelica_metatype lst, modelica_metatype ii) { modelica_metatype res; int i = mmc_unbox_integer(ii); if (i < 1) MMC_THROW_INTERNAL(); while (!MMC_NILTEST(lst)) { if (i == 1) { return MMC_CAR(lst); } lst = MMC_CDR(lst); i--; } MMC_THROW_INTERNAL(); /* List was not long enough */ }
modelica_metatype boxptr_listDelete(threadData_t *threadData, modelica_metatype lst, modelica_metatype iix) { /* TODO: If we assume the index exists we can do this in a much better way */ int ix = mmc_unbox_integer(iix); modelica_metatype *tmpArr = NULL; int i = 0; if (ix <= 0) { MMC_THROW_INTERNAL(); } tmpArr = (modelica_metatype *) GC_malloc(sizeof(modelica_metatype)*(ix-1)); /* We know the size of the first part of the list */ if (tmpArr == NULL) { fprintf(stderr, "%s:%d: malloc failed", __FILE__, __LINE__); EXIT(1); } for (i=0; i<ix-1; i++) { if (listEmpty(lst)) { if (tmpArr) { GC_free(tmpArr); } MMC_THROW_INTERNAL(); } tmpArr[i] = MMC_CAR(lst); lst = MMC_CDR(lst); } if (listEmpty(lst)) { GC_free(tmpArr); MMC_THROW_INTERNAL(); } lst = MMC_CDR(lst); for (i=ix-2; i>=0; i--) { lst = mmc_mk_cons(tmpArr[i], lst); } GC_free(tmpArr); return lst; }
static void* SimulationResultsImpl__readDataset(const char *filename, void *vars, int dimsize, int suggestReadAllVars, SimulationResult_Globals* simresglob, int runningTestsuite) { const char *msg[2] = {"",""}; void *res,*col; char *var; double *vals; int i; if (UNKNOWN_PLOT == SimulationResultsImpl__openFile(filename,simresglob)) { return NULL; } res = mmc_mk_nil(); switch (simresglob->curFormat) { case MATLAB4: { ModelicaMatVariable_t *mat_var; if (dimsize == 0) { dimsize = simresglob->matReader.nrows; } else if (simresglob->matReader.nrows != dimsize) { fprintf(stderr, "dimsize: %d, rows %d\n", dimsize, simresglob->matReader.nrows); c_add_message(NULL,-1, ErrorType_scripting, ErrorLevel_error, gettext("readDataset(...): Expected and actual dimension sizes do not match."), NULL, 0); return NULL; } if (suggestReadAllVars) { omc_matlab4_read_all_vals(&simresglob->matReader); } while (MMC_NILHDR != MMC_GETHDR(vars)) { var = MMC_STRINGDATA(MMC_CAR(vars)); vars = MMC_CDR(vars); mat_var = omc_matlab4_find_var(&simresglob->matReader,var); if (mat_var == NULL) { msg[0] = runningTestsuite ? SystemImpl__basename(filename) : filename; msg[1] = var; c_add_message(NULL,-1, ErrorType_scripting, ErrorLevel_error, gettext("Could not read variable %s in file %s."), msg, 2); return NULL; } else if (mat_var->isParam) { col=mmc_mk_nil(); for (i=0;i<dimsize;i++) col=mmc_mk_cons(mmc_mk_rcon((mat_var->index<0)?-simresglob->matReader.params[abs(mat_var->index)-1]:simresglob->matReader.params[abs(mat_var->index)-1]),col); res = mmc_mk_cons(col,res); } else { vals = omc_matlab4_read_vals(&simresglob->matReader,mat_var->index); col=mmc_mk_nil(); for (i=0;i<dimsize;i++) col=mmc_mk_cons(mmc_mk_rcon(vals[i]),col); res = mmc_mk_cons(col,res); } } return res; } case PLT: { return read_ptolemy_dataset(filename,vars,dimsize); } case CSV: { while (MMC_NILHDR != MMC_GETHDR(vars)) { var = MMC_STRINGDATA(MMC_CAR(vars)); vars = MMC_CDR(vars); vals = simresglob->csvReader ? read_csv_dataset(simresglob->csvReader,var) : NULL; if (vals == NULL) { msg[0] = runningTestsuite ? SystemImpl__basename(filename) : filename; msg[1] = var; c_add_message(NULL,-1, ErrorType_scripting, ErrorLevel_error, gettext("Could not read variable %s in file %s."), msg, 2); return NULL; } else { col=mmc_mk_nil(); for (i=0;i<dimsize;i++) { col=mmc_mk_cons(mmc_mk_rcon(vals[i]),col); } res = mmc_mk_cons(col,res); } } return res; } default: msg[0] = PlotFormatStr[simresglob->curFormat]; c_add_message(NULL,-1, ErrorType_scripting, ErrorLevel_error, gettext("readDataSet() not implemented for plot format: %s\n"), msg, 1); return NULL; } }
int SimulationResults_filterSimulationResults(const char *inFile, const char *outFile, void *vars, int numberOfIntervals) { const char *msg[5] = {"","","","",""}; void *tmp; if (UNKNOWN_PLOT == SimulationResultsImpl__openFile(inFile, &simresglob)) { return 0; } vars = mmc_mk_cons(mmc_mk_scon("time"),vars); switch (simresglob.curFormat) { case MATLAB4: { int numToFilter = listLength(vars); int i, j; int numUnique = 0; int numUniqueParam = 1; int longestName = 0; int longestDesc = 0; ModelicaMatVariable_t **mat_var = omc_alloc_interface.malloc(numToFilter*sizeof(ModelicaMatVariable_t*)); int *indexes = (int*) omc_alloc_interface.malloc(simresglob.matReader.nvar*sizeof(int)); /* Need it to be zeros; note that the actual number of indexes is smaller */ int *parameter_indexes = (int*) omc_alloc_interface.malloc(simresglob.matReader.nparam*sizeof(int)); /* Need it to be zeros; note that the actual number of indexes is smaller */ int *indexesToOutput = NULL; int *parameter_indexesToOutput = NULL; FILE *fout = NULL; char *tmp; double start_stop[2] = {0}; double start = omc_matlab4_startTime(&simresglob.matReader); double stop = omc_matlab4_stopTime(&simresglob.matReader); parameter_indexes[0] = 1; /* time */ omc_matlab4_read_all_vals(&simresglob.matReader); if (endsWith(outFile,".csv")) { double **vals = omc_alloc_interface.malloc(sizeof(double*)*numToFilter); FILE *fout = NULL; for (i=0; i<numToFilter; i++) { const char *var = MMC_STRINGDATA(MMC_CAR(vars)); vars = MMC_CDR(vars); mat_var[i] = omc_matlab4_find_var(&simresglob.matReader, var); if (mat_var[i] == NULL) { msg[0] = SystemImpl__basename(inFile); msg[1] = var; c_add_message(NULL,-1, ErrorType_scripting, ErrorLevel_error, gettext("Could not read variable %s in file %s."), msg, 2); return 0; } if (mat_var[i]->isParam) { msg[0] = var; c_add_message(NULL,-1, ErrorType_scripting, ErrorLevel_error, gettext("Could not filter parameter %s since the output format is CSV (only variables are allowed)."), msg, 1); return 0; } else { vals[i] = omc_matlab4_read_vals(&simresglob.matReader, mat_var[i]->index); } } fout = fopen(outFile, "w"); fprintf(fout, "time"); for (i=1; i<numToFilter; i++) { fprintf(fout, ",\"%s\"", mat_var[i]->name); } fprintf(fout, ",nrows=%d\n", simresglob.matReader.nrows); for (i=0; i<simresglob.matReader.nrows; i++) { fprintf(fout, "%.15g", vals[0][i]); for (j=1; j<numToFilter; j++) { fprintf(fout, ",%.15g", vals[j][i]); } fprintf(fout, "\n"); } fclose(fout); return 1; } /* Not CSV */ for (i=0; i<numToFilter; i++) { const char *var = MMC_STRINGDATA(MMC_CAR(vars)); vars = MMC_CDR(vars); mat_var[i] = omc_matlab4_find_var(&simresglob.matReader,var); if (mat_var[i] == NULL) { msg[0] = SystemImpl__basename(inFile); msg[1] = var; c_add_message(NULL,-1, ErrorType_scripting, ErrorLevel_error, gettext("Could not read variable %s in file %s."), msg, 2); return 0; } if (mat_var[i]->isParam) { /* Store the old index in the array */ if (0==parameter_indexes[abs(mat_var[i]->index)-1]++) { numUniqueParam++; } } else { /* Store the old index in the array */ if (0==indexes[abs(mat_var[i]->index)-1]++) { numUnique++; } } longestName = intMax(longestName, strlen(mat_var[i]->name)); longestDesc = intMax(longestDesc, strlen(mat_var[i]->descr)); } /* Create the list of variable indexes to output */ indexesToOutput = omc_alloc_interface.malloc_atomic(numUnique * sizeof(int)); parameter_indexesToOutput = omc_alloc_interface.malloc_atomic(numUniqueParam * sizeof(int)); j=0; for (i=0; i<simresglob.matReader.nvar; i++) { if (indexes[i]) { indexesToOutput[j++] = i+1; } /* indexes becomes the lookup table from old index to new index */ indexes[i] = j; } j=0; for (i=0; i<simresglob.matReader.nparam; i++) { if (parameter_indexes[i]) { parameter_indexesToOutput[j++] = i+1; } /* indexes becomes the lookup table from old index to new index */ parameter_indexes[i] = j; } fout = fopen(outFile, "wb"); if (fout == NULL) { return failedToWriteToFile(outFile); } /* Matrix list: "Aclass" "name" "description" "dataInfo" "data_1" "data_2" */ if (writeMatVer4AclassNormal(fout)) { return failedToWriteToFile(outFile); } if (writeMatVer4MatrixHeader(fout, "name", numToFilter, longestName, sizeof(int8_t))) { return failedToWriteToFile(outFile); } tmp = omc_alloc_interface.malloc(numToFilter*longestName); for (i=0; i<numToFilter; i++) { int len = strlen(mat_var[i]->name); for (j=0; j<len; j++) { tmp[numToFilter*j+i] = mat_var[i]->name[j]; } } if (1 != fwrite(tmp, numToFilter*longestName, 1, fout)) { return failedToWriteToFile(outFile); } GC_free(tmp); if (writeMatVer4MatrixHeader(fout, "description", numToFilter, longestDesc, sizeof(int8_t))) { return failedToWriteToFile(outFile); } tmp = omc_alloc_interface.malloc(numToFilter*longestDesc); for (i=0; i<numToFilter; i++) { int len = strlen(mat_var[i]->descr); for (j=0; j<len; j++) { tmp[numToFilter*j+i] = mat_var[i]->descr[j]; } } if (1 != fwrite(tmp, numToFilter*longestDesc, 1, fout)) { return failedToWriteToFile(outFile); } GC_free(tmp); if (writeMatVer4MatrixHeader(fout, "dataInfo", numToFilter, 4, sizeof(int32_t))) { return failedToWriteToFile(outFile); } for (i=0; i<numToFilter; i++) { int32_t x = mat_var[i]->isParam ? 1 : 2; /* data_1 or data_2 */ if (1 != fwrite(&x, sizeof(int32_t), 1, fout)) { return failedToWriteToFile(outFile); } } for (i=0; i<numToFilter; i++) { int32_t x = (mat_var[i]->index < 0 ? -1 : 1) * (mat_var[i]->isParam ? parameter_indexes[abs(mat_var[i]->index)-1] : indexes[abs(mat_var[i]->index)-1]); if (1 != fwrite(&x, sizeof(int32_t), 1, fout)) { return failedToWriteToFile(outFile); } } for (i=0; i<numToFilter; i++) { int32_t x = 0; /* linear interpolation */ if (1 != fwrite(&x, sizeof(int32_t), 1, fout)) { return failedToWriteToFile(outFile); } } for (i=0; i<numToFilter; i++) { int32_t x = -1; /* not defined outside the time interval */ if (1 != fwrite(&x, sizeof(int32_t), 1, fout)) { return failedToWriteToFile(outFile); } } if (writeMatVer4MatrixHeader(fout, "data_1", 2, numUniqueParam, sizeof(double))) { return failedToWriteToFile(outFile); } start = omc_matlab4_startTime(&simresglob.matReader); stop = omc_matlab4_stopTime(&simresglob.matReader); start_stop[0]=start; start_stop[1]=stop; if (1 != fwrite(start_stop, sizeof(double)*2, 1, fout)) { return failedToWriteToFile(outFile); } for (i=1; i<numUniqueParam; i++) { int paramIndex = parameter_indexesToOutput[i]; double d[2] = {simresglob.matReader.params[abs(paramIndex)-1],0}; d[1] = d[0]; if (1!=fwrite(d, sizeof(double)*2, 1, fout)) { return failedToWriteToFile(outFile); } } if (numberOfIntervals) { double *timevals = omc_matlab4_read_vals(&simresglob.matReader, 1); int last_found=0; int nevents=0, neventpoints=0; for (i=1; i<numberOfIntervals; i++) { double t = start + (stop-start)*((double)i)/numberOfIntervals; while (timevals[j]<=t) { if (timevals[j]==timevals[j+1]) { while (timevals[j]==timevals[j+1]) { j++; neventpoints++; } nevents++; } j++; } } msg[4] = inFile; GC_asprintf((char**)msg+3, "%d", simresglob.matReader.nrows); GC_asprintf((char**)msg+2, "%d", numberOfIntervals); GC_asprintf((char**)msg+1, "%d", nevents); GC_asprintf((char**)msg+0, "%d", neventpoints); c_add_message(NULL,-1, ErrorType_scripting, ErrorLevel_notification, gettext("Resampling %s from %s points to %s points, removing %s events stored in %s points.\n"), msg, 5); } if (writeMatVer4MatrixHeader(fout, "data_2", numberOfIntervals ? numberOfIntervals+1 : simresglob.matReader.nrows, numUnique, sizeof(double))) { return failedToWriteToFile(outFile); } for (i=0; i<numUnique; i++) { double *vals = NULL; int nrows; if (numberOfIntervals) { omc_matlab4_read_all_vals(&simresglob.matReader); nrows = numberOfIntervals+1; vals = omc_alloc_interface.malloc_atomic(sizeof(double)*nrows); for (j=0; j<=numberOfIntervals; j++) { double t = j==numberOfIntervals ? stop : start + (stop-start)*((double)j)/numberOfIntervals; ModelicaMatVariable_t var = {0}; var.name=""; var.descr=""; var.isParam=0; var.index=indexesToOutput[i]; if (omc_matlab4_val(vals+j, &simresglob.matReader, &var, t)) { msg[2] = inFile; GC_asprintf((char**)msg+1, "%d", indexesToOutput[i]); GC_asprintf((char**)msg+0, "%.15g", t); c_add_message(NULL,-1, ErrorType_scripting, ErrorLevel_error, gettext("Resampling %s failed to get variable %s at time %s.\n"), msg, 3); return 0; } } } else { vals = omc_matlab4_read_vals(&simresglob.matReader, indexesToOutput[i]); nrows = simresglob.matReader.nrows; } if (1!=fwrite(vals, sizeof(double)*nrows, 1, fout)) { return failedToWriteToFile(outFile); } if (numberOfIntervals) { GC_free(vals); } } fclose(fout); return 1; } default: msg[0] = PlotFormatStr[simresglob.curFormat]; c_add_message(NULL,-1, ErrorType_scripting, ErrorLevel_error, gettext("filterSimulationResults not implemented for plot format: %s\n"), msg, 1); return 0; } }