Beispiel #1
0
        } // PVM.QuickInterpret

        public static void Interpret(int codeLen, int initSP)
        {
            // Interactively opens data and results files.  Then interprets the codeLen
            // instructions stored in mem, with stack pointer initialized to initSP
            Console.Write("\nTrace execution (y/N/q)? ");
            char reply = (Console.ReadLine() + " ").ToUpper()[0];
            bool traceStack = false, traceHeap = false;

            if (reply != 'Q')
            {
                bool tracing = reply == 'Y';
                if (tracing)
                {
                    Console.Write("\nTrace Stack (y/N)? ");
                    traceStack = (Console.ReadLine() + " ").ToUpper()[0] == 'Y';
                    Console.Write("\nTrace Heap (y/N)? ");
                    traceHeap = (Console.ReadLine() + " ").ToUpper()[0] == 'Y';
                }
                Console.Write("\nData file [STDIN] ? ");
                InFile data = new InFile(Console.ReadLine());
                Console.Write("\nResults file [STDOUT] ? ");
                OutFile results = new OutFile(Console.ReadLine());
                Emulator(0, codeLen, initSP, data, results, tracing, traceStack, traceHeap);
                results.Close();
                data.Close();
            }
        } // PVM.Interpret
Beispiel #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //Code which Changes the visibility of Form.
            ProductPanel.Visible      = true;
            ButtonPanelOne.Visible    = false;
            ExitButtonTwo.Visible     = true;
            DataGridViewPanel.Visible = false;
            //The Opening stock is loaded from the file and stored in stock array.
            StreamReader InFile;

            InFile = File.OpenText("StockFile.txt");
            for (int i = 0; i < 14; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    StockArray[i, j] = int.Parse(InFile.ReadLine());
                }
            }
            InFile.Close();
            //code in which loaded Stock is copied to Temporary Array for daily operation.
            Array.Copy(StockArray, TempStockArray, StockArray.Length);
        }