示例#1
0
        public AstIndependantAxis(LexLocation lexLocation, AstSeq axisHeader, AstSeq graduationItems = null)
        {
            if (axisHeader == null)
            {
                throw new ArgumentNullException(nameof(axisHeader));
            }

            LexLocation     = lexLocation;
            AxisHeader      = axisHeader;
            GraduationItems = graduationItems;
        }
示例#2
0
        public static IAst GetAtIndex(this AstSeq astSeq, int index)
        {
            if (astSeq.Items.Count <= index)
            {
                throw new ParserContextErrorException("Expected another entry. List too short.", astSeq);
            }

            var item = astSeq.Items[index];

            return(item);
        }
示例#3
0
文件: Parser.cs 项目: ngbrown/Mcs3Rob
        private static RobFileHeader ReadRobFileHeader(AstSeq astFileHeader)
        {
            var           robControlUnitType = (RobControlUnitType)astFileHeader.ReadAsInt(2);
            RobFileHeader robFileHeader;

            if (robControlUnitType.HasFlag(RobControlUnitType.CAN))
            {
                robFileHeader = new RobFileHeaderCan()
                {
                    EmulationModuleNumber = astFileHeader.ReadAsInt(0),
                    RomSize                    = astFileHeader.ReadAsInt(1),
                    ControlUnitType            = robControlUnitType,
                    CanBusFrequency            = astFileHeader.ReadAsInt(3),
                    CanEcuNodeId               = astFileHeader.ReadAsInt(4),
                    CanDefaultSamplingInterval = astFileHeader.ReadAsInt(5),
                    CanIdentifierDtoCcp        = astFileHeader.ReadAsInt(6),
                    CanIdentifierCroCcp        = astFileHeader.ReadAsInt(7),
                };
            }
            else if (robControlUnitType.HasFlag(RobControlUnitType.ABUS))
            {
                robFileHeader = new RobFileHeaderAnio()
                {
                    EmulationModuleNumber = astFileHeader.ReadAsInt(0),
                    RomSize                 = astFileHeader.ReadAsInt(1),
                    ControlUnitType         = robControlUnitType,
                    AnioSignalAveragingTime = astFileHeader.ReadAsInt(3),
                    AnioReserved4           = astFileHeader.ReadAsInt(4),
                    AnioScanRate            = astFileHeader.ReadAsInt(5),
                    AnioReserved6           = astFileHeader.ReadAsInt(6),
                    AnioReserved7           = astFileHeader.ReadAsInt(7),
                };
            }
            else
            {
                robFileHeader = new RobFileHeaderRom()
                {
                    EmulationModuleNumber = astFileHeader.ReadAsInt(0),
                    RomSize                  = astFileHeader.ReadAsInt(1),
                    ControlUnitType          = robControlUnitType,
                    RomCycleTriggerAddress   = astFileHeader.ReadAsInt(3),
                    RomReserved4             = astFileHeader.ReadAsInt(4),
                    RomBusMonitoringTimeGate = astFileHeader.ReadAsInt(5),
                    RomReserved6             = astFileHeader.ReadAsInt(6),
                    RomRamOffset             = astFileHeader.ReadAsUInt(7),
                };
            }
            return(robFileHeader);
        }
示例#4
0
        public AstFile(LexLocation lexLocation, AstSeq fileHeader, AstSeq descriptionBlocks)
        {
            if (fileHeader == null)
            {
                throw new ArgumentNullException(nameof(fileHeader));
            }
            if (descriptionBlocks == null)
            {
                throw new ArgumentNullException(nameof(descriptionBlocks));
            }

            LexLocation       = lexLocation;
            FileHeader        = fileHeader;
            DescriptionBlocks = descriptionBlocks;
        }
示例#5
0
        public AstCharacteristicMapBlock(LexLocation lexLocation, string groupName, AstSeq headers, AstSeq dependantAxis, params IAst[] independantAxis)
            : base(lexLocation, groupName, headers, null)
        {
            if (independantAxis == null)
            {
                throw new ArgumentNullException(nameof(independantAxis));
            }
            if (dependantAxis == null)
            {
                throw new ArgumentNullException(nameof(dependantAxis));
            }

            IndependantAxis = independantAxis.Cast <AstIndependantAxis>().ToList();
            DependantAxis   = dependantAxis;
        }
示例#6
0
        public AstDescriptionBlock(LexLocation lexLocation, string groupName, AstSeq headers, AstSeq variables = null)
        {
            if (groupName == null)
            {
                throw new ArgumentNullException(nameof(groupName));
            }
            if (headers == null)
            {
                throw new ArgumentNullException(nameof(headers));
            }

            LexLocation = lexLocation;
            GroupName   = groupName;
            Variables   = variables;
            Headers     = headers;
        }
示例#7
0
文件: Parser.cs 项目: ngbrown/Mcs3Rob
 private static RobDependantAxis ReadRobDependantAxis(AstSeq dependantAxis)
 {
     return(new RobDependantAxis()
     {
         ElementType = (RobElementType)dependantAxis.ReadAsInt(0),
         ValueDirection = (RobDirection)dependantAxis.ReadAsInt(1),
         MinimumLimit = dependantAxis.ReadAsLong(2),
         MaximumLimit = dependantAxis.ReadAsLong(3),
         Reserve4 = dependantAxis.ReadAsInt(4),
         Reserve5 = dependantAxis.ReadAsInt(5),
         Description = dependantAxis.ReadAsText(6),
         PhysicalLabelAbbreviation = dependantAxis.ReadAsText(7),
         EngineeringUnit = dependantAxis.ReadAsText(8),
         ConversionEquation = dependantAxis.ReadAsText(9),
         DecimalPlaces = dependantAxis.ReadAsInt(10),
         Reserve11 = dependantAxis.ReadAsInt(11),
         Reserve12 = dependantAxis.ReadAsInt(12),
         Reserve13 = dependantAxis.ReadAsInt(13),
     });
 }
示例#8
0
文件: Parser.cs 项目: ngbrown/Mcs3Rob
        private static List <RobParameter> ReadRobParameters(AstSeq variables)
        {
            var parameters = variables.Items.Cast <AstSeq>().Select(variable =>
            {
                var item1 = variable.Items[1];
                var item1KnownHexValue = item1.IsKnownHexValue();

                var robParameter = new RobParameter
                {
                    ElementType  = (RobElementType)variable.ReadAsUInt(0),
                    Bitmask      = item1KnownHexValue ? new uint?(item1.ReadAsUInt()) : null,
                    Direction    = item1KnownHexValue ? null : (RobDirection?)item1.ReadAsInt(),
                    MinimumLimit = variable.ReadAsLong(2),
                    MaximumLimit = variable.ReadAsLong(3),
                    Address      = variable.ReadAsUInt(4),
                    DisplayMode  = (RobDisplayMode)variable.ReadAsInt(5),
                    Description  = variable.ReadAsText(6),
                    VariableName = variable.ReadAsText(7),
                };

                if (variable.Items.Count > 8)
                {
                    robParameter.EngineeringUnit = variable.ReadAsText(8);
                }

                if (variable.Items.Count > 9)
                {
                    robParameter.ConversionEquation = variable.ReadAsText(9);
                }

                if (variable.Items.Count > 10)
                {
                    robParameter.DecimalPlaces = variable.ReadAsInt(10);
                }

                return(robParameter);
            }).ToList();

            return(parameters);
        }
示例#9
0
 public static AstSeq ReadAsSeq(this AstSeq astSeq, int index)
 {
     return(astSeq.GetAtIndex(index).ReadAsSeq());
 }
示例#10
0
 public static string ReadAsText(this AstSeq astSeq, int index)
 {
     return(astSeq.GetAtIndex(index).ReadAsText());
 }
示例#11
0
 public static long ReadAsLong(this AstSeq astSeq, int index)
 {
     return(astSeq.GetAtIndex(index).ReadAsLong());
 }
示例#12
0
 public static uint ReadAsUInt(this AstSeq astSeq, int index)
 {
     return(astSeq.GetAtIndex(index).ReadAsUInt());
 }