コード例 #1
0
        /// <summary>
        /// Get the completed IF or LOOP block.
        /// </summary>
        /// <param name="ifLoopIns">The starting IF or LOOP instruction.</param>
        /// <returns>The completed IF or LOOP block.</returns>
        public static HLProgram GetDefaultIfLoopBlock(Instruction ifLoopIns)
        {
            HLProgram result = new HLProgram();

            result.Add(ifLoopIns);

            if (ifLoopIns.opcode == Instruction.IF)
            {
                result.Add(Instruction.CreatDefaultFromOpcode(Instruction.ELSE));
                result.Add(Instruction.CreatDefaultFromOpcode(Instruction.END_IF));
            }
            else if (ifLoopIns.opcode == Instruction.LOOP)
            {
                result.Add(Instruction.CreatDefaultFromOpcode(Instruction.END_LOOP));
            }
            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Get the sub-program specified by a range.
        /// </summary>
        /// <param name="startIndex">the index of the first Instruction.</param>
        /// <param name="endIndex">the index of the last Instruction.</param>
        /// <returns></returns>
        public HLProgram SubProgram(int startIndex, int endIndex)
        {
            HLProgram hlp = new HLProgram();

            for (int i = startIndex; i <= endIndex; i++)
            {
                hlp.Add(program[i]);
            }
            return(hlp);
        }