1 // Copyright (C) 2017-2024 CEA, EDF
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
23 #include "py2yacs.hxx"
24 #include "RuntimeSALOME.hxx"
29 #include "CORBAPorts.hxx"
30 #include "InputPort.hxx"
31 #include "Executor.hxx"
34 int main(int argc, char *argv[])
38 std::cerr << "Usage: " << argv[0] << " pythonfile funcname outfile" << std::endl;
41 YACS::ENGINE::RuntimeSALOME::setRuntime();
44 std::ifstream file_stream(argv[1]);
47 std::cerr << "Error when opening file " << argv[1]
48 << ": " << strerror(errno)
52 std::stringstream buffer;
53 buffer << file_stream.rdbuf();
56 parser.load(buffer.str());
57 parser.save(argv[3], argv[2]);
60 YACS::ENGINE::Proc* p = parser.createProc(argv[2]);
61 //p->setInPortValue("Schema.default_name", "a", "42.");
62 YACS::ENGINE::Node* n = p->getChildByShortName("default_name");
63 //YACS::ENGINE::Node* n = p->nodeMap["default_name"];
65 std::cerr << "Node not found." << std::endl;
67 n->getInputPort("a")->edInit(42.);
68 p->saveSchema(argv[3]);
70 YACS::ENGINE::Executor executor;
72 n->getOutputPort("x")->dump();
75 catch(Py2yacsException& e)
77 std::cerr << e.what() << std::endl;
79 YACS::ENGINE::getRuntime()->fini();