Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1385 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
- Loading branch information
x02lucpo
committed
Jan 11, 2005
1 parent
e7ed95d
commit 6790ffe
Showing
5 changed files
with
178 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#include <iostream> | ||
#include <fstream> | ||
#include <map> | ||
#include <set> | ||
#include <string> | ||
#include <vector> | ||
|
||
|
||
using namespace std; | ||
|
||
|
||
extern "C" | ||
{ | ||
#include <assert.h> | ||
#include "rml.h" | ||
#include "../absyn_builder/yacclib.h" | ||
|
||
map<string,int> alg_state_var_Number; | ||
|
||
|
||
void TORNADOEXT_5finit(void) | ||
{ | ||
} | ||
|
||
|
||
RML_BEGIN_LABEL(TORNADOEXT__dump_5ftesting) | ||
{ | ||
int nvars = RML_UNTAGFIXNUM(rmlA0); | ||
cout << "testing tornadoext" << endl | ||
<< "================" << nvars << endl; | ||
|
||
RML_TAILCALLK(rmlSC); | ||
} | ||
RML_END_LABEL | ||
|
||
RML_BEGIN_LABEL(TORNADOEXT__get_5fstate_5falg_5fnumber) | ||
{ | ||
int nvars = RML_UNTAGFIXNUM(rmlA0); | ||
char* str = RML_STRINGDATA(rmlA0); | ||
string str_key = string(str); | ||
|
||
map<string, int>::const_iterator search; | ||
search = alg_state_var_Number.find(str_key); | ||
int ret_val = 0; | ||
if(search != alg_state_var_Number.end()){ | ||
ret_val = static_cast<int>(search->second); | ||
ret_val += 1; | ||
// cout << "\nSTATE_ALG:" << str_key << " " << ret_val << nvars << endl; | ||
|
||
} // else { | ||
// cout << "\nNO STATE_ALG:" << str_key << " " << ret_val << nvars << endl; | ||
// } | ||
|
||
alg_state_var_Number[str_key] = ret_val; | ||
rmlA0 = (void*) mk_icon(ret_val); | ||
RML_TAILCALLK(rmlSC); | ||
} | ||
RML_END_LABEL | ||
|
||
|
||
|
||
} // extern "C" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
(* | ||
Copyright PELAB, Linkoping University | ||
|
||
This file is part of Open Source Modelica (OSM). | ||
|
||
OSM is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
|
||
OSM is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with OpenModelica; if not, write to the Free Software | ||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
|
||
*) | ||
|
||
(** | ||
** file: tornadoext.rml | ||
** module: TORNADOEXT | ||
**) | ||
|
||
(** | ||
** The TORNADOEXT module is an externally implemented module (in file runtime/tornadoext.cpp) | ||
** used for the BLT and index reduction algorithms in 'DAELow'. The implementation | ||
** mainly consists of several bitvectors implemented using std::vector<bool> since | ||
** such functionality is not available in RML. | ||
*) | ||
|
||
module TORNADOEXT: | ||
|
||
|
||
relation dump_testing: (int) => () | ||
relation get_state_alg_number: (string) => int | ||
|
||
|
||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#include <iostream> | ||
#include <fstream> | ||
#include <map> | ||
#include <set> | ||
#include <string> | ||
#include <vector> | ||
|
||
|
||
using namespace std; | ||
|
||
|
||
extern "C" | ||
{ | ||
#include <assert.h> | ||
#include "rml.h" | ||
#include "../absyn_builder/yacclib.h" | ||
|
||
map<string,int> alg_state_var_Number; | ||
|
||
|
||
void TORNADOEXT_5finit(void) | ||
{ | ||
} | ||
|
||
|
||
RML_BEGIN_LABEL(TORNADOEXT__dump_5ftesting) | ||
{ | ||
int nvars = RML_UNTAGFIXNUM(rmlA0); | ||
cout << "testing tornadoext" << endl | ||
<< "================" << nvars << endl; | ||
|
||
RML_TAILCALLK(rmlSC); | ||
} | ||
RML_END_LABEL | ||
|
||
RML_BEGIN_LABEL(TORNADOEXT__get_5fstate_5falg_5fnumber) | ||
{ | ||
int nvars = RML_UNTAGFIXNUM(rmlA0); | ||
char* str = RML_STRINGDATA(rmlA0); | ||
string str_key = string(str); | ||
|
||
map<string, int>::const_iterator search; | ||
search = alg_state_var_Number.find(str_key); | ||
int ret_val = 0; | ||
if(search != alg_state_var_Number.end()){ | ||
ret_val = static_cast<int>(search->second); | ||
ret_val += 1; | ||
// cout << "\nSTATE_ALG:" << str_key << " " << ret_val << nvars << endl; | ||
|
||
} // else { | ||
// cout << "\nNO STATE_ALG:" << str_key << " " << ret_val << nvars << endl; | ||
// } | ||
|
||
alg_state_var_Number[str_key] = ret_val; | ||
rmlA0 = (void*) mk_icon(ret_val); | ||
RML_TAILCALLK(rmlSC); | ||
} | ||
RML_END_LABEL | ||
|
||
|
||
|
||
} // extern "C" |