Exemplo n.º 1
0
Arquivo: Form1.cs Projeto: vi34/fb2smv
        private void generateSMVToolStripMenuItem_Click(object sender, EventArgs e)
        {
            smvCodeRichTextBox.Text = "";
            if (_parcer == null)
            {
                return;
            }
            SmvCodeGenerator translator = new SmvCodeGenerator(_parcer.Storage, _executionModels, Program.Settings, ShowMessage);

            translator.Check();
            foreach (string fbSmv in translator.TranslateAll())
            {
                smvCodeRichTextBox.Text += fbSmv;
            }

            smvCodeRichTextBox.Text += translator.GetTimeScheduler();

            //smvCodePage.Focus();
            if (mainModuleRichTextBox.Text == "")
            {
                mainModuleRichTextBox.Text = translator.GenerateMain();
            }
            else if (MessageBox.Show("Main module exists. Do you want to replace it?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                mainModuleRichTextBox.Text = translator.GenerateMain();
            }
            tabControl1.SelectTab(smvCodePage);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            string filename = args[0];

            FBClassParcer parcer = new FBClassParcer();
            parcer.ParseRecursive(filename);
            SmvCodeGenerator translator = new SmvCodeGenerator(parcer.Storage);

            string outFileName = Path.Combine(Path.GetDirectoryName(filename), Path.GetFileNameWithoutExtension(filename) + ".smv");
            StreamWriter wr = new StreamWriter(outFileName);
            foreach (string fbSmv in translator.TranslateAll())
            {
                wr.Write(fbSmv + "\n");
            }
            wr.Close();
        }
Exemplo n.º 3
0
        public void TestMethod1()
        {
            const string  filename = @"c:\Users\dim\Projects\fb2smv\tests\full_fb\fb\pnp\PNP_PLANT_MS_CONTROL_FOR_SMV.fbt";
            FBClassParcer parcer   = new FBClassParcer(del, s);

            parcer.ParseRecursive(filename, del);

            List <ExecutionModel> executionModels = ExecutionModelsList.Generate(parcer, true);
            Settings settings = new Settings();

            SmvCodeGenerator translator = new SmvCodeGenerator(parcer.Storage, executionModels, settings, del);

            foreach (string fbSmv in translator.TranslateAll())
            {
                Tester.Test(fbSmv);
            }
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            string filename = args[0];

            FBClassParcer parcer = new FBClassParcer();

            parcer.ParseRecursive(filename);

            var  compositeBlocks                  = parcer.Storage.Types.Where((fbType) => fbType.Type == FBClass.Composite);
            bool solveDispatchingProblem          = true;
            IEnumerable <IDispatcher> dispatchers = DispatchersCreator.Create(compositeBlocks, parcer.Storage.Instances, solveDispatchingProblem);
            SmvCodeGenerator          translator  = new SmvCodeGenerator(parcer.Storage, dispatchers);

            string       outFileName = Path.Combine(Path.GetDirectoryName(filename), Path.GetFileNameWithoutExtension(filename) + ".smv");
            StreamWriter wr          = new StreamWriter(outFileName);

            foreach (string fbSmv in translator.TranslateAll())
            {
                wr.Write(fbSmv + "\n");
            }
            wr.Close();
        }
Exemplo n.º 5
0
        private static void Main(string[] args)
        {
            var filename = args[0];
            var settings = new Settings();
            var parser   = new FBClassParcer(Console.WriteLine, settings);

            parser.ParseRecursive(filename, Console.WriteLine);

            var executionModels = ExecutionModelsList.Generate(parser, true);
            var translator      = new SmvCodeGenerator(parser.Storage, executionModels, settings, Console.WriteLine);

            var outFileName = Path.Combine(Path.GetDirectoryName(filename),
                                           Path.GetFileNameWithoutExtension(filename) + ".smv");
            var wr = new StreamWriter(outFileName);

            foreach (var fbSmv in translator.TranslateAll())
            {
                wr.Write(fbSmv + "\n");
            }

            wr.Close();
        }