Ejemplo n.º 1
0
 public IntegralTypeSizeInfo(
     Signedness signedness,
     int bits) : base(
         signedness,
         bits)
 {
 }
Ejemplo n.º 2
0
 public static StatusRegister CreateStatusRegister(int devID, string alias, string description, int registerNumber, Signedness signedness)
 {
     using (var context = new DynapowerCloudMonitoringDbContext())
     {
         var dev = context.Devices.Find(devID);
         var statusRegister = new StatusRegister()
         {
             RegisterNumber = registerNumber,
             Alias = alias,
             Description=description,
             SignednessType = signedness
         };
         dev.Registers.Add(statusRegister);
         for (int i = 0; i < 16; i++)
         {
             statusRegister.StatusRegisterBits.Add(new StatusRegisterBit()
             {
                 Bit = i,
                 Alias = "NA",
                 Description = "NA",
                 Enabled = false,
                 RegisterId = statusRegister.Id
             });
         }
         context.SaveChanges();
         return statusRegister;
     }
 }
Ejemplo n.º 3
0
 protected ReferenceTypeSize(
     Signedness signedness,
     int bits)
 {
     Signedness = signedness;
     Bits       = bits;
 }
Ejemplo n.º 4
0
 public IntegralTypeSize(
     Signedness signedness,
     int bits)
 {
     Signedness = signedness;
     Bits       = bits;
 }
Ejemplo n.º 5
0
 public IntegralTypeSizeInfo(
     Signedness signedness,
     int bits) : base(
         bits)
 {
     Signedness = signedness;
 }
Ejemplo n.º 6
0
        public override int GetHashCode()
        {
            var hash = 17;

            hash = hash * 37 + Name.GetHashCode();
            hash = hash * 37 + Size.GetHashCode();
            hash = hash * 37 + Signedness.GetHashCode();
            return(hash);
        }
Ejemplo n.º 7
0
 public static AnalogRegister CreateAnalogRegister(int devID, string alias, string description, int registerNumber, string engineeringUnit, float scalingFactor, Signedness signedness)
 {
     using (var context = new DynapowerCloudMonitoringDbContext())
     {
         var dev = context.Devices.Find(devID);
         var analogRegister = new AnalogRegister()
         {
             RegisterNumber = registerNumber,
             Alias = alias,
             Description = description,
             DeviceId = dev.Id,
             EngineeringUnit = engineeringUnit,
             ScalingFactor = scalingFactor,
             SignednessType = signedness
         };
         dev.Registers.Add(analogRegister);
         context.SaveChanges();
         return analogRegister;
     }
 }
Ejemplo n.º 8
0
        void TestPromote(MachineInfo mi, string type, int resultBytes, Signedness signedness)
        {
            var report  = new Report(new TestPrinter());
            var context = new EmitContext(mi, report);

            var compiler = new Compiler(mi, report);

            compiler.AddCode("test.c", type + " v;");
            var exe = compiler.Compile();

            var ty = exe.Globals.First(x => x.Name == "v").VariableType;

            Assert.IsInstanceOfType(ty, typeof(CBasicType));
            var bty = (CBasicType)ty;

            Assert.IsTrue(bty.IsIntegral);
            var pty = bty.IntegerPromote(context);

            Assert.AreEqual(pty.Signedness, signedness);
            Assert.AreEqual(pty.GetByteSize(context), resultBytes);
        }
Ejemplo n.º 9
0
 public override int GetHashCode()
 {
     return(Name.GetHashCode() + Size.GetHashCode() + Signedness.GetHashCode());
 }
Ejemplo n.º 10
0
 public CBasicType(string name, Signedness signedness, string size)
 {
     Name       = name;
     Signedness = signedness;
     Size       = size;
 }
Ejemplo n.º 11
0
 public CIntType(string name, Signedness signedness, string size)
     : base(name, signedness, size)
 {
 }