示例#1
0
        static ActionType ARRAY_Parse(string functionspace, string unparsedArgs, ref object[] parsedArgs, ref int lineNumber)
        {
            string parameters = unparsedArgs.Substring(6, unparsedArgs.Length - 6);

            parameters = parameters.Trim();
            string[] split = parameters.Split(new char[] { '[' }, StringSplitOptions.RemoveEmptyEntries);
            if (split.Length < 2)
            {
                throw new Exception("Incorrect array declaration!");
            }
            string arrayName = split[0];

            if (!split[1].Contains(']'))
            {
                throw new Exception("Missing \"]\"!");
            }
            split[1] = split[1].Replace("]", "");
            int arraySize = 0;

            if (!int.TryParse(split[1], out arraySize))
            {
                throw new Exception("Incorrect array size specified!");
            }

            SILArray array = new SILArray(functionspace + "." + arrayName, arraySize);

            parsedArgs = new object[] { array };

            return(ActionType.ARRAY);
        }
示例#2
0
        static void ARRAY_Execute(SIL_Action action)
        {
            SILArray array = (SILArray)action.ParsingArgs[0];

            array.Allocate();
        }