MicroModelicaCCompiler
4.5.3
|
Go to the documentation of this file.
31 : _function(function), _flags(flags), _writer(writer), _prefix(
"__"), _include(), _return_variable(), _symbols(), _void_function(false)
57 for (
string i = imports.
begin(it); !imports.
end(it); i = imports.
next(it)) {
81 bool array_single_output =
false;
82 for (Variable var : arguments) {
85 input <<
"const char *" << var.name() <<
",";
87 input <<
"double " << (var.isArray() ?
"*" :
"") << var.name() <<
",";
89 }
else if (var.isOutput()) {
90 output <<
"double *" << var.name() <<
",";
92 array_single_output = var.isArray();
95 string in = input.str();
96 if (outputs <= 1 && !in.empty()) {
97 in.erase(in.end() - 1, in.end());
99 if (outputs == 0 || (outputs == 1 && array_single_output) || outputs > 1) {
103 func <<
"void " <<
_prefix << name <<
"(" << in <<
")";
104 }
else if (outputs == 1 && !array_single_output) {
105 func <<
"double " <<
_prefix << name <<
"(" << in <<
")";
107 string out = output.str();
108 out.erase(out.end() - 1, out.end());
109 func <<
"void " <<
_prefix << name <<
"(" << input.str() << out <<
")";
124 for (Statement stm = stms.begin(it); !stms.end(it); stm = stms.next(it)) {
125 buffer << stm << endl;
130 for (ExternalFunction ef = eft.begin(eit); !eft.end(eit); ef = eft.next(eit)) {
147 bool local_symbols =
false;
149 if (var.isConstant()) {
155 if (!var.isInput()) {
156 local_symbols =
true;
Util::ImportTable imports() const
std::string _return_variable
VarSymbolTable & symbols()
StatementTable statements() const
void addInclude(std::string include)
void setFunctionCode(bool function_code)
std::string packageName(std::string name)
void setSymbols(const VarSymbolTable &symbols)
Util::VarSymbolTable symbols() const
Util::SymbolTable _include
ModelTable< std::string, std::string > SymbolTable
Util::VariableList arguments() const
void setFunctionOutputs(bool function_outputs)
FunctionAnnotation annotations() const
ModelTable< int, ExternalFunction > ExternalFunctionTable
void setPrefix(std::string prefix)
std::map< std::string, std::string >::iterator iterator
static ModelConfig & instance()
Util::VarSymbolTable _symbols
unsigned int outputNbr() const
ModelTable< int, Statement > StatementTable
static Utils & instance()
void insert(Key k, Value v)
std::list< Variable > VariableList
ExternalFunctionTable externalFunctions() const
std::shared_ptr< Writer > WriterPtr
void merge(ModelTable< Key, Value > other)