Пример #1
0
        /// <summary>
        /// BuildPasses is where the plug-in creates and initializes its pass object(s), and
        /// inserts them into the pass list already created by the c2 host.
        /// </summary>
        public override void BuildPasses(Phx.Passes.PassConfiguration passConfiguration)
        {
            Phx.Passes.Pass basePass = passConfiguration.PassList.FindByName("C2 Pass 0");
            if (basePass == null)
            {
                Phx.Output.WriteLine("C2 Pass 0 not found in passlist:");
                Phx.Output.Write(passConfiguration.ToString());
                return;
            }

            GameTimePass newPass = GameTimePass.New(passConfiguration);

            basePass.InsertAfter(newPass);
        }
Пример #2
0
        /// <summary>
        /// New creates an instance of a pass. Following Phoenix guidelines, New is static.
        /// </summary>
        ///
        /// <param name="config">Pointer to a Passes::PassConfiguration that provides
        /// properties for retrieving the initial pass list.</param>
        /// <returns>A pointer to the new pass.</returns>
        static public GameTimePass New(Phx.Passes.PassConfiguration config)
        {
            GameTimePass pass = new GameTimePass();

            Phx.Graphs.CallGraphProcessOrder order = Phx.Graphs.CallGraphProcessOrder.BottomUp;
            pass.Initialize(config, order, passName);

            /* Set its pass control. */
            pass.PassControl = GameTimePass.gameTimeControl;

            /* Build the PhaseList with only 2 phases: C2::Phases::CxxILReaderPhase and Phase.
             * You can add more phases to the new pass here. */
            Phx.Phases.PhaseConfiguration phaseConfiguration =
                Phx.Phases.PhaseConfiguration.New(pass.Configuration.Lifetime, "GameTime Phase");

            Phx.Phases.PhaseList phaseList =
                C2.Phases.Builder.BuildPreCompilePhaseList(phaseConfiguration);
            phaseConfiguration.PhaseList.AppendPhase(phaseList);

            pass.PhaseConfigurationNative = phaseConfiguration;
            pass.PhaseConfiguration       = phaseConfiguration;

            return(pass);
        }