示例#1
0
 protected override string GetStopProcessCode(Kontel.Relkon.CodeDom.RelkonCodeProcess Process)
 {
     if (Process.Situations.Count == 0)
     {
         return("");
     }
     else
     {
         string pn = this.GetProcessName(Process);
         return(pn + ".SIT = 0;");
     }
 }
示例#2
0
        /// <summary>
        /// Возвращает список процесоов, объявленных в программе; код процессов удаляется
        /// из кода программы
        /// </summary>
        /// <param name="CodeRemainder">Строка, содержащая код программы</param>
        private static List <RelkonCodeProcess> GetProcessesList(StringBuilder CodeRemainder)
        {
            List <RelkonCodeProcess> res = new List <RelkonCodeProcess>();
            StringBuilder            ProcessesCodeRemainder = new StringBuilder();
            string          Code = CodeRemainder.ToString();
            MatchCollection mc1  = Regex.Matches(Code, @"(/\*(\d+)\*/\s*#PROCESS\s*(\d+)\s+)(?:.*\n)");
            int             k    = 0;

            for (int i = 0; i < mc1.Count; i++)
            {
                int    LineNumber  = int.Parse(mc1[i].Groups[2].Value);
                int    ProcessIdx  = int.Parse(mc1[i].Groups[3].Value);
                string ProcessCode = "";
                int    endIdx      = -1;
                if (i < mc1.Count - 1)
                {
                    endIdx = mc1[i + 1].Index;
                }
                else
                {
                    endIdx = Utils.GetIndexOfAnySubString(Code, new string[] { "#DATA", "#INPUT", "#OUTPUT", "#TIME", "#INIT" }, mc1[i].Index, @"/\*\d+\*/\s*");
                    if (endIdx == -1)
                    {
                        endIdx = Code.Length;
                    }
                }
                ProcessCode = Code.Substring(mc1[i].Index + mc1[i].Groups[1].Value.Length, endIdx - mc1[i].Index - mc1[i].Groups[1].Value.Length);
                RelkonCodeProcess p = new RelkonCodeProcess(LineNumber, ProcessCode, ProcessIdx);
                res.Add(p);
                CodeRemainder.Remove(mc1[i].Index - k, endIdx - mc1[i].Index);
                k += endIdx - mc1[i].Index;
                ProcessesCodeRemainder.Append(p.OtherCode);
            }
            CodeRemainder.Append(ProcessesCodeRemainder);
            return(res);
        }
示例#3
0
        protected override string GetRestartSituationCode(Kontel.Relkon.CodeDom.RelkonCodeProcess Process, uint Delay)
        {
            string pn = this.GetProcessName(Process);

            return(pn + ".DELAY=" + (Delay == 0 ? Delay : Delay - 1) + "; break");
        }
示例#4
0
        protected override string GetJumpToSituationCode(Kontel.Relkon.CodeDom.RelkonCodeProcess Process, Kontel.Relkon.CodeDom.RelkonCodeSituation Situation, uint Delay)
        {
            string pn = this.GetProcessName(Process);

            return(pn + ".SIT=" + Situation.Index + "; " + pn + ".DELAY=" + (Delay == 0 ? Delay : Delay - 1) + "; break");
        }