+ texte=loadJDC(fichier)
+ parameters=getJdcParameters(texte,macro)
+ return parameters
+
+def getJdcParameters(jdc,macro):
+ """
+ This function converts the data from the specified macro of the
+ specified jdc text to a python dictionnary whose keys are the
+ names of the data of the macro.
+ """
+ context = {}
+ source = "def args_to_dict(**kwargs): return kwargs \n"
+ source+= "%s = _F = args_to_dict \n"%macro
+ source+= "parameters="+jdc+" \n"
+ source+= "context['parameters'] = parameters \n"
+ code = compile(source, 'file.py', 'exec')
+ eval(code)
+ parameters = context['parameters']
+ return parameters
+
+def loadJDC(filename):
+ """
+ This function loads the text from the specified JdC file. A JdC
+ file is the persistence file of Eficas (*.comm).
+ """
+ fcomm=open(filename,'r')
+ jdc = ""
+ for line in fcomm.readlines():
+ if not (line[0]=='#'):
+ jdc+="%s"%line
+
+ # Warning, we have to make sure that the jdc comes as a simple
+ # string without any extra spaces/newlines
+ return jdc.strip()