Skip to content

Commit

Permalink
- Removed the special case for Real casts when dumping expressions, s…
Browse files Browse the repository at this point in the history
…ince

  Modelica does not have a Real() function.
- Some SCodeInst fixes.
- Fixed compiler warnings in corbaimpl.cpp.
- Updated testcases due to the expression dumping change.


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13432 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
perost committed Oct 17, 2012
1 parent 41fc6a0 commit ed6827b
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 36 deletions.
7 changes: 0 additions & 7 deletions Compiler/FrontEnd/ExpressionDump.mo
Original file line number Diff line number Diff line change
Expand Up @@ -723,13 +723,6 @@ algorithm
then
s;

case (DAE.CAST(ty = DAE.T_REAL(varLst = _),exp = e), _, _, _)
equation
s = printExp2Str(e, stringDelimiter, opcreffunc, opcallfunc);
s_2 = stringAppendList({"Real(",s,")"});
then
s_2;

case (DAE.CAST(ty = tp,exp = e), _, _, _)
equation
str = Types.unparseType(tp);
Expand Down
3 changes: 0 additions & 3 deletions Compiler/FrontEnd/InstUtil.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1096,9 +1096,6 @@ algorithm
Absyn.Info info1, info2;
String dir_str1, dir_str2, el_name;

// if they are the same, doesn't matter
case ((Absyn.INPUT(),_), (Absyn.INPUT(), _), _, _) then inOuterDirection;
case ((Absyn.OUTPUT(),_), (Absyn.OUTPUT(), _), _, _) then inOuterDirection;
// If either prefix is unset, return the other.
case (_, (Absyn.BIDIR(), _), _, _) then inOuterDirection;
case ((Absyn.BIDIR(), _), _, _, _) then inInnerDirection;
Expand Down
1 change: 0 additions & 1 deletion Compiler/FrontEnd/SCodeEnv.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1736,7 +1736,6 @@ algorithm
tree := addDummyClassToTree("time", tree);
tree := addDummyClassToTree("String", tree);
tree := addDummyClassToTree("Integer", tree);
tree := addDummyClassToTree("Real", tree);
tree := addDummyClassToTree("spliceFunction", tree);

outInitialEnv := {FRAME(NONE(), NORMAL_SCOPE(), tree, exts, imps, SOME(is_used))};
Expand Down
3 changes: 0 additions & 3 deletions Compiler/Template/ExpressionDumpTpl.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ match exp
case TUPLE(__) then
let tuple_str = dumpExpList(PR, stringDelimiter, ", ")
'(<%tuple_str%>)'
case CAST(ty = DAE.T_REAL(__)) then
let exp_str = dumpExp(exp, stringDelimiter)
'Real(<%exp_str%>)'
case CAST(__) then
let exp_str = dumpExp(exp, stringDelimiter)
let ty_str = dumpType(ty)
Expand Down
87 changes: 65 additions & 22 deletions Compiler/runtime/corbaimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,28 @@ void CorbaImpl__setSessionName(const char *name)
}
}

char** construct_dummy_args(int argc, const char* argv[])
{
char** args = new char*[argc];

for(int i = 0; i < argc; ++i) {
int len = strlen(argv[i]);
args[i] = new char[len];
args[i] = strdup(argv[i]);
}

return args;
}

void free_dummy_args(int argc, char** argv)
{
for(int i = 0; i < argc; ++i) {
delete [] argv[i];
}
delete [] argv;
}


// windows and mingw32
#if defined(__MINGW32__) || defined(_MSC_VER)

Expand Down Expand Up @@ -146,22 +168,25 @@ int CorbaImpl__initialize()
{
#ifndef NOMICO
#if defined(USE_OMNIORB)
int argc=6;
char *dummyArgv[] =
{ (char*)"omc",
(char*)"-NoResolve",
(char*)"-IIOPAddr",
(char*)"inet:127.0.0.1:0",
(char*)"-ORBgiopMaxMsgSize",
(char*)"2147483647" /*, "-ORBDebugLevel", "10", "-ORBIIOPBlocking" */ };
int argc = 6;
const char *args[] = {
"omc",
"-NoResolve",
"-IIOPAddr",
"inet:127.0.0.1:0",
"-ORBgiopMaxMsgSize",
"2147483647" /*, "-ORBDebugLevel", "10", "-ORBIIOPBlocking" */
};
#else
int argc=4;
char *dummyArgv[] =
{ (char*)"omc",
(char*)"-ORBNoResolve",
(char*)"-ORBIIOPAddr",
(char*)"inet:127.0.0.1:0" /*, "-ORBDebugLevel", "10", "-ORBIIOPBlocking" */ };
const char *args[] = {
"omc",
"ORBNoResolve",
"-ORBIIOPAddr",
"inet:127.0.0.1:0" /*, "-ORBDebugLevel", "10", "-ORBIIOPBlocking" */
}
#endif

string omc_client_request_event_name = "omc_client_request_event";
string omc_return_value_ready_name = "omc_return_value_ready";
DWORD lastError = 0;
Expand Down Expand Up @@ -193,11 +218,14 @@ Please stop or kill the other OMC process first!\nOpenModelica OMC will now exit
InitializeCriticalSection(&lock);
InitializeCriticalSection(&clientlock);

char **argv = construct_dummy_args(argc, dummyArgv);
#if defined(USE_OMNIORB)
orb = CORBA::ORB_init(argc, dummyArgv, "omniORB4");
orb = CORBA::ORB_init(argc, argv, "omniORB4");
#else
orb = CORBA::ORB_init(argc, dummyArgv, "mico-local-orb");
orb = CORBA::ORB_init(argc, argv, "mico-local-orb");
#endif
free_dummy_args(argc, argv);

poaobj = orb->resolve_initial_references("RootPOA");
poa = PortableServer::POA::_narrow(poaobj);
mgr = poa->the_POAManager();
Expand Down Expand Up @@ -313,11 +341,23 @@ int CorbaImpl__initialize()
{
#ifndef NOMICO
#if defined(USE_OMNIORB)
char *dummyArgv[] = { "omc", "-NoResolve", "-IIOPAddr", "inet:127.0.0.1:0", "-ORBgiopMaxMsgSize", "2147483647" /*, "-ORBDebugLevel", "10", "-ORBIIOPBlocking" */ };
int argc=6;
int argc = 6;
const char *dummyArgv[] = {
"omc",
"-NoResolve",
"-IIOPAddr",
"inet:127.0.0.1:0",
"-ORBgiopMaxMsgSize",
"2147483647" /*, "-ORBDebugLevel", "10", "-ORBIIOPBlocking" */
};
#else
char *dummyArgv[] = { "omc", "-ORBNoResolve", "-ORBIIOPAddr", "inet:127.0.0.1:0" /*, "-ORBDebugLevel", "10", "-ORBIIOPBlocking" */ };
int argc=4;
const char *dummyArgv[] = {
"omc",
"ORBNoResolve",
"-ORBIIOPAddr",
"inet:127.0.0.1:0" /*, "-ORBDebugLevel", "10", "-ORBIIOPBlocking" */
}
#endif

pthread_cond_init(&omc_waitformsg,NULL);
Expand All @@ -326,20 +366,23 @@ int CorbaImpl__initialize()
pthread_mutex_init(&omc_waitlock,NULL);
pthread_mutex_init(&clientlock, NULL);

char **argv = construct_dummy_args(argc, dummyArgv);
#if defined(USE_OMNIORB)
orb = CORBA::ORB_init(argc, dummyArgv, "omniORB4");
orb = CORBA::ORB_init(argc, argv, "omniORB4");
#else
orb = CORBA::ORB_init(argc, dummyArgv, "mico-local-orb");
orb = CORBA::ORB_init(argc, argv, "mico-local-orb");
#endif
free_dummy_args(argc, argv);
poaobj = orb->resolve_initial_references("RootPOA");
poa = PortableServer::POA::_narrow(poaobj);
mgr = poa->the_POAManager();

/* get temp dir */
const char* tmpDir = SettingsImpl__getTempDirectoryPath();
/* get the user name */
char *user = getenv("USER");
if (user==NULL) { user="nobody"; }
char *tmp_user = getenv("USER");
string user = tmp_user ? tmp_user : "nobody";

/* start omc differently if we have a corba session name */
if (corbaSessionName != NULL) /* yehaa, we have a session name */
{
Expand Down

0 comments on commit ed6827b

Please sign in to comment.