Skip to content

Commit

Permalink
- Added missing file Compiler/runtime/SimulationResults.c.
Browse files Browse the repository at this point in the history
- Fixed dynload.c from the Values.mo update (forgot to make clean).


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@4522 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Nov 16, 2009
1 parent 2392e33 commit 6631e64
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 3 deletions.
101 changes: 101 additions & 0 deletions Compiler/runtime/SimulationResults.c
@@ -0,0 +1,101 @@
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-2008, Linköpings University,
* Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
*
* All rights reserved.
*
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF THIS OSMC PUBLIC
* LICENSE (OSMC-PL). ANY USE, REPRODUCTION OR DISTRIBUTION OF
* THIS PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THE OSMC
* PUBLIC LICENSE.
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from Linköpings University, either from the above address,
* from the URL: http://www.ida.liu.se/projects/OpenModelica
* and in the OpenModelica distribution.
*
* This program is distributed WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS
* OF OSMC-PL.
*
* See the full OSMC Public License conditions for more details.
*
*/

#include <stdlib.h>
#include "rml.h"
#include "Values.h"
#include "ValuesUtil.h"

void* read_ptolemy_dataset(char*filename, int size,char**vars,int);
void* read_ptolemy_variables(char* filename, char* visvars);
int read_ptolemy_dataset_size(char*filename);

void SimulationResults_5finit(void)
{
}

RML_BEGIN_LABEL(SimulationResults__readPtolemyplotVariables)
{
rml_sint_t i,size;
char* filename = RML_STRINGDATA(rmlA0);
char* visvars = RML_STRINGDATA(rmlA1);
void* p;

rmlA0 = (void*)read_ptolemy_variables(filename, visvars);
if (rmlA0 == NULL) {
RML_TAILCALLK(rmlFC);
}
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL

RML_BEGIN_LABEL(SimulationResults__readPtolemyplotDataset)
{
rml_sint_t i,size;
char **vars;
char* filename = RML_STRINGDATA(rmlA0);
void *lst = rmlA1;
rml_sint_t datasize = RML_UNTAGFIXNUM(rmlA2);
void* p;
rmlA0 = lst;
rml_prim_once(RML__list_5flength);
size = RML_UNTAGFIXNUM(rmlA0);

vars = (char**)malloc(sizeof(char*)*size);
for (i=0,p=lst;i<size;i++) {
vars[i]=RML_STRINGDATA(RML_CAR(p));
p=RML_CDR(p);
}
rmlA0 = (void*)read_ptolemy_dataset(filename,size,vars,datasize);
if (rmlA0 == NULL) {
RML_TAILCALLK(rmlFC);
}

rml_prim_once(ValuesUtil__reverseMatrix);

RML_TAILCALLK(rmlSC);
}
RML_END_LABEL

RML_BEGIN_LABEL(SimulationResults__readPtolemyplotDatasetSize)
{
int size;
char* filename = RML_STRINGDATA(rmlA0);
void* p;

size=read_ptolemy_dataset_size(filename);

rmlA0 = (void*)Values__INTEGER(mk_icon(size));
if (rmlA0 == NULL) {
RML_TAILCALLK(rmlFC);
}
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL
6 changes: 3 additions & 3 deletions Compiler/runtime/dynload.c
Expand Up @@ -419,7 +419,7 @@ void *value_to_mmc(void* value)
}
return mmc_mk_box_arr(len, 0, data_mmc);
};
case Values__ENUM_3dBOX2:
case Values__ENUM_3dBOX3:
case Values__CODE_3dBOX1:
/* unsupported */
fprintf(stderr, "%s:%d: enum,code unsupported in MetaModelica data\n", __FILE__, __LINE__);
Expand Down Expand Up @@ -516,7 +516,7 @@ static int value_to_type_desc(void *value, type_description *desc)
desc->data.mmc = value_to_mmc(value);
break;
/* unsupported */
case Values__ENUM_3dBOX2:
case Values__ENUM_3dBOX3:
c_add_message(-1, "RUNTIME", "ERROR", "systemimpl.c:value_to_type_desc failed: Values.ENUM\n", NULL, 0);
return -1;
case Values__CODE_3dBOX1:
Expand Down Expand Up @@ -639,7 +639,7 @@ static int get_array_type_and_dims(type_description *desc, void *arrdata)
return 1;
case Values__ARRAY_3dBOX1:
return (1 + get_array_type_and_dims(desc, RML_STRUCTDATA(item)[0]));
case Values__ENUM_3dBOX2:
case Values__ENUM_3dBOX3:
case Values__LIST_3dBOX1:
case Values__TUPLE_3dBOX1:
case Values__RECORD_3dBOX4:
Expand Down

0 comments on commit 6631e64

Please sign in to comment.