public static void CallFct(Compiler cmp, Argument[] args) { int count = 0; int startIdx = 1; int value = 0; Function fct = cmp.Functions.Last(); FctCallInstruction c = FctCallInstruction.GetCallInstruction(cmp, args.StringArray(), ref startIdx); count = startIdx + 1; c.ExtractVariables(fct, args.StringArray(), count); fct.Instructions.Add(c); }
public static void Set(Compiler cmp, Argument[] args) { int value; Function fct = cmp.Functions.Last(); Variable v = fct.GetVariable(args[1]); if (TryConstSet(fct, v, args[2])) { } else if (TryPtrSet(fct, v, args[2])) { } /* TODO Casts && Copy * else if () * { * * }*/ else { int count = 3; int startIdx = 2; FctCallInstruction fci = FctCallInstruction.GetCallInstruction(cmp, args.StringArray(), ref startIdx); count = startIdx + 1; while (count < args.Length) { Variable a = fct.GetVariable(args[count]); if (a == null && Int32.TryParse(args[count], out value)) { a = new ConstIntVariable(value); } fci.Variables.Add(a); ++count; } RetCarryInstruction rci = new RetCarryInstruction(v); fct.Instructions.Add(fci); fct.Instructions.Add(rci); } }