Skip to content

Commit

Permalink
- Fixed some pointer cast warnings.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13246 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Oct 8, 2012
1 parent 167bf76 commit 3cbdda3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 322 deletions.
84 changes: 0 additions & 84 deletions Compiler/Util/FMIExt.mo
Original file line number Diff line number Diff line change
Expand Up @@ -57,88 +57,4 @@ public function releaseFMIImport
external "C" FMIImpl__releaseFMIImport(inFMIModelVariablesInstance, inFMIInstance, inFMIContext) annotation(Library = {"omcruntime","fmilib"});
end releaseFMIImport;

public function getFMIModelVariableVariability
input Integer inFMIModelVariable;
output String outFMIModelVariableVariability;
external "C" outFMIModelVariableVariability=FMIImpl__getFMIModelVariableVariability(inFMIModelVariable) annotation(Library = {"omcruntime","fmilib"});
end getFMIModelVariableVariability;

public function getFMIModelVariableCausality
input Integer inFMIModelVariable;
output String outFMIModelVariableCausality;
external "C" outFMIModelVariableCausality=FMIImpl__getFMIModelVariableCausality(inFMIModelVariable) annotation(Library = {"omcruntime","fmilib"});
end getFMIModelVariableCausality;

public function getFMIModelVariableBaseType
input Integer inFMIModelVariable;
output String outFMIModelVariableBaseType;
external "C" outFMIModelVariableBaseType=FMIImpl__getFMIModelVariableBaseType(inFMIModelVariable) annotation(Library = {"omcruntime","fmilib"});
end getFMIModelVariableBaseType;

public function getFMIModelVariableName
input Integer inFMIModelVariable;
output String outFMIModelVariableName;
external "C" outFMIModelVariableName=FMIImpl__getFMIModelVariableName(inFMIModelVariable) annotation(Library = {"omcruntime","fmilib"});
end getFMIModelVariableName;

public function getFMIModelVariableDescription
input Integer inFMIModelVariable;
output String outFMIModelVariableDescription;
external "C" outFMIModelVariableDescription=FMIImpl__getFMIModelVariableDescription(inFMIModelVariable) annotation(Library = {"omcruntime","fmilib"});
end getFMIModelVariableDescription;

public function getFMINumberOfContinuousStates
input Integer inFMIInstance;
output Integer outFMINumberOfContinuousStates;
external "C" outFMINumberOfContinuousStates=FMIImpl__getFMINumberOfContinuousStates(inFMIInstance) annotation(Library = {"omcruntime","fmilib"});
end getFMINumberOfContinuousStates;

public function getFMINumberOfEventIndicators
input Integer inFMIInstance;
output Integer outFMINumberOfEventIndicators;
external "C" outFMINumberOfEventIndicators=FMIImpl__getFMINumberOfEventIndicators(inFMIInstance) annotation(Library = {"omcruntime","fmilib"});
end getFMINumberOfEventIndicators;

public function getFMIModelVariableHasStart
input Integer inFMIModelVariable;
output Boolean outFMIModelVariableHasStart;
external "C" outFMIModelVariableHasStart=FMIImpl__getFMIModelVariableHasStart(inFMIModelVariable) annotation(Library = {"omcruntime","fmilib"});
end getFMIModelVariableHasStart;

public function getFMIModelVariableIsFixed
input Integer inFMIModelVariable;
output Boolean outFMIModelVariableHasFixed;
external "C" outFMIModelVariableHasFixed=FMIImpl__getFMIModelVariableIsFixed(inFMIModelVariable) annotation(Library = {"omcruntime","fmilib"});
end getFMIModelVariableIsFixed;

public function getFMIRealVariableStartValue
input Integer inFMIModelVariable;
output Real outFMIRealVariableStartValue;
external "C" outFMIRealVariableStartValue=FMIImpl__getFMIRealVariableStartValue(inFMIModelVariable) annotation(Library = {"omcruntime","fmilib"});
end getFMIRealVariableStartValue;

public function getFMIIntegerVariableStartValue
input Integer inFMIModelVariable;
output Integer outFMIIntegerVariableStartValue;
external "C" outFMIIntegerVariableStartValue=FMIImpl__getFMIIntegerVariableStartValue(inFMIModelVariable) annotation(Library = {"omcruntime","fmilib"});
end getFMIIntegerVariableStartValue;

public function getFMIBooleanVariableStartValue
input Integer inFMIModelVariable;
output Boolean outFMIBooleanVariableStartValue;
external "C" outFMIBooleanVariableStartValue=FMIImpl__getFMIBooleanVariableStartValue(inFMIModelVariable) annotation(Library = {"omcruntime","fmilib"});
end getFMIBooleanVariableStartValue;

public function getFMIStringVariableStartValue
input Integer inFMIModelVariable;
output String outFMIStringVariableStartValue;
external "C" outFMIStringVariableStartValue=FMIImpl__getFMIStringVariableStartValue(inFMIModelVariable) annotation(Library = {"omcruntime","fmilib"});
end getFMIStringVariableStartValue;

public function getFMIEnumerationVariableStartValue
input Integer inFMIModelVariable;
output Integer outFMIEnumerationVariableStartValue;
external "C" outFMIEnumerationVariableStartValue=FMIImpl__getFMIEnumerationVariableStartValue(inFMIModelVariable) annotation(Library = {"omcruntime","fmilib"});
end getFMIEnumerationVariableStartValue;

end FMIExt;
137 changes: 3 additions & 134 deletions Compiler/runtime/FMIImpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ extern "C" {
#endif

#include <stdio.h>
#include <stdint.h>

#include "systemimpl.h"
#include "errorext.h"
Expand Down Expand Up @@ -316,7 +317,7 @@ int FMIImpl__initializeFMIImport(const char* file_name, const char* working_dire
realCount = integerCount = booleanCount = stringCount = enumerationCount = 0;
for (i ; i < model_variables_list_size ; i++) {
fmi1_import_variable_t* model_variable = fmi1_import_get_variable(model_variables_list, i);
void* variable_instance = mk_icon((int)model_variable);
void* variable_instance = mk_icon((intptr_t)model_variable);
void* variable_name = mk_scon(getModelVariableName(model_variable));
const char* description = fmi1_import_get_variable_description(model_variable);
void* variable_description = description ? mk_scon(description) : mk_scon("");
Expand Down Expand Up @@ -362,7 +363,7 @@ int FMIImpl__initializeFMIImport(const char* file_name, const char* working_dire
* Releases all the instances of FMI Import.
* From FMIL docs; Free a variable list. Note that variable lists are allocated dynamically and must be freed when not needed any longer.
*/
void FMIImpl__releaseFMIImport(int fmiModeVariablesInstance, int fmiInstance, int fmiContext)
void FMIImpl__releaseFMIImport(intptr_t fmiModeVariablesInstance, intptr_t fmiInstance, intptr_t fmiContext)
{
free((fmi1_import_variable_list_t*)fmiModeVariablesInstance);
fmi1_import_t* fmi = (fmi1_import_t*)fmiInstance;
Expand All @@ -371,138 +372,6 @@ void FMIImpl__releaseFMIImport(int fmiModeVariablesInstance, int fmiInstance, in
fmi_import_free_context((fmi_import_context_t*)fmiContext);
}

/*
* Reads the model variable variability.
*/
const char* FMIImpl__getFMIModelVariableVariability(int fmiModelVariable)
{
return getModelVariableVariability((fmi1_import_variable_t*)fmiModelVariable);
}

/*
* Reads the model variable causality.
*/
const char* FMIImpl__getFMIModelVariableCausality(int fmiModelVariable)
{
return getModelVariableCausality((fmi1_import_variable_t*)fmiModelVariable);
}

/*
* Reads the model variable type.
*/
const char* FMIImpl__getFMIModelVariableBaseType(int fmiModelVariable)
{
return getModelVariableBaseType((fmi1_import_variable_t*)fmiModelVariable);
}

/*
* Reads the model variable name.
*/
char* FMIImpl__getFMIModelVariableName(int fmiModelVariable)
{
return getModelVariableName((fmi1_import_variable_t*)fmiModelVariable);
}

/*
* Reads the model variable description.
*/
const char* FMIImpl__getFMIModelVariableDescription(int fmiModelVariable)
{
return fmi1_import_get_variable_description((fmi1_import_variable_t*)fmiModelVariable);
}

/*
* Reads the model number of continuous states.
*/
int FMIImpl__getFMINumberOfContinuousStates(int fmiInstance)
{
return fmi1_import_get_number_of_continuous_states((fmi1_import_t*)fmiInstance);
}

/*
* Reads the model number of event indicators.
*/
int FMIImpl__getFMINumberOfEventIndicators(int fmiInstance)
{
return fmi1_import_get_number_of_event_indicators((fmi1_import_t*)fmiInstance);
}

/*
* Checks if the model variable has start.
*/
int FMIImpl__getFMIModelVariableHasStart(int fmiModelVariable)
{
return fmi1_import_get_variable_has_start((fmi1_import_variable_t*)fmiModelVariable);
}

/*
* Check the model variable fixed attribute value.
*/
int FMIImpl__getFMIModelVariableIsFixed(int fmiModelVariable)
{
return fmi1_import_get_variable_is_fixed((fmi1_import_variable_t*)fmiModelVariable);
}

/*
* Reads the start value of the Real model variable.
*/
double FMIImpl__getFMIRealVariableStartValue(int fmiModelVariable)
{
fmi1_import_real_variable_t* fmiRealModelVariable = fmi1_import_get_variable_as_real((fmi1_import_variable_t*)fmiModelVariable);
if (fmiRealModelVariable)
return fmi1_import_get_real_variable_start(fmiRealModelVariable);
else
return 0;
}

/*
* Reads the start value of the Integer model variable.
*/
int FMIImpl__getFMIIntegerVariableStartValue(int fmiModelVariable)
{
fmi1_import_integer_variable_t* fmiIntegerModelVariable = fmi1_import_get_variable_as_integer((fmi1_import_variable_t*)fmiModelVariable);
if (fmiIntegerModelVariable)
return fmi1_import_get_integer_variable_start(fmiIntegerModelVariable);
else
return 0;
}

/*
* Reads the start value of the Boolean model variable.
*/
int FMIImpl__getFMIBooleanVariableStartValue(int fmiModelVariable)
{
fmi1_import_bool_variable_t* fmiBooleanModelVariable = fmi1_import_get_variable_as_boolean((fmi1_import_variable_t*)fmiModelVariable);
if (fmiBooleanModelVariable)
return fmi1_import_get_boolean_variable_start(fmiBooleanModelVariable);
else
return 0;
}

/*
* Reads the start value of the String model variable.
*/
const char* FMIImpl__getFMIStringVariableStartValue(int fmiModelVariable)
{
fmi1_import_string_variable_t* fmiStringModelVariable = fmi1_import_get_variable_as_string((fmi1_import_variable_t*)fmiModelVariable);
if (fmiStringModelVariable)
return fmi1_import_get_string_variable_start(fmiStringModelVariable);
else
return "";
}

/*
* Reads the start value of the Enumeration model variable.
*/
int FMIImpl__getFMIEnumerationVariableStartValue(int fmiModelVariable)
{
fmi1_import_enum_variable_t * fmiEnumerationModelVariable = fmi1_import_get_variable_as_enum((fmi1_import_variable_t*)fmiModelVariable);
if (fmiEnumerationModelVariable)
return fmi1_import_get_enum_variable_start(fmiEnumerationModelVariable);
else
return 0;
}

#ifdef __cplusplus
}
#endif
104 changes: 0 additions & 104 deletions Compiler/runtime/FMI_rml.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,107 +65,3 @@ RML_BEGIN_LABEL(FMIExt__releaseFMIImport)
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL

RML_BEGIN_LABEL(FMI__getFMIModelVariableVariability)
{
const char* res = FMIImpl__getFMIModelVariableVariability(RML_UNTAGFIXNUM(rmlA0));
rmlA0 = (void*) mk_scon(res);
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL

RML_BEGIN_LABEL(FMI__getFMIModelVariableCausality)
{
const char* res = FMIImpl__getFMIModelVariableCausality(RML_UNTAGFIXNUM(rmlA0));
rmlA0 = (void*) mk_scon(res);
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL

RML_BEGIN_LABEL(FMI__getFMIModelVariableBaseType)
{
const char* res = FMIImpl__getFMIModelVariableBaseType(RML_UNTAGFIXNUM(rmlA0));
rmlA0 = (void*) mk_scon(res);
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL

RML_BEGIN_LABEL(FMI__getFMIModelVariableName)
{
char* res = FMIImpl__getFMIModelVariableName(RML_UNTAGFIXNUM(rmlA0));
rmlA0 = (void*) mk_scon(res);
free(res);
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL

RML_BEGIN_LABEL(FMI__getFMIModelVariableDescription)
{
const char* res = FMIImpl__getFMIModelVariableDescription(RML_UNTAGFIXNUM(rmlA0));
rmlA0 = (void*) mk_scon(res);
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL

RML_BEGIN_LABEL(FMI__getFMINumberOfContinuousStates)
{
rmlA0 = (void*) mk_icon(FMIImpl__getFMINumberOfContinuousStates(RML_UNTAGFIXNUM(rmlA0)));
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL

RML_BEGIN_LABEL(FMI__getFMINumberOfEventIndicators)
{
rmlA0 = (void*) mk_icon(FMIImpl__getFMINumberOfEventIndicators(RML_UNTAGFIXNUM(rmlA0)));
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL

RML_BEGIN_LABEL(FMI__getFMIModelVariableHasStart)
{
rmlA0 = FMIImpl__getFMIModelVariableHasStart(RML_UNTAGFIXNUM(rmlA0)) ? RML_TRUE : RML_FALSE;
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL

RML_BEGIN_LABEL(FMI__getFMIModelVariableIsFixed)
{
rmlA0 = FMIImpl__getFMIModelVariableIsFixed(RML_UNTAGFIXNUM(rmlA0)) ? RML_TRUE : RML_FALSE;
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL

RML_BEGIN_LABEL(FMI__getFMIRealVariableStartValue)
{
rmlA0 = (void*) mk_rcon(FMIImpl__getFMIRealVariableStartValue(RML_UNTAGFIXNUM(rmlA0)));
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL

RML_BEGIN_LABEL(FMI__getFMIIntegerVariableStartValue)
{
rmlA0 = (void*) mk_icon(FMIImpl__getFMIIntegerVariableStartValue(RML_UNTAGFIXNUM(rmlA0)));
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL

RML_BEGIN_LABEL(FMI__getFMIBooleanVariableStartValue)
{
rmlA0 = FMIImpl__getFMIBooleanVariableStartValue(RML_UNTAGFIXNUM(rmlA0)) ? RML_TRUE : RML_FALSE;
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL

RML_BEGIN_LABEL(FMI__getFMIStringVariableStartValue)
{
rmlA0 = (void*) mk_scon(FMIImpl__getFMIStringVariableStartValue(RML_UNTAGFIXNUM(rmlA0)));
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL

RML_BEGIN_LABEL(FMI__getFMIEnumerationVariableStartValue)
{
rmlA0 = (void*) mk_icon(FMIImpl__getFMIEnumerationVariableStartValue(RML_UNTAGFIXNUM(rmlA0)));
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL

0 comments on commit 3cbdda3

Please sign in to comment.