--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2024 CEA, EDF
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+# python3 /home/H87074/salome/990_CEA/SALOME-master-native-DB11-SRC/SOURCES/yacs/src/yacsloader/driver.py micro_schema.xml
+
+import loader
+import SALOMERuntime
+import salome
+
+my_runtime_yacs = None
+
+def initializeSALOME():
+ import SALOMERuntime
+ global my_runtime_yacs
+ if my_runtime_yacs:
+ return
+ salome.salome_init()
+ SALOMERuntime.RuntimeSALOME.setRuntime()
+ my_runtime_yacs = SALOMERuntime.getSALOMERuntime()
+
+def SALOMEInitializationNeeded(func):
+ def decaratedFunc(*args,**kwargs):
+ initializeSALOME()
+ return func(*args,**kwargs)
+ return decaratedFunc
+
+@SALOMEInitializationNeeded
+def loadGraph( xmlFileName ):
+ """
+ Args:
+ -----
+ xmlFileName : XML file containing YACS schema
+
+ Returns
+ -------
+
+ SALOMERuntime.SalomeProc : YACS graph instance
+ """
+ l=loader.YACSLoader()
+ p=l.load( xmlFileName )
+ print(type(p))
+ return p
+
+@SALOMEInitializationNeeded
+def executeGraph( proc ):
+ """
+ Args:
+ -----
+
+ proc ( SALOMERuntime.SalomeProc ) : YACS Proc instance to be evaluated
+
+ """
+ import pilot
+ ex=pilot.ExecutorSwig()
+ ex.RunW(proc,0)
+ pass
+
+def destroyElementsGeneratedByExecutionOfGraph():
+ salome.cm
+ my_runtime_yacs.fini( False )
+
+if __name__ == "__main__":
+ import argparse
+ parser = argparse.ArgumentParser()
+ parser.add_argument('xmlfilename',help="XML file containing YACS schema to be executed")
+ args = parser.parse_args()
+ proc = loadGraph( args.xmlfilename )
+ executeGraph( proc )
+ destroyElementsGeneratedByExecutionOfGraph()
+