byte_buffer Module Interface Specification

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

-foreign types: byte, global

(1) SYNTAX

ACCESS-PROGRAMS

Program Name
Arg#1Arg#2Arg#3
PUTbuffer:VOint:Vbyte:V
GETbuffer:Vint:Vbyte: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) =

ConditionValue
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-PROGRAMS

Legality(PUT((n, T), pos, b)) =

ConditionValue
pos < 0 pos global::G_buffer_size()%invalid position%
pos 0 pos < global::G_buffer_size()%legal%

PUT((n, T) , pos, b) =

ConditionValue
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))) =

ConditionValue
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)