19.11.2014 Views

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

40.10 <strong>The</strong> Trait <strong>Fortress</strong>.Core.BinaryEndianLinearEndianSequence<br />

trait BinaryEndianLinearEndianSequencenat b,bool bigEndianBytes,bool bigEndianBits,<br />

nat n,bool bigEndianSequence<br />

extends { BasicBinaryOperations<br />

BinaryEndianLinearEndianSequenceb,bigEndianBytes,bigEndianBits,<br />

n,bigEndianSequence }<br />

where { b ≤ maxBinaryWordBitLog }<br />

coercion nat b ′ ,bool bigEndianBytes,bool bigEndianBits<br />

(x:BinaryEndianWordb ′ ,bigEndianBytes,bigEndianBits)<br />

where {bigEndianBytes = bigEndianSequence, 2 b′ = n · 2 b }<br />

coercion nat m,nat radix,nat q,nat k,nat v(x:NaturalNumeralm,radix, v)<br />

where {radix = 2 q , q · m = n · 2 bk }<br />

opr [j: IndexInt] : BinaryEndianWordb,bigEndianBytes,bigEndianBits<br />

throws { IndexOutOfBoundsException }<br />

opr nat k[j: IntegerStatick] : BinaryWordb,bigEndianBytes,bigEndianBits<br />

where { k < n }<br />

opr nat m[r: RangeOfStaticSizeIndexInt, m] :<br />

BinaryEndianLinearEndianSequenceb,bigEndianBytes,bigEndianBits,<br />

m,bigEndianSequence<br />

throws { IndexOutOfBoundsException } where { m ≤ n }<br />

opr int a,nat m,int c[r:StaticRangea, m, c] :<br />

BinaryEndianLinearEndianSequenceb,bigEndianBytes,bigEndianBits,<br />

m,bigEndianSequence<br />

where { 0 ≤ a < n, 0 ≤ a + m · c < n }<br />

opr [j: IndexInt] := (v: BinaryEndianWordb,bigEndianBytes,bigEndianBits):<br />

BinaryEndianLinearEndianSequenceb,bigEndianBytes,bigEndianBits,<br />

n,bigEndianSequence<br />

throws { IndexOutOfBoundsException }<br />

opr nat k[j: IntegerStatick] :=<br />

(v: BinaryEndianWordb,bigEndianBytes,bigEndianBits):<br />

BinaryEndianLinearEndianSequenceb,bigEndianBytes,bigEndianBits,<br />

n,bigEndianSequence<br />

where { k < n }<br />

opr nat m[r: RangeOfStaticSizeIndexInt, m] :=<br />

(v: BinaryEndianLinearEndianSequenceb,bigEndianBytes,bigEndianBits,<br />

m,bigEndianSequence):<br />

BinaryEndianLinearEndianSequenceb,bigEndianBytes,bigEndianBits,<br />

n,bigEndianSequence<br />

throws { IndexOutOfBoundsException }<br />

opr int a,nat m,int c[r:StaticRangea, m, c] :=<br />

(v: BinaryEndianLinearEndianSequenceb,bigEndianBytes,bigEndianBits,<br />

k,bigEndianSequence):<br />

BinaryEndianLinearEndianSequenceb,bigEndianBytes,bigEndianBits,<br />

n,bigEndianSequence<br />

where { 0 ≤ a < n, 0 ≤ a + m · c < n }<br />

update(j:IndexInt, v: BinaryEndianWordb,bigEndianBytes,bigEndianBits):<br />

BinaryEndianLinearEndianSequenceb,bigEndianBytes,bigEndianBits,<br />

n,bigEndianSequence<br />

throws { IndexOutOfBoundsException }<br />

updatenat k(j: IntegerStatick,<br />

298

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!