public TRegion RegionForAddress(uint aAddress, out int aRemainingUntilNextBoundary) { TRegion region = RegionForAddress(aAddress); // switch (region) { default: aRemainingUntilNextBoundary = -1; break; case TRegion.EHeader: case TRegion.EPayload: if (region == TRegion.EHeader) { uint startOfPayload = StartOfPayloadAddress; aRemainingUntilNextBoundary = (int)(startOfPayload - aAddress); } else { uint endAddress = EndAddress; aRemainingUntilNextBoundary = (int)(endAddress - aAddress + 1); } break; } // return(region); }
public void SetFinallyInputState(TRegion finallyRegion, TValue state) { if (finallyRegion.Kind is not RegionKind.Finally) { throw new ArgumentException(null, nameof(finallyRegion)); } finallyInputState[finallyRegion] = state; }
public TValue GetFinallyInputState(TRegion finallyRegion) { if (finallyRegion.Kind is not RegionKind.Finally) { throw new ArgumentException(null, nameof(finallyRegion)); } if (!finallyInputState.TryGetValue(finallyRegion, out TValue state)) { state = lattice.Top; finallyInputState.Add(finallyRegion, state); } return(state); }
public Box <TValue> GetExceptionState(TRegion tryOrCatchOrFilterRegion) { if (tryOrCatchOrFilterRegion.Kind is not(RegionKind.Try or RegionKind.Catch or RegionKind.Filter)) { throw new ArgumentException(null, nameof(tryOrCatchOrFilterRegion)); } if (!exceptionState.TryGetValue(tryOrCatchOrFilterRegion, out Box <TValue>?state)) { state = new Box <TValue> (lattice.Top); exceptionState.Add(tryOrCatchOrFilterRegion, state); } return(state); }
public RawItem this[uint aAddress] { get { RawItem ret = null; // TRegion region = RegionForAddress(aAddress); if (region == TRegion.EPayload || region == TRegion.EHeader) { if (region == TRegion.EHeader) { uint offset = aAddress - Address; int index = System.Convert.ToInt32(offset / RawItem.KSizeOfOneRawItemInBytes); // if (index < 0 || index >= HeaderRawItems.Count) { throw new ArgumentException("Address 0x" + aAddress.ToString("x8") + " is beyond this cell's header"); } // ret = HeaderRawItems[index]; } else { // Payload uint offset = aAddress - StartOfPayloadAddress; int index = System.Convert.ToInt32(offset / RawItem.KSizeOfOneRawItemInBytes); // if (index < 0 || index >= RawItems.Count) { throw new ArgumentException("Address 0x" + aAddress.ToString("x8") + " is beyond this cell's payload"); } // ret = this[index]; } } else { throw new ArgumentException("Address 0x" + aAddress.ToString("x8") + " is not within this cell's extent"); } return(ret); } }
public override string GetFullText(Connection conn) { TUCLP uclp = TUCLP.Seek(conn, this.uclp); //string filtered = FilterPrefixes(uclp.name, UclpPrefixes); TArea area = TArea.Seek(uclp.area); TRegion region = TRegion.Seek(uclp.area, uclp.region); StringBuilder fullText = new StringBuilder(); //if (area.name != filtered || region.name != filtered) fullText.AppendFormat("Област {0}, Община {1}, ", area.name, region.name); fullText.Append(uclp.name); if (street != 0) { fullText.AppendFormat(", {0}", TStreet.Seek(conn, this.uclp, street).name); } AddressPart[] parts = new AddressPart[] { new AddressPart("No ", adrNo), new AddressPart("Блок ", blockNo), new AddressPart("Подн.", subNo), new AddressPart("Вх.", entrance), new AddressPart("Ет.", floor), new AddressPart("Ап.", apartment) }; foreach (AddressPart part in parts) { if (part.text != "") { fullText.AppendFormat(", {0}{1}", part.prefix, part.text); } } return(fullText.ToString()); }
public TRegion RegionForAddress(uint aAddress) { uint address = Address; // TRegion ret = TRegion.EBeforeCell; // if (aAddress < address) { ret = TRegion.EBeforeCell; } else { uint endAddress = EndAddress; // if (aAddress > endAddress) { ret = TRegion.EAfterCell; } else { uint startOfPayload = StartOfPayloadAddress; // if (aAddress >= startOfPayload) { ret = TRegion.EPayload; } else { ret = TRegion.EHeader; } } } // return(ret); }
public override void ReadFrom(DataBuffer buffer) { base.ReadFrom(buffer); this.Region = Activator.CreateInstance <TRegion>(); this.Region.ReadFrom(buffer); }
public RegionPacket(TRegion region) { this.Region = region; }