コード例 #1
0
ファイル: BatchVerifyVerb.cs プロジェクト: jango2015/Ironclad
        public BatchVerifyVerb(SourcePath batch_file, BatchMode mode, VerificationRequest verificationRequest, DafnyCCVerb.FramePointerMode useFramePointer)
        {
            this.mode = mode;

            this.producers = new HashSet<IObligationsProducer>();
            foreach (string line in File.ReadAllLines(IronRootDirectory.PathTo(batch_file)))
            {
                if (line.Equals("") || line[0] == '#')
                {
                    continue;
                }

                SourcePath src = new SourcePath(line);
                switch (mode)
                {
                    case BatchMode.DAFNY:
                        if (verificationRequest.verifyMode != VerificationRequest.VerifyMode.Verify)
                        {
                            throw new UserError("BatchVerify DAFNY only supports full verification (but maybe we should add selective?)");
                        }

                        this.producers.Add(new DafnyVerifyTreeVerb(src));
                        break;
                    case BatchMode.APP:
                        this.producers.Add(new IroncladAppVerb(src, IroncladAppVerb.TARGET.BARE_METAL, useFramePointer, verificationRequest));
                        break;
                    default:
                        throw new Exception("Unknown batch file type");
                }
            }

            string parameters = mode.ToString() + "," + verificationRequest.ToString();
            this.outputObject = batch_file.makeLabeledOutputObject(parameters, BATCH_EXTN + VerificationObligationList.VOL_EXTN);
            this.abstractId = new AbstractId(this.GetType().Name, version, batch_file.ToString(), concrete: parameters);
        }
コード例 #2
0
 public static BatchExperimentTemplate Create(BatchMode batchMode)
 {
     return(new BatchExperimentTemplate()
     {
         BatchMode = batchMode
     });
 }
コード例 #3
0
        private IEnumerable <IResult> InnerUpload(BatchMode mode)
        {
            if (!CanUpload)
            {
                yield break;
            }

            var haveOrders = Address.ActiveOrders().Any();

            if (haveOrders && !Confirm("После успешной отправки дефектуры будут заморожены текущие заказы.\r\n" +
                                       "Продолжить?"))
            {
                yield break;
            }

            var dialog = new OpenFileResult();

            //если установить директорию на не существующем диске диалог не будет отображен
            if (Directory.Exists(lastUsedDir))
            {
                dialog.Dialog.InitialDirectory = lastUsedDir;
            }
            yield return(dialog);

            lastUsedDir = Path.GetDirectoryName(dialog.Dialog.FileName) ?? lastUsedDir;
            foreach (var result in Shell.Batch(dialog.Dialog.FileName, mode))
            {
                yield return(result);
            }
        }
コード例 #4
0
        public BatchVerifyVerb(SourcePath batch_file, BatchMode mode, VerificationRequest verificationRequest, DafnyCCVerb.FramePointerMode useFramePointer)
        {
            this.mode = mode;

            this.producers = new HashSet<IObligationsProducer>();
            foreach (string line in File.ReadAllLines(batch_file.getFilesystemPath())) {
                if (line[0] == '#')
                {
                    continue;
                }
                SourcePath src = new SourcePath(line);
                switch (mode) {
                    case BatchMode.DAFNY:
                        if (verificationRequest.verifyMode != VerificationRequest.VerifyMode.Verify)
                        {
                            throw new UserError("BatchVerify DAFNY only supports full verification (but maybe we should add selective?)");
                        }
                        this.producers.Add(new DafnyVerifyTreeVerb(src));
                        break;
                    case BatchMode.APP:
                        this.producers.Add(new IroncladAppVerb(src, IroncladAppVerb.TARGET.BARE_METAL, useFramePointer, verificationRequest));
                        break;
                    default:
                        throw new Exception("Unknown batch file type");
                }
            }

            string parameters = mode.ToString() + "," + verificationRequest.ToString();
            outputObject = batch_file.makeLabeledOutputObject(parameters, BATCH_EXTN + VerificationObligationList.VOL_EXTN);
            abstractId = new AbstractId(this.GetType().Name, version, batch_file.ToString(), concrete:parameters);
        }
コード例 #5
0
        public BatchVerifyVerb(BuildObject batch_label, HashSet<IObligationsProducer> producers, BatchMode mode) {            
            this.mode = mode;
            this.producers = producers;

            outputObject = batch_label.makeOutputObject(BATCH_EXTN + VerificationObligationList.VOL_EXTN);
            abstractId = new AbstractId(this.GetType().Name, version, batch_label.ToString(), concrete:mode.ToString());            
        }
コード例 #6
0
ファイル: BatchVerifyVerb.cs プロジェクト: jango2015/Ironclad
        public BatchVerifyVerb(BuildObject batch_label, HashSet<IObligationsProducer> producers, BatchMode mode)
        {
            this.mode = mode;
            this.producers = producers;

            this.outputObject = batch_label.makeOutputObject(BATCH_EXTN + VerificationObligationList.VOL_EXTN);
            this.abstractId = new AbstractId(this.GetType().Name, version, batch_label.ToString(), concrete: mode.ToString());
        }
コード例 #7
0
        /// <summary>
        /// Batches the current IEnumerable into multiple lists.
        /// </summary>
        /// <typeparam name="T">
        /// The type of the elements in the IEnumerable.
        /// </typeparam>
        /// <param name="col">
        /// The current IEnumerable which should be splitted in smaller
        /// batches.
        /// </param>
        /// <param name="batchSize">
        /// BatchMode.ByBatchCount (default): The amount of batches the
        /// enumerable should be splitted into. /// BatchMode.ByElementCount:
        /// The amount of elements which should be placed into each batch.
        /// </param>
        /// <param name="mode">
        /// A flag indicating whether you want to batch the enumerable into n
        /// (=batchSize) own lists which would be BatchMode.ByBatchCount or in
        /// n (=unknown) lists where all consists of maximum m (=batchSize)
        /// elements.
        /// </param>
        /// <returns>
        /// A list of all batches.
        /// </returns>
        public static List <List <T> > Batch <T>(
            this IEnumerable <T> col,
            int batchSize,
            BatchMode mode = BatchMode.ByBatchCount)
        {
            List <List <T> > splitted    = new List <List <T> >();
            List <T>         currentList = null;
            int idx = 0;

            if (mode == BatchMode.ByBatchCount)
            {
                for (int i = 0; i < batchSize; i++)
                {
                    splitted.Add(new List <T>());
                }

                int listIdx          = 0;
                int totalItems       = col.Count();
                int elementsPerBatch = totalItems / batchSize;

                foreach (T item in col)
                {
                    if (idx >= elementsPerBatch)
                    {
                        idx     = 0;
                        listIdx = listIdx + 1 < batchSize
                            ? listIdx + 1 : batchSize - 1;
                    }

                    currentList = splitted[listIdx];
                    currentList.Add(item);

                    idx++;
                }
            }
            else if (mode == BatchMode.ByElementCount)
            {
                foreach (T item in col)
                {
                    if (idx == 0 || idx == batchSize)
                    {
                        idx         = 0;
                        currentList = new List <T>(batchSize);
                        splitted.Add(currentList);
                    }

                    currentList.Add(item);

                    idx++;
                }
            }
            else
            {
                throw new NotImplementedException();
            }

            return(splitted);
        }
コード例 #8
0
 private static SpriteBatch GetSpriteBatch(BatchMode mode)
 {
     if (batchMode != mode)
     {
         EndBatch();
         BeginSpriteBatch(spriteBatch, blendMode, matrix, mode);
     }
     return(spriteBatch);
 }
コード例 #9
0
        public void Begin(BatchMode batchMode = BatchMode.DrawOrder, BlendState blendState = null, SamplerState sampler = null, DepthStencilState depthStencil = null, RasterizerState rasterizer = null, Matrix?transform = null)
        {
            BatchMode         = batchMode;
            BlendState        = blendState ?? BlendState.AlphaBlend;
            SamplerState      = sampler ?? SamplerState.PointClamp;
            DepthStencilState = depthStencil ?? DepthStencilState.None;
            RasterizerState   = rasterizer ?? RasterizerState.CullNone;
            Transform         = transform ?? Matrix.Identity;

            IsBatching = true;
        }
コード例 #10
0
    void OnEnable()
    {
        myTarget = (LevelEditorGrid)target;

        if (!Application.isPlaying)
        {
            Tools.current = Tool.View;
            leftAlt       = false;
            batchMode     = BatchMode.None;
        }
    }
コード例 #11
0
 /// <summary>
 /// Revision 3 constructor
 /// </summary>
 /// <param name="channelId">two ASCII characters, range 00-99</param>
 /// <param name="programId">parameter set ID or Multistage ID, three ASCII characters, range 000-999</param>
 /// <param name="autoSelect">One ASCII character,
 ///     <para>0=None</para>
 ///     <para>1=Auto Next Change</para>
 ///     <para>2=I/O</para>
 ///     <para>6=Fieldbus</para>
 ///     <para>8=Socket tray</para>
 /// </param>
 /// <param name="batchSize">Two ASCII characters, range 00-99</param>
 /// <param name="maxCoherentNok">Two ASCII characters, range 00-99</param>
 /// <param name="batchCounter">Two ASCII characters, range 00-99</param>
 /// <param name="identifierNumber">Four ASCII characters, range 0000-9999 (Socket(s), EndFitting(s)…)</param>
 /// <param name="jobStepName">25 ASCII characters</param>
 /// <param name="jobStepType">Two ASCII characters, range 00-99</param>
 /// <param name="toolLoosening">1 ASCII character.
 ///     <para>0=Enable</para>
 ///     <para>1=Disable</para>
 ///     <para>2=Enable only on NOK tightening</para>
 /// </param>
 /// <param name="jobBatchMode">1 ASCII character.
 ///     <para>0=only the OK tightenings are counted</para>
 ///     <para>1=both the OK and NOK tightenings are counted</para>
 /// </param>
 /// <param name="batchStatusAtIncrement">1 ASCII character. Batch status after performing an increment or a bypass parameter set:
 ///     <para>0=OK</para>
 ///     <para>1=NOK</para>
 /// </param>
 /// <param name="decrementBatchAfterLoosening">1 ASCII character.
 ///     <para>0=Never</para>
 ///     <para>1=Always</para>
 ///     <para>2=After OK</para>
 /// </param>
 /// <param name="currentBatchStatus">1 ASCII character:
 ///     <para>0=Not started</para>
 ///     <para>1=OK</para>
 ///     <para>2=NOK</para>
 /// </param>
 public AdvancedJob(int channelId, int programId, AutoSelect autoSelect, int batchSize, int maxCoherentNok, int batchCounter,
                    int identifierNumber, string jobStepName, int jobStepType, ToolLoosening toolLoosening, BatchMode jobBatchMode,
                    BatchStatusAtIncrement batchStatusAtIncrement, DecrementBatchAfterLoosening decrementBatchAfterLoosening, CurrentBatchStatus currentBatchStatus)
     : this(channelId, programId, autoSelect, batchSize, maxCoherentNok, batchCounter, identifierNumber, jobStepName, jobStepType)
 {
     ToolLoosening                = toolLoosening;
     JobBatchMode                 = jobBatchMode;
     BatchStatusAtIncrement       = batchStatusAtIncrement;
     DecrementBatchAfterLoosening = decrementBatchAfterLoosening;
     CurrentBatchStatus           = currentBatchStatus;
 }
コード例 #12
0
        private void EndBatch()
        {
            if (batchMode == BatchMode.Geometry)
            {
                basicEffect.World = Matrix.Identity;
                basicEffect.CurrentTechnique.Passes[0].Apply();
            }
            else if (batchMode == BatchMode.Sprite)
            {
                spriteBatch.End();
            }

            batchMode = BatchMode.None;
        }
コード例 #13
0
    void OnEnable()
    {
        script = (LevelDesigner) target;

        if(!Application.isPlaying)
        {
            if (SceneView.lastActiveSceneView != null)
            {
                Tools.current = Tool.View;
                SceneView.lastActiveSceneView.orthographic = true;
                SceneView.lastActiveSceneView.LookAtDirect(SceneView.lastActiveSceneView.pivot,Quaternion.identity);
                leftControl = false;
                batchmode = BatchMode.None;
            }
        }
    }
コード例 #14
0
        private void BeginSpriteBatch(SpriteBatch sb, BlendMode blendMode, Matrix m, BatchMode mode)
        {
            Debug.Assert(mode != BatchMode.None);

            if (mode == BatchMode.Sprite)
            {
                BlendState blendState = toBlendState(blendMode);
                sb.Begin(SpriteSortMode.Immediate, blendState, null, null, null, null, m);
            }
            else if (mode == BatchMode.Geometry)
            {
                basicEffect.World = Matrix.Multiply(camera.WorldMatrix, m);
                basicEffect.CurrentTechnique.Passes[0].Apply();
            }
            batchMode = mode;
        }
コード例 #15
0
ファイル: Program.cs プロジェクト: nhorspool/ARMSim-Windows
        static void Main(string[] args)
        {
            ARMSimArguments parsedArgs = new ARMSimArguments();

            //Batch mode is the simulator running with no UI and standard I/O instead of a console.
            if (args.Length > 0)
            {
                StringBuilder sb = new StringBuilder();
                if (!Parser.ParseArgumentsWithUsage(args, parsedArgs, delegate(string str) { sb.Append(str); sb.Append("\n"); }))
                {
                    MessageBox.Show(sb.ToString(), "Command line parsing Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                parsedArgs.Batch = true;
                bool attachedOK = false;
                if (ARMSim.ARMSimUtil.RunningOnWindows)
                {
                    if (!AttachConsole(ATTACH_PARENT_PROCESS))
                    {
                        attachedOK = AllocConsole();
                    }
                }
                System.Console.WriteLine("\nARMSim# running in batch mode ...");

                // Run with the command-line arguments
                BatchMode.Run(parsedArgs);

                // Let the user know we are stopping
                System.Console.WriteLine("\nARMSim# is exiting");
                if (attachedOK)
                {
                    FreeConsole();
                }
            }
            else
            {
                //Otherwise we run the simulator as a normal GUI application
                parsedArgs.Batch = false;
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                //pass in an empty list of arguments
                Application.Run(new ARMSimForm(parsedArgs));
            }
        } //Main
コード例 #16
0
        private static void EndBatch()
        {
            //if (batchMode == BatchMode.BasicEffect)
            //{
            //    basicEffect.World = Matrix.Identity;
            //    basicEffect.CurrentTechnique.Passes[0].Apply();
            //}
            //else
            if (batchMode == BatchMode.Sprite)
            {
                spriteBatch.End();
            }
            else if (batchMode == BatchMode.CustomEffect)
            {
                customEffect = null;
            }

            batchMode = BatchMode.None;
        }
コード例 #17
0
        private static void BeginSpriteBatch(SpriteBatch sb, AppBlendMode blendMode, Matrix m, BatchMode mode)
        {
            Debug.Assert(mode != BatchMode.None);

            if (mode == BatchMode.Sprite)
            {
                BlendState blendState = toBlendState(blendMode);
                sb.Begin(SpriteSortMode.Immediate, blendState, samplerState, null, rasterizerState, drawEffect == null ? null : drawEffect.Effect, m);
            }
            else if (mode == BatchMode.BasicEffect)
            {
                basicEffect.World = Matrix.Multiply(worldMatrix, m);
                basicEffect.CurrentTechnique.Passes[0].Apply();
            }
            else if (mode == BatchMode.CustomEffect)
            {
                customEffect.Parameters["World"].SetValue(Matrix.Multiply(worldMatrix, m));
                customEffect.Parameters["View"].SetValue(viewMatrix);
                customEffect.Parameters["Projection"].SetValue(projection);
                customEffect.CurrentTechnique.Passes[0].Apply();
            }
            batchMode = mode;
        }
コード例 #18
0
        private void BeginSpriteBatch(SpriteBatch sb, BlendMode blendMode, Matrix m, BatchMode mode)
        {
            Debug.Assert(mode != BatchMode.None);

            if (mode == BatchMode.Sprite)
            {
                BlendState blendState = toBlendState(blendMode);
                sb.Begin(SpriteSortMode.Immediate, blendState, null, null, null, null, m);
            }
            else if (mode == BatchMode.Geometry)
            {
                basicEffect.World = Matrix.Multiply(camera.WorldMatrix, m);
                basicEffect.CurrentTechnique.Passes[0].Apply();
            }
            batchMode = mode;
        }
コード例 #19
0
 private SpriteBatch GetSpriteBatch(BatchMode mode)
 {
     if (batchMode != mode)
     {
         EndBatch();
         BeginSpriteBatch(spriteBatch, blendMode, matrix, mode);
     }
     return spriteBatch;
 }
コード例 #20
0
    void OnSceneGUI()
    {
        Ray ray = HandleUtility.GUIPointToWorldRay (Event.current.mousePosition);
        Vector2 tilePos = new Vector2();
        tilePos.x = Mathf.RoundToInt(ray.origin.x);
        tilePos.y = Mathf.RoundToInt(ray.origin.y);

        if (tilePos != oldTilePos)
        {
            script.gizmoPosition = tilePos;
            SceneView.RepaintAll();
            oldTilePos = tilePos;
        }

        Event current = Event.current;

        /*	if (current.keyCode == KeyCode.LeftControl)
        {
            if (current.type == EventType.keyDown)
            {
                leftControl = true;
            }
            else if (current.type == EventType.KeyUp)
            {
                leftControl = false;
                batchmode = BatchMode.None;
            }
        }

        if (leftControl)
        {
            if (current.type == EventType.mouseDown)
            {
                if (current.button == 0)
                {
                    batchmode = BatchMode.Create;
                }
                else if (current.button == 1)
                {
                    batchmode = BatchMode.Delete;
                }

            }
        } */

        if (current.keyCode == KeyCode.C)
        {
            if (current.type == EventType.keyDown)
            {
                batchmode = BatchMode.Create;
            }
            else if (current.type == EventType.KeyUp)
            {
                batchmode = BatchMode.None;
            }
        }

        if (current.keyCode == KeyCode.D)
        {
            if (current.type == EventType.keyDown)
            {
                batchmode = BatchMode.Delete;
            }
            else if (current.type == EventType.KeyUp)
            {
                batchmode = BatchMode.None;
            }
        }

        if ((current.type == EventType.mouseDown) || (batchmode != BatchMode.None))
        {
            string name = string.Format(script.prefab.name + "_{0}_{1}_{2}", script.depth,tilePos.y,tilePos.x);
            if ((current.button == 0) || (batchmode == BatchMode.Create))
            {
                //Create
                CreateTile (tilePos, name);
            }

            if ((current.button == 1) || (batchmode == BatchMode.Delete))
            {
                //Delete
                DeleteTile (name);
            }

            if (current.type == EventType.mouseDown)
            {
                Tools.current = Tool.View;
                SceneView.lastActiveSceneView.orthographic = true;
                SceneView.lastActiveSceneView.LookAtDirect(SceneView.lastActiveSceneView.pivot,Quaternion.identity);
            }
        }

        SetGizmosColor();

        if (GUI.changed)
            EditorUtility.SetDirty(target);
    }
コード例 #21
0
    void OnSceneGUI()
    {
        Ray     ray     = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition);
        Vector3 tilePos = new Vector3();

        tilePos.x = Mathf.RoundToInt(ray.origin.x);
        tilePos.y = Mathf.RoundToInt(ray.origin.y);

        if (tilePos != oldTilePos)
        {
            script.gizmoPosition = tilePos;
            SceneView.RepaintAll();
            oldTilePos = tilePos;
        }

        Event current = Event.current;

        if (current.keyCode == KeyCode.C)
        {
            if (current.type == EventType.keyDown)
            {
                leftControl = true;
            }
            else if (current.type == EventType.keyUp)
            {
                leftControl = false;
                batchmode   = BatchMode.None;
            }
        }

        if (leftControl)
        {
            if (current.type == EventType.mouseDown)
            {
                if (current.button == 0)
                {
                    batchmode = BatchMode.Create;
                }
                else if (current.button == 1)
                {
                    batchmode = BatchMode.Delete;
                }
            }
        }

        if ((current.type == EventType.mouseDown) || (batchmode != BatchMode.None))
        {
            string name = string.Format("Tile{0}_{1}_{2}", script.depth, tilePos.y, tilePos.x);

            if ((current.button == 0) || (batchmode == BatchMode.Create))
            {
                CreateTile(tilePos, name);
            }
            if ((current.button == 1) || (batchmode == BatchMode.Delete))
            {
                DeleteTile(name);
            }

            if (GUI.changed)
            {
                EditorUtility.SetDirty(target);
            }
        }
    }
コード例 #22
0
    void OnSceneGUI()
    {
        Ray     ray     = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition);
        Vector2 tilePos = new Vector2();

        tilePos.x = Mathf.RoundToInt(ray.origin.x / myTarget.height) * myTarget.height;
        tilePos.y = Mathf.RoundToInt(ray.origin.y / myTarget.width) * myTarget.width;

        if (tilePos != oldTilePos)
        {
            myTarget.gizmoPosition = tilePos;
            SceneView.RepaintAll();
            oldTilePos = tilePos;
        }
        SetGizmosColor();
        if (GUI.changed)
        {
            EditorUtility.SetDirty(myTarget);
        }

        Event currentEvent = Event.current;


        switch (currentEvent.keyCode)
        {
        case KeyCode.Alpha2: myTarget.blockType = LevelEditorGrid.BlockType.Normal; break;

        case KeyCode.Alpha1: myTarget.blockType = LevelEditorGrid.BlockType.Left; break;

        case KeyCode.Alpha3: myTarget.blockType = LevelEditorGrid.BlockType.Right; break;

        case KeyCode.Alpha4: myTarget.blockType = LevelEditorGrid.BlockType.FillCollider; break;

        case KeyCode.Alpha5: myTarget.blockType = LevelEditorGrid.BlockType.Fill; break;
        }

        if (currentEvent.keyCode == KeyCode.LeftAlt)
        {
            if (currentEvent.type == EventType.keyDown)
            {
                leftAlt = true;
            }
            else if (currentEvent.type == EventType.keyUp)
            {
                leftAlt   = false;
                batchMode = BatchMode.None;
            }
        }

        if (leftAlt)
        {
            if (currentEvent.type == EventType.mouseDown)
            {
                if (currentEvent.button == 0)
                {
                    batchMode = BatchMode.Create;
                }
                else if (currentEvent.button == 1)
                {
                    batchMode = BatchMode.Delete;
                }
            }
        }

        if (currentEvent.type == EventType.mouseDown || batchMode != BatchMode.None)
        {
            string name = string.Format("Ground[{0}][{1}]", (float)System.Math.Round(tilePos.x, 1), (float)System.Math.Round(tilePos.y, 1));
            if (currentEvent.button == 0 || batchMode == BatchMode.Create)
            {
                CreateTile(tilePos, name);
            }
            if (currentEvent.button == 1 || batchMode == BatchMode.Delete)
            {
                DeleteTile(name);
            }
        }
    }
コード例 #23
0
        private void EndBatch()
        {
            if (batchMode == BatchMode.Geometry)
            {
                basicEffect.World = Matrix.Identity;
                basicEffect.CurrentTechnique.Passes[0].Apply();
            }
            else if (batchMode == BatchMode.Sprite)
            {
                spriteBatch.End();
            }

            batchMode = BatchMode.None;
        }
コード例 #24
0
 public BatchExperiment(BatchMode batchMode)
 {
     this.BatchMode   = batchMode;
     this.experiments = new List <ExperimentBase>();
 }