public bool InputString([ByRef] IVariable resut, IValue prompt = null, IValue len = null, IValue multiline = null) { string input; bool inputIsDone; string strPrompt = null; int length = 0; bool flagML = false; if (prompt != null) { if (prompt.DataType != DataType.String) { throw RuntimeException.InvalidNthArgumentType(2); } strPrompt = prompt.AsString(); } if (len != null) { if (len.DataType != DataType.Number) { throw RuntimeException.InvalidNthArgumentType(3); } length = (int)len.AsNumber(); } if (multiline != null) { if (multiline.DataType != DataType.Boolean) { throw RuntimeException.InvalidNthArgumentType(4); } flagML = multiline.AsBoolean(); } inputIsDone = ApplicationHost.InputString(out input, strPrompt, length, flagML); if (inputIsDone) { resut.Value = ValueFactory.Create(input); return(true); } else { return(false); } }
public static ArrayImpl Constructor(IValue[] dimensions) { if (dimensions.Length == 1 && dimensions[0].GetRawValue() is FixedArrayImpl) { return(Constructor(dimensions[0])); } ArrayImpl cloneable = null; for (int dim = dimensions.Length - 1; dim >= 0; dim--) { if (dimensions[dim] == null) { throw RuntimeException.InvalidNthArgumentType(dim + 1); } int bound = (int)dimensions[dim].AsNumber(); if (bound <= 0) { throw RuntimeException.InvalidNthArgumentValue(dim + 1); } var newInst = new ArrayImpl(); FillArray(newInst, bound); if (cloneable != null) { for (int i = 0; i < bound; i++) { newInst._values[i] = CloneArray(cloneable); } } cloneable = newInst; } return(cloneable); }