1 // Copyright (C) 2006-2008 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.
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
19 #include "RuntimeSALOME.hxx"
21 #include "Exception.hxx"
22 #include "Executor.hxx"
23 #include "parsers.hxx"
29 using YACS::YACSLoader;
30 using YACS::ENGINE::RuntimeSALOME;
31 using YACS::ENGINE::Executor;
32 using YACS::ENGINE::Proc;
33 using YACS::BASES::Thread;
37 #include "YacsTrace.hxx"
39 void *executorFunc(void *arg)
41 void **argT=(void **)arg;
42 Executor *myExec = (Executor *)argT[0];
43 Proc *myProc = (Proc *)argT[1];
44 myExec->RunB(myProc, 2);
48 main (int argc, char* argv[])
52 cerr << "usage: " << argv[0] << " schema.xml" << endl;
56 RuntimeSALOME::setRuntime();
59 Executor *executor = new Executor();
63 Proc* p=loader.load(argv[1]);
64 std::ofstream f("toto");
68 executor->setExecMode(YACS::STEPBYSTEP);
69 void **args=new void *[2];
70 args[0]=(void *)executor;
72 Thread* execThread = new Thread(executorFunc,args);
74 cerr << "enter a char to start" << endl;
77 while (executor->isNotFinished())
79 YACS::ExecutorState executorState = executor->getExecutorState();
80 cerr << "executorState: " << executorState << endl;
81 cerr << "command display=d step=s : ";
87 executor->setExecMode(YACS::STEPBYSTEP);
88 bool res = executor->resumeCurrentBreakPoint();
89 cerr << "resumeCurrentBreakPoint(): " << res << endl;
94 executor->displayDot(p);
99 cerr << "commande inconnue" << endl;
104 std::ofstream g("titi");
110 catch (YACS::Exception& e)
112 DEBTRACE("exception YACS levee " << e.what());
115 catch (const std::ios_base::failure&)
117 DEBTRACE("io failure");
120 catch(CORBA::SystemException& ex)
125 CORBA::TypeCode_var tc = tmp.type();
126 const char *p = tc->name();
129 DEBTRACE("Caught a CORBA::SystemException. " <<p);
133 DEBTRACE("Caught a CORBA::SystemException. " << tc->id());
137 catch(omniORB::fatalException& fe)
139 DEBTRACE("Caught omniORB::fatalException: file: "<<fe.file()<<" line: "<<fe.line()<<" msg: "<<fe.errmsg());
144 DEBTRACE("Caught unknown exception.");