Beispiel #1
0
        public void BuildReturnParameters(ProcedureInvocation invocation, SequenceVariable[] ReturnVars, InheritanceType ownerType, out String returnParameterDeclarations, out String returnArguments, out String returnAssignments)
        {
            // can't use the normal xgrs variables for return value receiving as the type of an out-parameter must be invariant
            // this is bullshit, as it is perfectly safe to assign a subtype to a variable of a supertype
            // so we create temporary variables of exact type, which are used to receive the return values,
            // and finally we assign these temporary variables to the real xgrs variables

            returnParameterDeclarations = "";
            returnArguments             = "";
            returnAssignments           = "";
            for (int i = 0; i < ownerType.GetProcedureMethod(invocation.Name).Outputs.Length; ++i)
            {
                String varName;
                if (ReturnVars.Length != 0)
                {
                    varName = GetUniqueId() + ReturnVars[i].PureName;
                }
                else
                {
                    varName = GetUniqueId();
                }
                String typeName   = TypesHelper.DotNetTypeToXgrsType(ownerType.GetProcedureMethod(invocation.Name).Outputs[i]);
                String tmpvarName = "tmpvar_" + varName;
                returnParameterDeclarations += TypesHelper.XgrsTypeToCSharpType(typeName, model) + " " + tmpvarName + "; ";
                returnArguments             += ", out " + tmpvarName;
                if (ReturnVars.Length != 0)
                {
                    returnAssignments += SetVar(ReturnVars[i], tmpvarName);
                }
            }
        }
Beispiel #2
0
 public void BuildOutParameters(SequenceInvocation invocation, SequenceVariable[] ReturnVars, out String outParameterDeclarations, out String outArguments, out String outAssignments)
 {
     outParameterDeclarations = "";
     outArguments             = "";
     outAssignments           = "";
     for (int i = 0; i < actionsTypeInformation.sequencesToOutputTypes[invocation.PackagePrefixedName].Count; ++i)
     {
         String varName;
         if (ReturnVars.Length != 0)
         {
             varName = GetUniqueId() + ReturnVars[i].PureName;
         }
         else
         {
             varName = GetUniqueId();
         }
         String typeName = actionsTypeInformation.sequencesToOutputTypes[invocation.PackagePrefixedName][i];
         outParameterDeclarations += TypesHelper.XgrsTypeToCSharpType(typeName, model) + " tmpvar_" + varName
                                     + " = " + TypesHelper.DefaultValueString(typeName, model) + ";";
         outArguments += ", ref tmpvar_" + varName;
         if (ReturnVars.Length != 0)
         {
             outAssignments += SetVar(ReturnVars[i], "tmpvar_" + varName);
         }
     }
 }
Beispiel #3
0
        public String BuildParameters(Invocation invocation, SequenceExpression[] ArgumentExpressions, SourceBuilder source)
        {
            String parameters = "";

            for (int i = 0; i < ArgumentExpressions.Length; i++)
            {
                String typeName;
                if (actionsTypeInformation.rulesToInputTypes.ContainsKey(invocation.PackagePrefixedName))
                {
                    typeName = actionsTypeInformation.rulesToInputTypes[invocation.PackagePrefixedName][i];
                }
                else if (actionsTypeInformation.sequencesToInputTypes.ContainsKey(invocation.PackagePrefixedName))
                {
                    typeName = actionsTypeInformation.sequencesToInputTypes[invocation.PackagePrefixedName][i];
                }
                else if (actionsTypeInformation.proceduresToInputTypes.ContainsKey(invocation.PackagePrefixedName))
                {
                    typeName = actionsTypeInformation.proceduresToInputTypes[invocation.PackagePrefixedName][i];
                }
                else
                {
                    typeName = actionsTypeInformation.functionsToInputTypes[invocation.PackagePrefixedName][i];
                }
                String cast = "(" + TypesHelper.XgrsTypeToCSharpType(typeName, model) + ")";
                parameters += ", " + cast + exprGen.GetSequenceExpression(ArgumentExpressions[i], source);
            }
            return(parameters);
        }
Beispiel #4
0
 /// <summary>
 /// Returns string containing a C# assignment to set the sequence-local variable / graph-global variable given
 /// to the value as computed by the C# expression in the string given
 /// </summary>
 public string SetVar(SequenceVariable seqVar, String valueToWrite)
 {
     if (seqVar.Type == "")
     {
         return("procEnv.SetVariableValue(\"" + seqVar.PureName + "\", " + valueToWrite + ");\n");
     }
     else
     {
         String cast = "(" + TypesHelper.XgrsTypeToCSharpType(seqVar.Type, model) + ")";
         return("var_" + seqVar.Prefix + seqVar.PureName + " = " + cast + "(" + valueToWrite + ");\n");
     }
 }
Beispiel #5
0
        public String BuildParameters(Invocation invocation, SequenceExpression[] ArgumentExpressions, IProcedureDefinition procedureMethod, SourceBuilder source)
        {
            String parameters = "";

            for (int i = 0; i < ArgumentExpressions.Length; i++)
            {
                String typeName = TypesHelper.DotNetTypeToXgrsType(procedureMethod.Inputs[i]);
                String cast     = "(" + TypesHelper.XgrsTypeToCSharpType(typeName, model) + ")";
                parameters += ", " + cast + exprGen.GetSequenceExpression(ArgumentExpressions[i], source);
            }
            return(parameters);
        }
        private void GenerateGenericExternalDefinedSequenceApplicationMethod(SourceBuilder source, DefinedSequenceInfo sequence)
        {
            source.AppendFront("public override bool Apply(GRGEN_LIBGR.IGraphProcessingEnvironment procEnv, object[] arguments, out object[] returnValues)");
            source.AppendFront("{\n");
            source.Indent();
            source.AppendFront("GRGEN_LGSP.LGSPGraph graph = ((GRGEN_LGSP.LGSPActionExecutionEnvironment)procEnv).graph;\n");

            for (int i = 0; i < sequence.Parameters.Length; ++i)
            {
                string typeName = TypesHelper.XgrsTypeToCSharpType(TypesHelper.DotNetTypeToXgrsType(sequence.ParameterTypes[i]), model);
                source.AppendFront(typeName + " var_" + sequence.Parameters[i]);
                source.Append(" = (" + typeName + ")arguments[" + i + "];\n");
            }
            for (int i = 0; i < sequence.OutParameters.Length; ++i)
            {
                string typeName = TypesHelper.XgrsTypeToCSharpType(TypesHelper.DotNetTypeToXgrsType(sequence.OutParameterTypes[i]), model);
                source.AppendFront(typeName + " var_" + sequence.OutParameters[i]);
                source.Append(" = " + TypesHelper.DefaultValueString(typeName, model) + ";\n");
            }


            source.AppendFront("bool result = ApplyXGRS_" + sequence.Name + "((GRGEN_LGSP.LGSPGraphProcessingEnvironment)procEnv");
            for (int i = 0; i < sequence.Parameters.Length; ++i)
            {
                source.Append(", var_" + sequence.Parameters[i]);
            }
            for (int i = 0; i < sequence.OutParameters.Length; ++i)
            {
                source.Append(", ref var_" + sequence.OutParameters[i]);
            }
            source.Append(");\n");


            source.AppendFront("returnValues = ReturnValues;\n");

            if (sequence.OutParameters.Length > 0)
            {
                source.AppendFront("if(result) {\n");
                source.Indent();
                for (int i = 0; i < sequence.OutParameters.Length; ++i)
                {
                    source.AppendFront("returnValues[" + i + "] = var_" + sequence.OutParameters[i] + ";\n");
                }
                source.Unindent();
                source.AppendFront("}\n");
            }

            source.AppendFront("return result;\n");
            source.Unindent();
            source.AppendFront("}\n");
        }
        private void GenerateExactExternalDefinedSequenceApplicationMethod(SourceBuilder source, DefinedSequenceInfo sequence)
        {
            source.AppendFront("public static bool Apply_" + sequence.Name + "(GRGEN_LIBGR.IGraphProcessingEnvironment procEnv");
            for (int i = 0; i < sequence.Parameters.Length; ++i)
            {
                source.Append(", " + TypesHelper.XgrsTypeToCSharpType(TypesHelper.DotNetTypeToXgrsType(sequence.ParameterTypes[i]), model) + " var_");
                source.Append(sequence.Parameters[i]);
            }
            for (int i = 0; i < sequence.OutParameters.Length; ++i)
            {
                source.Append(", ref " + TypesHelper.XgrsTypeToCSharpType(TypesHelper.DotNetTypeToXgrsType(sequence.OutParameterTypes[i]), model) + " var_");
                source.Append(sequence.OutParameters[i]);
            }
            source.Append(")\n");
            source.AppendFront("{\n");
            source.Indent();

            for (int i = 0; i < sequence.OutParameters.Length; ++i)
            {
                string typeName = TypesHelper.XgrsTypeToCSharpType(TypesHelper.DotNetTypeToXgrsType(sequence.OutParameterTypes[i]), model);
                source.AppendFront(typeName + " vari_" + sequence.OutParameters[i]);
                source.Append(" = " + TypesHelper.DefaultValueString(typeName, model) + ";\n");
            }
            source.AppendFront("bool result = ApplyXGRS_" + sequence.Name + "((GRGEN_LGSP.LGSPGraphProcessingEnvironment)procEnv");
            for (int i = 0; i < sequence.Parameters.Length; ++i)
            {
                source.Append(", var_" + sequence.Parameters[i]);
            }
            for (int i = 0; i < sequence.OutParameters.Length; ++i)
            {
                source.Append(", ref var_" + sequence.OutParameters[i]);
            }
            source.Append(");\n");
            if (sequence.OutParameters.Length > 0)
            {
                source.AppendFront("if(result) {\n");
                source.Indent();
                for (int i = 0; i < sequence.OutParameters.Length; ++i)
                {
                    source.AppendFront("var_" + sequence.OutParameters[i]);
                    source.Append(" = vari_" + sequence.OutParameters[i] + ";\n");
                }
                source.Unindent();
                source.AppendFront("}\n");
            }

            source.AppendFront("return result;\n");
            source.Unindent();
            source.AppendFront("}\n");
        }
        private void GenerateInternalDefinedSequenceApplicationMethodStub(SourceBuilder source, DefinedSequenceInfo sequence, String externalActionsExtensionFilename)
        {
            source.AppendFrontFormat("// You must implement the following function in the same partial class in ./{0}\n", externalActionsExtensionFilename);

            source.AppendFront("//public static bool ApplyXGRS_" + sequence.Name + "(GRGEN_LGSP.LGSPGraphProcessingEnvironment procEnv");
            for (int i = 0; i < sequence.Parameters.Length; ++i)
            {
                source.Append(", " + TypesHelper.XgrsTypeToCSharpType(TypesHelper.DotNetTypeToXgrsType(sequence.ParameterTypes[i]), model) + " var_");
                source.Append(sequence.Parameters[i]);
            }
            for (int i = 0; i < sequence.OutParameters.Length; ++i)
            {
                source.Append(", ref " + TypesHelper.XgrsTypeToCSharpType(TypesHelper.DotNetTypeToXgrsType(sequence.OutParameterTypes[i]), model) + " var_");
                source.Append(sequence.OutParameters[i]);
            }
            source.Append(")\n");
        }
Beispiel #9
0
 /// <summary>
 /// Returns string containing a C# declaration of the variable given
 /// </summary>
 public string DeclareVar(SequenceVariable seqVar)
 {
     if (seqVar.Type != "")
     {
         StringBuilder sb = new StringBuilder();
         sb.Append(TypesHelper.XgrsTypeToCSharpType(seqVar.Type, model));
         sb.Append(" ");
         sb.Append("var_" + seqVar.Prefix + seqVar.PureName);
         sb.Append(" = ");
         sb.Append(TypesHelper.DefaultValueString(seqVar.Type, model));
         sb.Append(";\n");
         return(sb.ToString());
     }
     else
     {
         return("");
     }
 }
        private static void GenerateInternalObjectTypeAttributeInitializer(SequenceCheckingEnvironment env, IGraphModel model, SequenceExpressionNew attributeInitializer, SourceBuilder source)
        {
            if (attributeInitializer.AttributeInitializationList == null)
            {
                return; // plain constructor without attribute initialization list
            }
            string internalObjectType = "GRGEN_MODEL." + attributeInitializer.ConstructedType;

            source.Append("\n");
            source.AppendFront("public static ");
            source.Append(internalObjectType);
            source.Append(" fillFromSequence_" + attributeInitializer.Id + "(");
            BaseObjectType objectType = env.Model.ObjectModel.GetType(attributeInitializer.ConstructedType);

            if (objectType != null)
            {
                source.Append("long uniqueId");
            }
            for (int i = 0; i < attributeInitializer.AttributeInitializationList.Count; ++i)
            {
                KeyValuePair <string, SequenceExpression> attributeInitialization = attributeInitializer.AttributeInitializationList[i];
                if (i > 0 || objectType != null)
                {
                    source.Append(", ");
                }
                string valueType = TypesHelper.XgrsTypeToCSharpType(env.TypeOfMemberOrAttribute(attributeInitializer.ConstructedType, attributeInitialization.Key), model);
                source.AppendFormat("{0} {1}", valueType, "param" + i);
            }
            source.Append(")\n");

            source.AppendFront("{\n");
            source.Indent();
            source.AppendFrontFormat("{0} obj = new {0}({1});\n", internalObjectType, objectType != null ? "uniqueId" : "");
            for (int i = 0; i < attributeInitializer.AttributeInitializationList.Count; ++i)
            {
                KeyValuePair <string, SequenceExpression> attributeInitialization = attributeInitializer.AttributeInitializationList[i];
                source.AppendFrontFormat("obj.{0}  = {1};\n", attributeInitialization.Key, "param" + i);
            }
            source.AppendFront("return obj;\n");
            source.Unindent();
            source.AppendFront("}\n");
        }
Beispiel #11
0
        public String BuildParameters(Invocation invocation, SequenceExpression[] ArgumentExpressions, IFunctionDefinition functionMethod, SourceBuilder source)
        {
            String parameters = "";

            for (int i = 0; i < ArgumentExpressions.Length; i++)
            {
                if (ArgumentExpressions[i] != null)
                {
                    String typeName = TypesHelper.DotNetTypeToXgrsType(functionMethod.Inputs[i]);
                    String cast     = "(" + TypesHelper.XgrsTypeToCSharpType(typeName, model) + ")";
                    parameters += ", " + cast + exprGen.GetSequenceExpression(ArgumentExpressions[i], source);
                }
                else
                {
                    // the sequence parser always emits all argument expressions, for interpreted and compiled
                    throw new Exception("Internal error: missing argument expressions");
                }
            }
            return(parameters);
        }
Beispiel #12
0
        public static void GenerateContainerConstructor(IGraphModel model, SequenceExpressionContainerConstructor containerConstructor, SourceBuilder source)
        {
            string containerType = TypesHelper.XgrsTypeToCSharpType(GetContainerType(containerConstructor), model);
            string valueType     = TypesHelper.XgrsTypeToCSharpType(containerConstructor.ValueType, model);
            string keyType       = null;

            if (containerConstructor is SequenceExpressionMapConstructor)
            {
                keyType = TypesHelper.XgrsTypeToCSharpType(((SequenceExpressionMapConstructor)containerConstructor).KeyType, model);
            }

            source.Append("\n");
            source.AppendFront("public static ");
            source.Append(containerType);
            source.Append(" fillFromSequence_" + containerConstructor.Id);
            source.Append("(");
            for (int i = 0; i < containerConstructor.ContainerItems.Length; ++i)
            {
                if (i > 0)
                {
                    source.Append(", ");
                }
                if (keyType != null)
                {
                    source.AppendFormat("{0} paramkey{1}, ", keyType, i);
                }
                source.AppendFormat("{0} param{1}", valueType, i);
            }
            source.Append(")\n");

            source.AppendFront("{\n");
            source.Indent();
            source.AppendFrontFormat("{0} container = new {0}();\n", containerType);
            for (int i = 0; i < containerConstructor.ContainerItems.Length; ++i)
            {
                source.AppendFrontFormat(GetAddToContainer(containerConstructor, "param" + i, keyType != null ? "paramkey" + i : null));
            }
            source.AppendFront("return container;\n");
            source.Unindent();
            source.AppendFront("}\n");
        }
Beispiel #13
0
        public String BuildParametersInDeclarations(Invocation invocation, SequenceExpression[] ArgumentExpressions, SourceBuilder source, out String declarations)
        {
            String parameters = "";

            declarations = "";
            for (int i = 0; i < ArgumentExpressions.Length; i++)
            {
                String typeName;
                if (actionsTypeInformation.rulesToInputTypes.ContainsKey(invocation.PackagePrefixedName))
                {
                    typeName = actionsTypeInformation.rulesToInputTypes[invocation.PackagePrefixedName][i];
                }
                else
                {
                    typeName = actionsTypeInformation.sequencesToInputTypes[invocation.PackagePrefixedName][i];
                }
                String type = TypesHelper.XgrsTypeToCSharpType(typeName, model);
                String name = "tmpvar_" + GetUniqueId();
                declarations += type + " " + name + " = " + "(" + type + ")" + exprGen.GetSequenceExpression(ArgumentExpressions[i], source) + ";";
                parameters   += ", " + name;
            }
            return(parameters);
        }
        public bool GenerateXGRSCode(string xgrsName, String package, String xgrsStr,
                                     String[] paramNames, GrGenType[] paramTypes,
                                     String[] defToBeYieldedToNames, GrGenType[] defToBeYieldedToTypes,
                                     SourceBuilder source, int lineNr)
        {
            Dictionary <String, String> varDecls = new Dictionary <String, String>();

            for (int i = 0; i < paramNames.Length; ++i)
            {
                varDecls.Add(paramNames[i], TypesHelper.DotNetTypeToXgrsType(paramTypes[i]));
            }
            for (int i = 0; i < defToBeYieldedToNames.Length; ++i)
            {
                varDecls.Add(defToBeYieldedToNames[i], TypesHelper.DotNetTypeToXgrsType(defToBeYieldedToTypes[i]));
            }

            Sequence seq;

            try
            {
                SequenceParserEnvironmentCompiled parserEnv = new SequenceParserEnvironmentCompiled(package, actionNames, model);
                List <string> warnings = new List <string>();
                seq = SequenceParser.ParseSequence(xgrsStr, parserEnv, varDecls, warnings);
                foreach (string warning in warnings)
                {
                    Console.Error.WriteLine("The exec statement \"" + xgrsStr
                                            + "\" given on line " + lineNr + " reported back:\n" + warning);
                }
                seq.Check(env);
                seq.SetNeedForProfilingRecursive(emitProfiling);
            }
            catch (ParseException ex)
            {
                Console.Error.WriteLine("The exec statement \"" + xgrsStr
                                        + "\" given on line " + lineNr + " caused the following error:\n" + ex.Message);
                return(false);
            }
            catch (SequenceParserException ex)
            {
                Console.Error.WriteLine("The exec statement \"" + xgrsStr
                                        + "\" given on line " + lineNr + " caused the following error:\n");
                HandleSequenceParserException(ex);
                return(false);
            }

            source.Append("\n");
            source.AppendFront("public static bool ApplyXGRS_" + xgrsName + "(GRGEN_LGSP.LGSPGraphProcessingEnvironment procEnv");
            for (int i = 0; i < paramNames.Length; ++i)
            {
                source.Append(", " + TypesHelper.XgrsTypeToCSharpType(TypesHelper.DotNetTypeToXgrsType(paramTypes[i]), model) + " var_");
                source.Append(paramNames[i]);
            }
            for (int i = 0; i < defToBeYieldedToTypes.Length; ++i)
            {
                source.Append(", ref " + TypesHelper.XgrsTypeToCSharpType(TypesHelper.DotNetTypeToXgrsType(defToBeYieldedToTypes[i]), model) + " var_");
                source.Append(defToBeYieldedToNames[i]);
            }
            source.Append(")\n");
            source.AppendFront("{\n");
            source.Indent();

            source.AppendFront("GRGEN_LGSP.LGSPGraph graph = procEnv.graph;\n");
            source.AppendFront("GRGEN_LGSP.LGSPActions actions = procEnv.curActions;\n");

            neededEntitiesEmitter.Reset();

            if (fireDebugEvents)
            {
                source.AppendFrontFormat("procEnv.DebugEntering(\"{0}\", \"{1}\");\n",
                                         InjectExec(xgrsName), xgrsStr.Replace("\\", "\\\\").Replace("\"", "\\\""));
            }

            neededEntitiesEmitter.EmitNeededVarAndRuleEntities(seq, source);

            seqGen.EmitSequence(seq, source);

            if (fireDebugEvents)
            {
                source.AppendFrontFormat("procEnv.DebugExiting(\"{0}\");\n",
                                         InjectExec(xgrsName));
            }

            source.AppendFront("return " + seqGen.GetSequenceResult(seq) + ";\n");
            source.Unindent();
            source.AppendFront("}\n");

            List <SequenceExpressionContainerConstructor> containerConstructors = new List <SequenceExpressionContainerConstructor>();
            Dictionary <SequenceVariable, SetValueType>   variables             = new Dictionary <SequenceVariable, SetValueType>();

            seq.GetLocalVariables(variables, containerConstructors, null);
            foreach (SequenceExpressionContainerConstructor cc in containerConstructors)
            {
                SequenceContainerConstructorEmitter.GenerateContainerConstructor(model, cc, source);
            }

            return(true);
        }
        private void GenerateInternalDefinedSequenceApplicationMethod(SourceBuilder source, DefinedSequenceInfo sequence, Sequence seq)
        {
            source.AppendFront("public static bool ApplyXGRS_" + sequence.Name + "(GRGEN_LGSP.LGSPGraphProcessingEnvironment procEnv");
            for (int i = 0; i < sequence.Parameters.Length; ++i)
            {
                source.Append(", " + TypesHelper.XgrsTypeToCSharpType(TypesHelper.DotNetTypeToXgrsType(sequence.ParameterTypes[i]), model) + " var_");
                source.Append(sequence.Parameters[i]);
            }
            for (int i = 0; i < sequence.OutParameters.Length; ++i)
            {
                source.Append(", ref " + TypesHelper.XgrsTypeToCSharpType(TypesHelper.DotNetTypeToXgrsType(sequence.OutParameterTypes[i]), model) + " var_");
                source.Append(sequence.OutParameters[i]);
            }
            source.Append(")\n");
            source.AppendFront("{\n");
            source.Indent();

            source.AppendFront("GRGEN_LGSP.LGSPGraph graph = procEnv.graph;\n");
            source.AppendFront("GRGEN_LGSP.LGSPActions actions = procEnv.curActions;\n");

            neededEntitiesEmitter.Reset();

            if (fireDebugEvents)
            {
                source.AppendFrontFormat("procEnv.DebugEntering(\"{0}\"", sequence.Name);
                for (int i = 0; i < sequence.Parameters.Length; ++i)
                {
                    source.Append(", var_");
                    source.Append(sequence.Parameters[i]);
                }
                source.Append(");\n");
            }

            neededEntitiesEmitter.EmitNeededVarAndRuleEntities(seq, source);

            seqGen.EmitSequence(seq, source);

            if (fireDebugEvents)
            {
                source.AppendFrontFormat("procEnv.DebugExiting(\"{0}\"", sequence.Name);
                for (int i = 0; i < sequence.OutParameters.Length; ++i)
                {
                    source.Append(", var_");
                    source.Append(sequence.OutParameters[i]);
                }
                source.Append(");\n");
            }

            source.AppendFront("return " + seqGen.GetSequenceResult(seq) + ";\n");
            source.Unindent();
            source.AppendFront("}\n");

            List <SequenceExpressionContainerConstructor> containerConstructors = new List <SequenceExpressionContainerConstructor>();
            Dictionary <SequenceVariable, SetValueType>   variables             = new Dictionary <SequenceVariable, SetValueType>();

            seq.GetLocalVariables(variables, containerConstructors, null);
            foreach (SequenceExpressionContainerConstructor cc in containerConstructors)
            {
                SequenceContainerConstructorEmitter.GenerateContainerConstructor(model, cc, source);
            }
        }
Beispiel #16
0
        public void BuildReturnParameters(RuleInvocation invocation, SequenceVariable[] ReturnVars,
                                          out String returnParameterDeclarations, out String returnArguments, out String returnAssignments,
                                          out String returnParameterDeclarationsAllCall, out String intermediateReturnAssignmentsAllCall, out String returnAssignmentsAllCall)
        {
            // can't use the normal xgrs variables for return value receiving as the type of an out-parameter must be invariant
            // this is bullshit, as it is perfectly safe to assign a subtype to a variable of a supertype
            // so we create temporary variables of exact type, which are used to receive the return values,
            // and finally we assign these temporary variables to the real xgrs variables

            StringBuilder sbReturnParameterDeclarations          = new StringBuilder();
            StringBuilder sbReturnArguments                      = new StringBuilder();
            StringBuilder sbReturnAssignments                    = new StringBuilder();
            StringBuilder sbReturnParameterDeclarationsAllCall   = new StringBuilder();
            StringBuilder sbIntermediateReturnAssignmentsAllCall = new StringBuilder();
            StringBuilder sbReturnAssignmentsAllCall             = new StringBuilder();

            for (int i = 0; i < actionsTypeInformation.rulesToOutputTypes[invocation.PackagePrefixedName].Count; ++i)
            {
                String varName;
                if (ReturnVars.Length != 0)
                {
                    varName = GetUniqueId() + ReturnVars[i].PureName;
                }
                else
                {
                    varName = GetUniqueId();
                }
                String typeName = actionsTypeInformation.rulesToOutputTypes[invocation.PackagePrefixedName][i];

                String tmpvarName = "tmpvar_" + varName;
                sbReturnParameterDeclarations.Append(TypesHelper.XgrsTypeToCSharpType(typeName, model));
                sbReturnParameterDeclarations.Append(" ");
                sbReturnParameterDeclarations.Append(tmpvarName);
                sbReturnParameterDeclarations.Append("; ");

                String returnListValueVarType = typeName;
                String tmpvarListName         = "tmpvarlist_" + varName;
                if (ReturnVars.Length != 0 && ReturnVars[i].Type != "" && ReturnVars[i].Type.StartsWith("array<"))
                {
                    returnListValueVarType = TypesHelper.ExtractSrc(ReturnVars[i].Type);
                }
                if (ReturnVars.Length != 0)
                {
                    sbReturnParameterDeclarationsAllCall.Append("List<");
                    sbReturnParameterDeclarationsAllCall.Append(TypesHelper.XgrsTypeToCSharpType(returnListValueVarType, model));
                    sbReturnParameterDeclarationsAllCall.Append("> ");
                    sbReturnParameterDeclarationsAllCall.Append(tmpvarListName);
                    sbReturnParameterDeclarationsAllCall.Append(" = new List<");
                    sbReturnParameterDeclarationsAllCall.Append(TypesHelper.XgrsTypeToCSharpType(returnListValueVarType, model));
                    sbReturnParameterDeclarationsAllCall.Append(">(); ");
                }

                sbReturnArguments.Append(", out ");
                sbReturnArguments.Append(tmpvarName);

                if (ReturnVars.Length != 0)
                {
                    sbReturnAssignments.Append(SetVar(ReturnVars[i], tmpvarName));

                    sbIntermediateReturnAssignmentsAllCall.Append(tmpvarListName);
                    sbIntermediateReturnAssignmentsAllCall.Append(".Add((");
                    sbIntermediateReturnAssignmentsAllCall.Append(TypesHelper.XgrsTypeToCSharpType(returnListValueVarType, model));
                    sbIntermediateReturnAssignmentsAllCall.Append(")");
                    sbIntermediateReturnAssignmentsAllCall.Append(tmpvarName);
                    sbIntermediateReturnAssignmentsAllCall.Append("); ");

                    sbReturnAssignmentsAllCall.Append(SetVar(ReturnVars[i], tmpvarListName));
                }
            }

            returnParameterDeclarations          = sbReturnParameterDeclarations.ToString();
            returnArguments                      = sbReturnArguments.ToString();
            returnAssignments                    = sbReturnAssignments.ToString();
            returnParameterDeclarationsAllCall   = sbReturnParameterDeclarationsAllCall.ToString();
            intermediateReturnAssignmentsAllCall = sbIntermediateReturnAssignmentsAllCall.ToString();
            returnAssignmentsAllCall             = sbReturnAssignmentsAllCall.ToString();
        }