public void WriteInPowerShell(ICodeConverter converter) { IFunction f = converter.ImplementedFunctions.Find(new Predicate <IFunction>(delegate(IFunction func) { return(func.Name == this.cachedProc.FunctionName); })); if (!converter.CallingFunctions.Exists(new Predicate <IFunction>(delegate(IFunction func) { return(func.StrictName == CallSkeleton.SpecialChars(this.Name) && func.InstanceNumber == f.InstanceNumber); }))) { converter.CallingFunctions.Add(f); } converter.CurrentFunction.AddToSource(PowerShellConverter.Escape((f.IsMacro ? "macro_" : f.IsJob ? "job_" : "func_") + f.Name + " ")); bool first = true; // ne pas ajouter des paramètres typés, utiliser des VariableName distinct List <string> distincts = new List <string>(); foreach (IParameter p in f.Parameters) { if (!distincts.Contains(p.VariableName)) { if (!first) { converter.CurrentFunction.AddToSource(" "); } else { first = false; } converter.CurrentFunction.AddToSource("-" + p.VariableName); if (p.IsMutableParameter) { converter.CurrentFunction.AddToSource(" S[byref:" + p.VariableName + "]"); } else { converter.CurrentFunction.AddToSource(" S[byvalue:" + p.VariableName + "]"); } distincts.Add(p.VariableName); } } converter.CurrentFunction.AddToSource(Environment.NewLine); }
public void WriteInMicrosoftCPP(ICodeConverter converter) { IFunction f = converter.ImplementedFunctions.Find(new Predicate <IFunction>(delegate(IFunction func) { return(func.Name == this.cachedProc.FunctionName); })); if (!converter.CallingFunctions.Exists(new Predicate <IFunction>(delegate(IFunction func) { return(func.StrictName == CallSkeleton.SpecialChars(this.Name) && func.InstanceNumber == f.InstanceNumber); }))) { converter.CallingFunctions.Add(f); } converter.CurrentFunction.AddToSource(Helper.MakeNewMethodForCPP(this.cachedProc, converter, f)); }
public void WriteInVBScript(ICodeConverter converter) { IFunction f = converter.ImplementedFunctions.Find(new Predicate <IFunction>(delegate(IFunction func) { return(func.Name == this.cachedProc.FunctionName); })); if (!converter.CallingFunctions.Exists(new Predicate <IFunction>(delegate(IFunction func) { return(func.StrictName == CallSkeleton.SpecialChars(this.Name) && func.InstanceNumber == f.InstanceNumber); }))) { converter.CallingFunctions.Add(f); } converter.CurrentFunction.AddToSource((f.IsMacro ? "macro_" : f.IsJob ? "job_" : "func_") + f.Name + " "); bool first = true; List <string> names = new List <string>(); foreach (IParameter p in f.Parameters) { if (!names.Contains(p.VariableName)) { if (!first) { converter.CurrentFunction.AddToSource(", "); } else { first = false; } converter.CurrentFunction.AddToSource(p.VariableName); names.Add(p.VariableName); } } converter.CurrentFunction.AddToSource(Environment.NewLine); }
public void Convert(Converters.ICodeConverter converter, IProcessInstance proc, FinalFile file) { this.cachedProc = proc; if (converter.ImplementedFunctions.Exists(new Predicate <IFunction>(delegate(IFunction f) { return(f.StrictName == CallSkeleton.SpecialChars(this.name)); }))) { converter.Convert(this); } else { throw new Exception("Pour convertir le programme, les processus doivent être déclarés auparavant; le processus '" + this.name + "' n'a pas été déclaré auparavant"); } }