Beispiel #1
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************

        public void OnRun1(CmdLineCmd aCmd)
        {
            String tReadFilePath = @"C:\Prime\DevelopComm\Dev_MsgGen\Files\MassiveMsg.msg";

            MsgGen.InputData tInputData = new MsgGen.InputData();
            MsgGen.Reader.readFromFilePath(tInputData, tReadFilePath);

            MsgGen.Writer.writeToFilePath(
                new MsgGen.OutputFileMsg_CS_Message(),
                tInputData,
                tInputData.mWriteFilePathCSMessage);

            MsgGen.Writer.writeToFilePath(
                new MsgGen.OutputFileMsg_CS_Body(),
                tInputData,
                tInputData.mWriteFilePathCSBody);

            MsgGen.Writer.writeToFilePath(
                new MsgGen.OutputFileMsg_CH(),
                tInputData,
                tInputData.mWriteFilePathCH);

            MsgGen.Writer.writeToFilePath(
                new MsgGen.OutputFileMsg_CP(),
                tInputData,
                tInputData.mWriteFilePathCP);
        }
Beispiel #2
0
        //**********************************************************************

        public override void execute(CmdLineCmd aCmd)
        {
            if (aCmd.isCmd("TX"))
            {
                ExecuteTx(aCmd);
            }
            if (aCmd.isCmd("GO1"))
            {
                ExecuteGo1(aCmd);
            }
            if (aCmd.isCmd("GO2"))
            {
                ExecuteGo2(aCmd);
            }
            if (aCmd.isCmd("GO3"))
            {
                ExecuteGo3(aCmd);
            }
            if (aCmd.isCmd("GO4"))
            {
                ExecuteGo4(aCmd);
            }
            if (aCmd.isCmd("GO5"))
            {
                ExecuteGo5(aCmd);
            }
        }
        //---------------------------------------------------------------------------
        // Execute

        public override void execute(CmdLineCmd aCmd)
        {
            // Read Members
            if (aCmd.isCmd("Code1"))
            {
                mCode1 = aCmd.argInt(1);
            }
            if (aCmd.isCmd("Code2"))
            {
                mCode2 = aCmd.argInt(1);
            }
            if (aCmd.isCmd("Code3"))
            {
                mCode3 = aCmd.argInt(1);
            }
            if (aCmd.isCmd("Code4"))
            {
                mCode4 = aCmd.argInt(1);
            }

            if (aCmd.isCmd("Command1"))
            {
                executeCommand1(aCmd);
            }
            if (aCmd.isComment())
            {
                executeIsComment(aCmd);
            }
        }
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************

        public void processRecordArray(CmdLineCmd aCmd)
        {
            //******************************************************************
            String tArraySize = aCmd.argString(2).Trim('[', ']');

            //******************************************************************
            MemberData tMember1 = new MemberData(Defs.cMemberT_Int32);

            tMember1.mName         = aCmd.argString(1) + "Loop";
            tMember1.mInitialValue = tArraySize;
            tMember1.mIsArrayIndex = true;

            if (mPreCommentList.Count > 0)
            {
                tMember1.addPreCommentList(mPreCommentList);
                mPreCommentList = new List <String>();
            }

            mBlockData.addMember(tMember1);

            //******************************************************************
            MemberData tMember2 = new MemberData(Defs.cMemberT_Record);

            tMember2.mTypeNameCP = aCmd.argString(0);
            tMember2.mTypeNameCS = aCmd.argString(0);
            tMember2.mName       = aCmd.argString(1);

            tMember2.mName      = aCmd.argString(1);
            tMember2.mIsArray   = true;
            tMember2.mArraySize = tArraySize;

            mBlockData.addMember(tMember2);
        }
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************

        public void processMemberArray(int aMemberType, CmdLineCmd aCmd)
        {
            //******************************************************************
            String tArraySize = aCmd.argString(2).Trim('[', ']');

            //******************************************************************
            MemberData tMember1 = new MemberData(Defs.cMemberT_Int32);

            tMember1.mName         = aCmd.argString(1) + "Loop";
            tMember1.mInitialValue = tArraySize;
            tMember1.mIsArrayIndex = true;

            if (mPreCommentList.Count > 0)
            {
                tMember1.addPreCommentList(mPreCommentList);
                mPreCommentList = new List <String>();
            }

            tMember1.addPostComment(aCmd.comment());

            mBlockData.addMember(tMember1);

            //******************************************************************
            MemberData tMember2 = new MemberData(aMemberType);

            tMember2.mName      = aCmd.argString(1);
            tMember2.mIsArray   = true;
            tMember2.mArraySize = tArraySize;

            mBlockData.addMember(tMember2);
        }
        //**********************************************************************

        public void executeGo1(CmdLineCmd aCmd)
        {
            string tString = aCmd.argString(1);
            bool   tPass   = MyFunctions.IsValidIPAddress(tString);

            Prn.print(0, "{0} {1}", tString, tPass);
        }
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************

        public void processMemberSingle(int aMemberType, CmdLineCmd aCmd)
        {
            MemberData tMember = new MemberData(aMemberType);

            tMember.mName = aCmd.argString(1);

            if (aCmd.isArgString(2, "="))
            {
                if (aMemberType != Defs.cMemberT_String)
                {
                    tMember.mInitialValue = aCmd.argString(3);
                }
                else
                {
                    tMember.mInitialValue = "\"" + aCmd.argString(3) + "\"";
                }
            }

            if (mPreCommentList.Count > 0)
            {
                tMember.addPreCommentList(mPreCommentList);
                mPreCommentList = new List <String>();
            }

            tMember.addPostComment(aCmd.comment());

            mBlockData.addMember(tMember);
        }
        //**********************************************************************

        public override void execute(CmdLineCmd aCmd)
        {
            if (aCmd.isCmd("READ"))
            {
                executeRead(aCmd);
            }
            if (aCmd.isCmd("GO1"))
            {
                executeGo1(aCmd);
            }
            if (aCmd.isCmd("GO2"))
            {
                executeGo2(aCmd);
            }
            if (aCmd.isCmd("GO3"))
            {
                executeGo3(aCmd);
            }
            if (aCmd.isCmd("GO4"))
            {
                executeGo4(aCmd);
            }
            if (aCmd.isCmd("GO5"))
            {
                executeGo5(aCmd);
            }

            if (aCmd.isComment())
            {
                executeIsComment(aCmd);
            }
        }
Beispiel #9
0
        //**********************************************************************

        public override void execute(CmdLineCmd aCmd)
        {
            if (aCmd.isCmd("RUN1"))
            {
                OnRun1(aCmd);
            }
            if (aCmd.isCmd("RUN2"))
            {
                OnRun2(aCmd);
            }
            if (aCmd.isCmd("GO1"))
            {
                OnGo1(aCmd);
            }
            if (aCmd.isCmd("GO2"))
            {
                OnGo2(aCmd);
            }
            if (aCmd.isCmd("GO3"))
            {
                OnGo3(aCmd);
            }
            if (aCmd.isCmd("GO4"))
            {
                OnGo4(aCmd);
            }
            if (aCmd.isCmd("GO5"))
            {
                OnGo5(aCmd);
            }
        }
Beispiel #10
0
        //**********************************************************************

        public void ExecuteGo5(CmdLineCmd aCmd)
        {
            aCmd.setArgDefault(1, 0x10);

            UInt64 tN = aCmd.argUInt64(1);

            Console.WriteLine("0x{0,16:X}", tN);
        }
Beispiel #11
0
        //**********************************************************************

        public void ExecuteGo2(CmdLineCmd aCmd)
        {
            aCmd.setArgDefault(1, "aaaaaaa");
            aCmd.setArgDefault(2, 111);
            aCmd.setArgDefault(3, 22.22);

            Console.WriteLine("{0} {1} {2}", aCmd.argString(1), aCmd.argInt(2), aCmd.argDouble(3));
        }
Beispiel #12
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************

        public void OnGo4(CmdLineCmd aCmd)
        {
            aCmd.setArgDefault(1, 101);

            UInt16 tN = aCmd.argUInt16(1);

            Console.WriteLine("{0}", tN);
        }
Beispiel #13
0
        //**********************************************************************

        public void executeGo5(CmdLineCmd aCmd)
        {
            aCmd.setArgDefault(1, 101);
            int tX = aCmd.argInt(1);

            Console.WriteLine("X       {0}", tX);
            Console.WriteLine("Comment {0} {1}", aCmd.hasComment(), aCmd.comment());
        }
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************

        public void executeGo8(CmdLineCmd aCmd)
        {
            for (int i = 1; i < 10; i++)
            {
                string tPort = string.Format("COM{0}", i);
                Console.WriteLine("{0}", tPort);
            }
        }
Beispiel #15
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************

        public void processBegin(CmdLineCmd aCmd)
        {
            if (mBlockValid == true)
            {
                return;
            }

            mBlockValid = true;
        }
Beispiel #16
0
        //**********************************************************************

        public void OnGo4(CmdLineCmd aCmd)
        {
            String tReadFilePath  = @"C:\Prime\DevelopComm\Dev_MsgGen\Files\MassiveMsg.msg";
            String tWriteFilePath = @"C:\Prime\DevelopComm\Dev_MsgGen\\MassiveCS\Source\MassiveMsgBody.cs";

            MsgGen.InputData tInputData = new MsgGen.InputData();
            MsgGen.Reader.readFromFilePath(tInputData, tReadFilePath);
            MsgGen.Writer.writeToFilePath(new MsgGen.OutputFileMsg_CS_Body(), tInputData, tWriteFilePath);
        }
Beispiel #17
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************

        public void processEnd(CmdLineCmd aCmd)
        {
            if (mBlockValid == false)
            {
                return;
            }

            mInputData.addBlock(mBlockData);
            mBlockValid = false;
        }
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************

        public void executeGo4(CmdLineCmd aCmd)
        {
            string tX1 = "101.1";
            string tX2 = string.Intern(tX1);

            Console.WriteLine("X1 {0}", tX1);
            Console.WriteLine("X2 {0}", tX2);

            tX1 = "201.2";
            Console.WriteLine("X1 {0}", tX1);
            Console.WriteLine("X2 {0}", tX2);
        }
Beispiel #19
0
        public void processIncludeCP(CmdLineCmd aCmd)
        {
            if (mBlockValid == true)
            {
                return;
            }
            if (aCmd.NumArg < 1)
            {
                return;
            }

            mInputData.mFileHeaderData.mIncludeCPList.Add(aCmd.argString(1));
        }
Beispiel #20
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************

        public void OnGo1(CmdLineCmd aCmd)
        {
            aCmd.setArgDefault(1, 1);
            int tN = aCmd.argInt(1);

            System.Random tRandom = new Random();

            for (int i = 0; i < tN; i++)
            {
                double tX = tRandom.NextDouble();
                Console.WriteLine("{0}  X = {1}", i, tX);
            }
        }
Beispiel #21
0
        public void processDefineCH(CmdLineCmd aCmd)
        {
            if (mBlockValid == true)
            {
                return;
            }
            if (aCmd.NumArg < 1)
            {
                return;
            }

            mInputData.mFileHeaderData.mDefineCH = aCmd.argString(1);
        }
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************

        public void executeGo5(CmdLineCmd aCmd)
        {
            StringBuilder tX1 = new StringBuilder("tX1");
            StringBuilder tX2 = tX1;

            Console.WriteLine("X1 {0}", tX1);
            Console.WriteLine("X2 {0}", tX2);

            tX1.Clear();
            tX1.Append("111");

            Console.WriteLine("X1 {0}", tX1);
            Console.WriteLine("X2 {0}", tX2);
        }
Beispiel #23
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************

        public void processPreComment(CmdLineCmd aCmd)
        {
            String tComment = aCmd.comment();

            if (tComment.Length < 3)
            {
                return;
            }
            if (tComment[2].Equals('*'))
            {
                return;
            }

            mPreCommentList.Add(tComment);
        }
Beispiel #24
0
        //**********************************************************************

        public void ExecuteTx(CmdLineCmd aCmd)
        {
            aCmd.setArgDefault(1, 1);
            int tMsgType = aCmd.argInt(1);

            switch (tMsgType)
            {
            case 1:
            {
                TestMsg tMsg = new TestMsg();
                Helper.initialize(tMsg);
                Global.mNetworkThread.sendMsg(tMsg);
                break;
            }

            case 2:
            {
                FirstMessageMsg tMsg = new FirstMessageMsg();
                Helper.initialize(tMsg);
                Global.mNetworkThread.sendMsg(tMsg);
                break;
            }

            case 3:
            {
                StatusRequestMsg tMsg = new StatusRequestMsg();
                Helper.initialize(tMsg);
                Global.mNetworkThread.sendMsg(tMsg);
                break;
            }

            case 4:
            {
                StatusResponseMsg tMsg = new StatusResponseMsg();
                Helper.initialize(tMsg);
                Global.mNetworkThread.sendMsg(tMsg);
                break;
            }

            case 5:
            {
                DataMsg tMsg = new DataMsg();
                Helper.initialize(tMsg);
                Global.mNetworkThread.sendMsg(tMsg);
                break;
            }
            }
        }
Beispiel #25
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************

        public void processRecord(CmdLineCmd aCmd)
        {
            if (mBlockValid == false)
            {
                return;
            }

            if (aCmd.argString(2).StartsWith("[") == false)
            {
                processRecordSingle(aCmd);
            }
            else
            {
                processRecordArray(aCmd);
            }
        }
Beispiel #26
0
        //**********************************************************************

        public void ExecuteGo4(CmdLineCmd aCmd)
        {
            ByteBuffer tBuffer = new ByteBuffer(1000);
            DataMsg    tTxMsg  = new DataMsg();
            DataMsg    tRxMsg  = null;

            Helper.initialize(tTxMsg);

            MsgMonkey tMonkey = new MsgMonkey();

            tMonkey.putMsgToBuffer(tBuffer, tTxMsg);
            tBuffer.rewind();
            tRxMsg = (DataMsg)tMonkey.makeMsgFromBuffer(tBuffer);

            Helper.show(tRxMsg);
        }
Beispiel #27
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************

        public void processMember(int aMemberType, CmdLineCmd aCmd)
        {
            if (mBlockValid == false)
            {
                return;
            }

            if (aCmd.argString(2).StartsWith("[") == false)
            {
                processMemberSingle(aMemberType, aCmd);
            }
            else
            {
                processMemberArray(aMemberType, aCmd);
            }
        }
Beispiel #28
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************

        public void OnRun2(CmdLineCmd aCmd)
        {
            String tReadFilePath = @"C:\Prime\DevelopComm\Dev_MsgGen\Files\MassiveMsg.msg";

            String tWriteFilePathCSMessage = @"C:\Prime\DevelopComm\Dev_MsgGen\MassiveCS\Source\MassiveMsgMessage.cs";
            String tWriteFilePathCSBody    = @"C:\Prime\DevelopComm\Dev_MsgGen\MassiveCS\Source\MassiveMsgBody.cs";
            String tWriteFilePathCH        = @"C:\Prime\DevelopComm\Dev_MsgGen\MassiveCP\Source\massiveMsg.h";
            String tWriteFilePathCP        = @"C:\Prime\DevelopComm\Dev_MsgGen\MassiveCP\Source\massiveMsg.cpp";

            MsgGen.InputData tInputData = new MsgGen.InputData();
            MsgGen.Reader.readFromFilePath(tInputData, tReadFilePath);

            MsgGen.Writer.writeToFilePath(new MsgGen.OutputFileMsg_CS_Message(), tInputData, tWriteFilePathCSMessage);
            MsgGen.Writer.writeToFilePath(new MsgGen.OutputFileMsg_CS_Body(), tInputData, tWriteFilePathCSBody);
            MsgGen.Writer.writeToFilePath(new MsgGen.OutputFileMsg_CH(), tInputData, tWriteFilePathCH);
            MsgGen.Writer.writeToFilePath(new MsgGen.OutputFileMsg_CP(), tInputData, tWriteFilePathCP);
        }
Beispiel #29
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************

        public void processConst(CmdLineCmd aCmd)
        {
            ConstData tConst = new ConstData();

            tConst.mName = aCmd.argString(1);

            if (aCmd.isArgString(2, "="))
            {
                tConst.mInitialValue = aCmd.argString(3);
            }

            tConst.addPreCommentList(mPreCommentList);
            mPreCommentList = new List <String>();

            tConst.addPostComment(aCmd.comment());

            mBlockData.addConst(tConst);
        }
Beispiel #30
0
        //**********************************************************************
        //**********************************************************************
        //**********************************************************************

        public void processBlock(int aBlockType, CmdLineCmd aCmd)
        {
            if (mBlockValid == true)
            {
                return;
            }

            mBlockData            = new BlockData();
            mBlockData.mBlockType = aBlockType;
            mBlockData.mName      = aCmd.argString(1);
            mBlockValid           = false;

            if (mPreCommentList.Count > 0)
            {
                mBlockData.addPreCommentList(mPreCommentList);
                mPreCommentList = new List <String>();
            }
        }
Beispiel #31
0
 public CmdInfo(CmdLineCmd cmd, string help) : this() { this.cmd = cmd; this.help = help; }