Informal Introduction
Implements buffer of G_buffer_size() bytes of continuous memory. Used by READ and
WRITE access programs in module Process.
(0) CHARACTERISTICS
-type specified: buffer
-features: deterministic, non-parameterized
(1) SYNTAX
ACCESS-PROGRAMS
Arg#1 | Arg#2 | Arg#3 | PUT | buffer:VO | int:V | byte:V | GET | buffer:V | int:V | byte:VO | |
---|
(2) CANONICAL TRACES
canonical(T) T = _ n:<int>; b[0]..b[n]:<byte>0 n n < global::G_buffer_size() [T = [PUT(*, i, b[i])]i=0..n ]AUXILIARY FUNCTIONS
errorval: <byte>
errorval() = -1
get: <buffer> × <int> <byte>
get(buf, pos) =
Condition | Value |
---|---|
pos < 0 pos length(buf) | errorval() |
pos 0 pos < length(buf) | b where b:<byte>; s1,s2:<buffer> [buf = s1.PUT(*, pos, b).s2 ] |
(3) SEMANTICS
ACCESS-PROGRAMSLegality(PUT((n, T), pos, b)) =
Condition | Value |
---|---|
pos < 0 pos global::G_buffer_size() | %invalid position% |
pos 0 pos < global::G_buffer_size() | %legal% |
PUT((n, T) , pos, b) =
Condition | Value |
---|---|
pos length(T) | T.[PUT(*, length(T) + i, byte::_)]i=0..m.PUT(*, pos, b) where m:<int> [m = pos - length(T) - 1 ] |
pos < length(T) | T1.PUT(*, pos, b).T2 where T1,T2:<buffer>; b1:<byte> [T = T1.PUT(*, pos, b1).T2 ] |
Legality(GET(T, pos, (n, b))) =
Condition | Value |
---|---|
pos < 0 pos global::G_buffer_size() | %invalid position% |
pos 0 pos < global::G_buffer_size() | %legal% |
GET(T, pos, (n, b) ) = get(T, pos)