1 // Copyright (C) 2006-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "RuntimeSALOME.hxx"
22 #include "Exception.hxx"
23 #include "Executor.hxx"
24 #include "parsers.hxx"
30 using YACS::YACSLoader;
31 using YACS::ENGINE::RuntimeSALOME;
32 using YACS::ENGINE::Executor;
33 using YACS::ENGINE::Proc;
34 using YACS::BASES::Thread;
38 #include "YacsTrace.hxx"
40 void *executorFunc(void *arg)
42 void **argT=(void **)arg;
43 Executor *myExec = (Executor *)argT[0];
44 Proc *myProc = (Proc *)argT[1];
45 myExec->RunB(myProc, 2);
50 main (int argc, char* argv[])
54 cerr << "usage: " << argv[0] << " schema.xml" << endl;
58 RuntimeSALOME::setRuntime();
61 Executor *executor = new Executor();
65 Proc* p=loader.load(argv[1]);
66 std::ofstream f("toto");
70 executor->setExecMode(YACS::STEPBYSTEP);
71 void **args=new void *[2];
72 args[0]=(void *)executor;
74 Thread* execThread = new Thread(executorFunc,args);
76 cerr << "enter a char to start" << endl;
79 while (executor->isNotFinished())
81 YACS::ExecutorState executorState = executor->getExecutorState();
82 cerr << "executorState: " << executorState << endl;
83 cerr << "command display=d step=s : ";
89 executor->setExecMode(YACS::STEPBYSTEP);
90 bool res = executor->resumeCurrentBreakPoint();
91 cerr << "resumeCurrentBreakPoint(): " << res << endl;
96 executor->displayDot(p);
101 cerr << "commande inconnue" << endl;
106 std::ofstream g("titi");
112 catch (YACS::Exception& e)
114 DEBTRACE("exception YACS levee " << e.what());
117 catch (const std::ios_base::failure&)
119 DEBTRACE("io failure");
122 catch(CORBA::SystemException& ex)
127 CORBA::TypeCode_var tc = tmp.type();
128 const char *p = tc->name();
131 DEBTRACE("Caught a CORBA::SystemException. " <<p);
135 DEBTRACE("Caught a CORBA::SystemException. " << tc->id());
139 catch(omniORB::fatalException& fe)
141 DEBTRACE("Caught omniORB::fatalException: file: "<<fe.file()<<" line: "<<fe.line()<<" msg: "<<fe.errmsg());
146 DEBTRACE("Caught unknown exception.");