public string Compile(PascalABCCompiler.CompilerOptions CompilerOptions)
        {
            compilationStartTime     = DateTime.Now;
            Compiler.CompilerOptions = CompilerOptions;
            string fn = Compiler.Compile();

            return(fn);
        }
        private void CompileTestProgram(object state)
        {
            string fileName = @"C:\PABCWork.NET\Samples\test.pas";

            if (File.Exists(fileName))
            {
                PascalABCCompiler.CompilerOptions co = new PascalABCCompiler.CompilerOptions();
                co.SourceFileName = fileName;
                Compile(co);
            }
        }
Example #3
0
        public Form1()
        {
            PascalABCCompiler.StringResourcesLanguage.LoadDefaultConfig();
            if (PascalABCCompiler.StringResourcesLanguage.AccessibleLanguages.Count > 0)
                PascalABCCompiler.StringResourcesLanguage.CurrentLanguageName = PascalABCCompiler.StringResourcesLanguage.AccessibleLanguages[0];
           
            InitializeComponent();
            InitForm();
            AddOwnedForm(CompileOptionsForm1 = new CompileOptionsForm());
            AddOwnedForm(UserOptionsForm1 = new UserOptionsForm());
            AddOwnedForm(CompilerForm1 = new CompilerForm());
            AddOwnedForm(AboutBox1 = new AboutBox());
            AddOwnedForm(FindForm = new FindReplaceForm(FindReplaceForm.FormType.Find));
            AddOwnedForm(ReplaceForm = new FindReplaceForm(FindReplaceForm.FormType.Replace));
            CompilerOptions1 = new PascalABCCompiler.CompilerOptions();
            CompilerOptions1.Debug = true;
            LastOpenFiles = new List<string>();

            RunProcessOptions1 = new RunProcessOptions();
            

            CompilerOptions1.OutputFileType = PascalABCCompiler.CompilerOptions.OutputType.ConsoleApplicaton;


            Form1StringResources.SetTextForAllControls(this);
            Form1StringResources.SetTextForAllControls(this.contextMenuStrip1);
            Form1StringResources.SetTextForAllControls(this.cmEditor);
            PascalABCCompiler.StringResources.SetTextForAllObjects(UserOptionsForm1, "VP_OPTFORM_");
            PascalABCCompiler.StringResources.SetTextForAllObjects(CompileOptionsForm1, "VP_COMPOPTFORM_");
            PascalABCCompiler.StringResources.SetTextForAllObjects(AboutBox1, "VP_ABOUTBOXFORM_");
            PascalABCCompiler.StringResources.SetTextForAllObjects(FindForm, "VP_FINDFORM_");
            PascalABCCompiler.StringResources.SetTextForAllObjects(ReplaceForm, "VP_REPLACEFORM_");

            tsatConsoleApplication.Tag = PascalABCCompiler.CompilerOptions.OutputType.ConsoleApplicaton;
            tsatWindowsApplication.Tag = PascalABCCompiler.CompilerOptions.OutputType.WindowsApplication;
            tsatDll.Tag = PascalABCCompiler.CompilerOptions.OutputType.ClassLibrary;

            SelectAppType(CompilerOptions1.OutputFileType);

            //ivan
            dbgHelper = new DebugHelper(this);
            //\ivan
            //this.dataGridView1.MinimumSize = new Size(0, Screen.PrimaryScreen.WorkingArea.Height);

        }
 private void CompileTestProgram(object state)
 {
     string fileName = @"C:\PABCWork.NET\Samples\test.pas";
     if (File.Exists(fileName))
     {
         PascalABCCompiler.CompilerOptions co = new PascalABCCompiler.CompilerOptions();
         co.SourceFileName = fileName;
         Compile(co);
     }
 }
 public void StartCompile(PascalABCCompiler.CompilerOptions CompilerOptions)
 {
     compilationStartTime     = DateTime.Now;
     Compiler.CompilerOptions = CompilerOptions;
     Compiler.StartCompile();
 }
        public void Action(OptionsContentAction action)
        {
            PascalABCCompiler.CompilerOptions CompOpt = WorkbenchServiceFactory.BuildService.CompilerOptions;
            UserOptions opt = MainForm.UserOptions;

            switch (action)
            {
            case OptionsContentAction.Show:
                //comboBox1.SelectedItem = comboBox1.Items[0];
                if (!alreadyShown)
                {
                    comboBox1.Items.Clear();
                    comboBox1.Items.Add(PascalABCCompiler.StringResources.Get("VP_MF_AT_CONSOLE"));
                    comboBox1.Items.Add(PascalABCCompiler.StringResources.Get("VP_MF_AT_WINDOWS"));
                    comboBox1.Items.Add(PascalABCCompiler.StringResources.Get("VP_MF_AT_DLL"));
                    switch (CompOpt.OutputFileType)
                    {
                    case PascalABCCompiler.CompilerOptions.OutputType.ConsoleApplicaton:
                        comboBox1.SelectedItem = comboBox1.Items[0];
                        break;

                    case PascalABCCompiler.CompilerOptions.OutputType.WindowsApplication:
                        comboBox1.SelectedItem = comboBox1.Items[1];
                        break;

                    case PascalABCCompiler.CompilerOptions.OutputType.ClassLibrary:
                        comboBox1.SelectedItem = comboBox1.Items[2];
                        break;
                    }
                    checkBox1.Checked            = CompOpt.Debug;
                    cbDeleteExe.Checked          = opt.DeleteEXEAfterExecute;
                    cbDeletePdb.Checked          = opt.DeletePDBAfterExecute;
                    cbUseOutputDirectory.Checked = opt.UseOutputDirectory;
                    cbUseOutputDirectory_CheckedChanged(null, null);
                    tbOutputDirectory.Text         = opt.OutputDirectory;
                    cbUseDllForSystemUnits.Checked = opt.UseDllForSystemUnits;
                    alreadyShown = true;
                }
                break;

            case OptionsContentAction.Ok:
                /*switch (comboBox1.Items.IndexOf(comboBox1.SelectedItem))
                 * {
                 *  case 0:
                 *      CompOpt.OutputFileType = PascalABCCompiler.CompilerOptions.OutputType.ConsoleApplicaton;
                 *      break;
                 *  case 1:
                 *      CompOpt.OutputFileType = PascalABCCompiler.CompilerOptions.OutputType.WindowsApplication;
                 *      break;
                 *  case 2:
                 *      CompOpt.OutputFileType = PascalABCCompiler.CompilerOptions.OutputType.ClassLibrary;
                 *      break;
                 * }*/
                CompOpt.Debug = checkBox1.Checked;
                MainForm.SelectAppType(CompOpt.OutputFileType);
                opt.DeleteEXEAfterExecute = cbDeleteExe.Checked;
                opt.DeletePDBAfterExecute = cbDeletePdb.Checked;
                if (!Directory.Exists(tbOutputDirectory.Text))
                {
                    try
                    {
                        Directory.CreateDirectory(tbOutputDirectory.Text);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, PascalABCCompiler.StringResources.Get("!ERROR_ON_CREATE_DIRECTORY"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                        ActiveControl = tbOutputDirectory;
                        return;
                    }
                }
                opt.UseOutputDirectory   = cbUseOutputDirectory.Checked;
                opt.OutputDirectory      = tbOutputDirectory.Text;
                opt.UseDllForSystemUnits = cbUseDllForSystemUnits.Checked;
                if (opt.UseOutputDirectory)
                {
                    WorkbenchStorage.StandartDirectories[Constants.OutputDirectoryIdent] = opt.OutputDirectory;
                }
                else
                {
                    WorkbenchStorage.StandartDirectories[Constants.OutputDirectoryIdent] = null;
                }
                alreadyShown = false;
                WorkbenchServiceFactory.OptionsService.SaveOptions();
                break;

            case OptionsContentAction.Cancel:
                alreadyShown = false;
                break;
            }
        }