Exemple #1
0
        /// <summary>
        /// Setup to run with customised launch options
        /// </summary>
        /// <param name="configuration"></param>
        /// <returns>Ready to run?</returns>
        ///
        private bool _PreStart(string code, Config.RunConfiguration configuration, string fileName)
        {
            this.code = code;
            if (null == core)
            {
                core = new ProtoCore.Core(new ProtoCore.Options {
                    IDEDebugMode = true
                });
                core.Compilers.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Compiler(core));
                core.Compilers.Add(ProtoCore.Language.kImperative, new ProtoImperative.Compiler(core));
            }


            if (null != fileName)
            {
                core.CurrentDSFileName          = Path.GetFullPath(fileName);
                core.Options.RootModulePathName = Path.GetFullPath(fileName);
            }

            //Run the compilation process
            if (Compile(out resumeBlockID))
            {
                inited      = true;
                runtimeCore = CreateRuntimeCore(core);

                FirstExec();
                diList = BuildReverseIndex();
                return(true);
            }
            else
            {
                inited = false;
                return(false);
            }
        }
        /// <summary>
        /// Setup to run with customised launch options
        /// </summary>
        /// <param name="configuration"></param>
        /// <returns>Ready to run?</returns>
        ///
        private bool _PreStart(string code, Config.RunConfiguration configuration, string fileName)
        {
            this.code = code;
            if (null == core)
            {
                core = new ProtoCore.Core(new ProtoCore.Options {
                    IDEDebugMode = true
                });

                //Register the default executives
                //@TODO(Luke) this will need generaling to support dynamic loading of executives
                core.Executives.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Executive(core));
                core.Executives.Add(ProtoCore.Language.kImperative, new ProtoImperative.Executive(core));
            }

            if (null != fileName)
            {
                core.CurrentDSFileName          = Path.GetFullPath(fileName);
                core.Options.RootModulePathName = Path.GetFullPath(fileName);
            }

            //Run the compilation process
            compileState = Compile(out resumeBlockID);
            compileState.CurrentDSFileName = fileName;
            if (compileState.compileSucceeded)
            {
                inited = true;
                core.NotifyExecutionEvent(ProtoCore.ExecutionStateEventArgs.State.kExecutionBegin);

                //int blockId = ProtoCore.DSASM.Constants.kInvalidIndex;
                //core.runningBlock = blockId;

                FirstExec();
                diList = BuildReverseIndex();
                return(true);
            }
            else
            {
                inited      = false;
                invalidated = true;

                return(false);
            }
        }
Exemple #3
0
        /// <summary>
        /// Setup to run with customised launch options
        /// </summary>
        /// <param name="configuration"></param>
        /// <returns>Ready to run?</returns>
        ///
        private bool _PreStart(string code, Config.RunConfiguration configuration, string fileName)
        {
            this.code = code;
            if (null == core)
            {
                core = new ProtoCore.Core(new ProtoCore.Options {
                    IDEDebugMode = true
                });
                core.Compilers.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Compiler(core));
                core.Compilers.Add(ProtoCore.Language.kImperative, new ProtoImperative.Compiler(core));
            }

            runtimeCore = core.__TempCoreHostForRefactoring;
            runtimeCore.RuntimeStatus.MessageHandler = core.BuildStatus.MessageHandler;

            if (null != fileName)
            {
                core.CurrentDSFileName          = Path.GetFullPath(fileName);
                core.Options.RootModulePathName = Path.GetFullPath(fileName);
            }

            //Run the compilation process
            if (Compile(out resumeBlockID))
            {
                inited = true;

                //int blockId = ProtoCore.DSASM.Constants.kInvalidIndex;
                //core.runningBlock = blockId;

                ProtoCore.Runtime.Context context = new ProtoCore.Runtime.Context();
                runtimeCore.SetProperties(core.Options, core.DSExecutable, core.DebuggerProperties, context, core.ExprInterpreterExe);
                runtimeCore.NotifyExecutionEvent(ProtoCore.ExecutionStateEventArgs.State.kExecutionBegin);

                FirstExec();
                diList = BuildReverseIndex();
                return(true);
            }
            else
            {
                inited = false;
                return(false);
            }
        }
Exemple #4
0
        /// <summary>
        /// Setup to run with customised launch options
        /// </summary>
        /// <param name="configuration"></param>
        /// <returns>Ready to run?</returns>
        ///
        private bool _PreStart(string code, Config.RunConfiguration configuration, string fileName)
        {
            this.code = code;
            if (null == core)
            {
                core = new ProtoCore.Core(new ProtoCore.Options {
                    IDEDebugMode = true
                });
                core.Compilers.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Compiler(core));
                core.Compilers.Add(ProtoCore.Language.kImperative, new ProtoImperative.Compiler(core));
            }

            if (null != fileName)
            {
                core.CurrentDSFileName          = Path.GetFullPath(fileName);
                core.Options.RootModulePathName = Path.GetFullPath(fileName);
            }

            //Run the compilation process
            if (Compile(out resumeBlockID))
            {
                inited = true;
                core.NotifyExecutionEvent(ProtoCore.ExecutionStateEventArgs.State.kExecutionBegin);

                //int blockId = ProtoCore.DSASM.Constants.kInvalidIndex;
                //core.runningBlock = blockId;

                FirstExec();
                diList = BuildReverseIndex();
                return(true);
            }
            else
            {
                inited = false;
                return(false);
            }
        }
Exemple #5
0
 public bool LoadAndPreStart(string src, Config.RunConfiguration configuration = new Config.RunConfiguration())
 {
     return(_PreStart(File.ReadAllText(src), configuration, src));
 }
Exemple #6
0
 public bool PreStart(string src, Config.RunConfiguration configuration = new Config.RunConfiguration())
 {
     return(_PreStart(src, configuration, null));
 }