Esempio n. 1
0
 void Update()
 {
     if (transitionType != pTransitionType)
     {
         //CHANGER L'AFFICHAGE
         //Find active child
         for (int i = 0; i < this.transform.childCount; ++i)
         {
             if (transform.GetChild(i).gameObject.activeSelf)
             {
                 tpanel = transform.GetChild(i).FindChild("Panneau");
             }
         }
         //Find its TypeTransitionObject
         if (transitionType < tType.All)
         {
             SetBack((int)transitionType % 2);
             SetIcon(transitionType);
         }
         else if (transitionType == tType.All)
         {
             SetBack(0);
             SetIcon(tType.All);
         }
     }
     pTransitionType     = transitionType;
     ptransitionKindName = transitionKindName;
 }
Esempio n. 2
0
// ПростоеВыраж [Отношение ПростоеВыраж]
    static tType Expression()
    {
        tLex Op;

        tType T = SimpleExpr();

        if (Scan.Lex == tLex.lexEQ || Scan.Lex == tLex.lexNE ||
            Scan.Lex == tLex.lexGT || Scan.Lex == tLex.lexGE ||
            Scan.Lex == tLex.lexLT || Scan.Lex == tLex.lexLE)
        {
            Op = Scan.Lex;
            if (T != tType.Int)
            {
                Error.Message(
                    "Несоответствие операции типу операнда"
                    );
            }
            Scan.NextLex();
            if ((T = SimpleExpr()) != tType.Int)
            {
                Error.Expected("выражение целого типа");
            }
            Gen.Comp(Op); //Генерация условного перехода
            T = tType.Bool;
        } //иначе тип равен типу первого простого выражения
        return(T);
    }
// Добавление элемента
    public static void Enter(string N, tCat C, tType T, int V)
    {
        Obj P = new Obj();

        P.Name = String.Copy(N);
        P.Cat  = C;
        P.Type = T;
        P.Val  = V;
        P.Prev = Top;
        Top    = P;
    }
Esempio n. 4
0
// Имя {"(" Выраж | Тип ")"} | Число | "(" Выраж ")"
    static tType Factor()
    {
        Obj   X;
        tType T = tType.None;

        if (Scan.Lex == tLex.lexName)
        {
            if ((X = Table.Find(Scan.Name)).Cat == tCat.Var)
            {
                Gen.Addr(X); //Адрес переменной
                Gen.Cmd(OVM.cmLoad);
                Scan.NextLex();
                return(X.Type);
            }
            else if (X.Cat == tCat.Const)
            {
                Gen.Const(X.Val);
                Scan.NextLex();
                return(X.Type);
            }
            else if (X.Cat == tCat.StProc &&
                     X.Type != tType.None)
            {
                Scan.NextLex();
                Check(tLex.lexLPar, "\"(\"");
                T = StFunc(X.Val);
                Check(tLex.lexRPar, "\")\"");
            }
            else
            {
                Error.Expected(
                    "переменная, константа или процедура-функции"
                    );
            }
        }
        else if (Scan.Lex == tLex.lexNum)
        {
            Gen.Const(Scan.Num);
            Scan.NextLex();
            return(tType.Int);
        }
        else if (Scan.Lex == tLex.lexLPar)
        {
            Scan.NextLex();
            T = Expression();
            Check(tLex.lexRPar, "\")\"");
        }
        else
        {
            Error.Expected("имя, число или \"(\"");
        }
        return(T);
    }
Esempio n. 5
0
        public async Task <IActionResult> OnGetAsync(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            tType = await _context.tType.SingleOrDefaultAsync(m => m.type_name == id);

            type = tType;
            if (tType == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Esempio n. 6
0
 public void NextState()
 {
     //Debug.Log(" and is changing state from " + transitionType);
     transitionType += 2;
     if (transitionType > tType.All)
     {
         if ((int)transitionType % 2 == 0)
         {
             transitionType = 0;
         }
         else
         {
             transitionType = tType.NotRed;
         }
     }
     //Debug.Log(" to " + transitionType);
 }
Esempio n. 7
0
// Множитель {ОперУмн Множитель}
    static tType Term()
    {
        tLex  Op;
        tType T = Factor();

        if (Scan.Lex == tLex.lexMult || Scan.Lex == tLex.lexDIV ||
            Scan.Lex == tLex.lexMOD)
        {
            if (T != tType.Int)
            {
                Error.Message(
                    "Несоответствие операции типу операнда"
                    );
            }
            do
            {
                Op = Scan.Lex;
                Scan.NextLex();
                if ((T = Factor()) != tType.Int)
                {
                    Error.Expected("выражение целого типа");
                }
                switch (Op)
                {
                case tLex.lexMult: Gen.Cmd(OVM.cmMult); break;

                case tLex.lexDIV:  Gen.Cmd(OVM.cmDiv); break;

                case tLex.lexMOD:  Gen.Cmd(OVM.cmMod); break;
                }
            } while(Scan.Lex == tLex.lexMult ||
                    Scan.Lex == tLex.lexDIV ||
                    Scan.Lex == tLex.lexMOD);
        }
        return(T);
    }
Esempio n. 8
0
    private void SetIcon(tType iconType)
    {
        switch (iconType)
        {
        case tType.Red:
        case tType.NotRed:
            //    Debug.Log("red icon");
            tpanel.FindChild("Item").FindChild("Red").gameObject.SetActive(true);
            tpanel.FindChild("Item").FindChild("Green").gameObject.SetActive(false);
            tpanel.FindChild("Item").FindChild("Blue").gameObject.SetActive(false);
            break;

        case tType.Green:
        case tType.NotGreen:
            //    Debug.Log("green icon");
            tpanel.FindChild("Item").FindChild("Red").gameObject.SetActive(false);
            tpanel.FindChild("Item").FindChild("Green").gameObject.SetActive(true);
            tpanel.FindChild("Item").FindChild("Blue").gameObject.SetActive(false);
            break;

        case tType.Blue:
        case tType.NotBlue:
            //    Debug.Log("blue icon");
            tpanel.FindChild("Item").FindChild("Red").gameObject.SetActive(false);
            tpanel.FindChild("Item").FindChild("Green").gameObject.SetActive(false);
            tpanel.FindChild("Item").FindChild("Blue").gameObject.SetActive(true);
            break;

        default:
            //    Debug.Log("no icon");
            tpanel.FindChild("Item").FindChild("Red").gameObject.SetActive(false);
            tpanel.FindChild("Item").FindChild("Green").gameObject.SetActive(false);
            tpanel.FindChild("Item").FindChild("Blue").gameObject.SetActive(false);
            break;
        }
    }
Esempio n. 9
0
 /** Turbulence models available: ttNone, ttStandard, ttBerndt, ttCulp,
  *  ttMilspec, ttTustin */
 public virtual void SetTurbType(tType tt)
 {
     turbType = tt;
 }
Esempio n. 10
0
        private void ReadTestScript(string scriptFileName, sType scriptType, out List <ScriptDefs> testParams, out List <string> testScriptErrors)
        {
            testParams = new List <ScriptDefs>();
            string        scriptFileRead;
            List <string> scriptFileLines             = new List <string>();
            List <string> scriptFileLinesWithLineNums = new List <string>();

            testScriptErrors = new List <string>();

            List <string> formatErrors = new List <string>();
            List <string> binErrors    = new List <string>();

            List <int> softwareBins = new List <int>();

            string[] scriptFileLineParams;
            try {
                // read file content including all delimiters
                StreamReader sr = new StreamReader(scriptFileName);
                scriptFileRead = sr.ReadToEnd();
                sr.Close();

                if (!scriptFileRead.Equals(string.Empty))
                {
                    scriptFileLines.AddRange(scriptFileRead.Split(fileToLinesDelimiters, StringSplitOptions.None));
                    int lineNum = 1;
                    foreach (string line in scriptFileLines)
                    {
                        scriptFileLinesWithLineNums.Add((lineNum++).ToString() + specialDelimeter[0] + line);
                    }

                    // first run the format and bin check, and also remove all comment lines
                    FormatCheck(ref scriptFileLinesWithLineNums, out softwareBins, out formatErrors);
                    if (formatErrors != null)
                    {
                        testScriptErrors.AddRange(formatErrors);
                    }
                    tType  testType    = tType.UNKNOWN;
                    string testName    = string.Empty;
                    string testUnit    = string.Empty;
                    double testTarget  = reservedBins[0];
                    double testSpecMin = reservedBins[0];
                    double testSpecMax = reservedBins[0];
                    int    testSWBin   = reservedBins[0];
                    int    testHWBin   = reservedBins[0];
                    for (int i = 0; i < scriptFileLinesWithLineNums.Count; i++)
                    {
                        string[] thisLine = scriptFileLinesWithLineNums[i].Split(specialDelimeter, StringSplitOptions.None);
                        lineNum = Convert.ToInt16(thisLine[0].Trim());
                        if (lineNum == 1)
                        {
                            //the display line was checked already in FormatCheck()
                            continue;
                        }
                        scriptFileLineParams = thisLine[1].Split(lineToParamsDelimiters, StringSplitOptions.None);
                        int length = scriptFileLineParams.Length;
                        if (scriptFileLineParams[0].Trim().Equals("1"))
                        {
                            string[] testParamPerLine = new string[8];
                            for (int j = 0; j < 12; j++)
                            {
                                // testType, testName, testUnit, testTarget, testSpecMin, testSpecMax, testSWBin, testHWBin
                                if (j == 2 && length > 2)
                                {
                                    testType = ParseTestType(scriptFileLineParams[2].Trim().ToUpper());
                                }
                                if (j == 3 && length > 3)
                                {
                                    testName = scriptFileLineParams[3].Trim().ToUpper();
                                }
                                if (j == 4 && length > 4)
                                {
                                    testUnit = scriptFileLineParams[4].Trim().ToUpper();
                                }
                                if (j == 7 && length > 7)
                                {
                                    testTarget = ParseTarget(scriptFileLineParams[7]);
                                }
                                if (j == 8 && length > 8)
                                {
                                    testSpecMin = ParseTarget(scriptFileLineParams[8]);
                                }
                                if (j == 9 && length > 9)
                                {
                                    testSpecMax = ParseTarget(scriptFileLineParams[9]);
                                }
                                if (j == 10 && length > 10)
                                {
                                    testSWBin = ParseBins(scriptFileLineParams[10]);
                                }
                                if (j == 11 && length > 11)
                                {
                                    testHWBin = ParseBins(scriptFileLineParams[11]);
                                }
                            }
                            testParams.Add(new ScriptDefs {
                                ScriptType  = scriptType,
                                TestNum     = lineNum,
                                TestType    = testType,
                                TestName    = testName,
                                TestUnit    = testUnit,
                                TestTarget  = testTarget,
                                TestSpecMin = testSpecMin,
                                TestSpecMax = testSpecMax,
                                TestSWBin   = testSWBin,
                                TestHWBin   = testHWBin
                            });
                        }
                    } // for loop of each line scanning

                    // more BIN checks
                    BinCheck(testParams, softwareBins, out binErrors);
                    if (binErrors != null)
                    {
                        testScriptErrors.AddRange(binErrors);
                    }
                }
            } catch (Exception exception) {
                MessageBox.Show("Reading test script process failed: \n" + exception.ToString());
                return;
            }
        }
Esempio n. 11
0
 public void SaveType(tType type)
 {
     mmEntities.tTypes.Add(type);
     mmEntities.SaveChanges();
 }
Esempio n. 12
0
 // Use this for initialization
 void Start()
 {
     this.gameManager = GameObject.FindWithTag("GameManager").GetComponent <DrawingScript>();
     transitionType   = tType.All;
 }
Esempio n. 13
0
 public void StomachState()
 {
     transitionType = tType.Stomach;
 }