// look4.sr


// get "BRAVO1.DF";


// Incoming procedures

external	[
	stsize
	processtsesc
	stget
	stnum
	stappend
	]


// Incoming statics

// external


// Outgoing procedures

external	[
	AbReadLookEscSeq
	WriteLookEscSeq
	]


// Outgoing statics

// external


// Local statics

// static


// Local manifests

// manifest


// A B   R E A D   L O O K   E S C   S E Q

let AbReadLookEscSeq(pwFirst, pwLast) = valof
[
let sb = vec 15
processtsesc($L, sb)
let ich = 0
let ab = nil
ich = IchReadOctalSb(lv ab, sb, ich)
for pw = pwFirst to pwLast do
	ich = IchReadOctalSb(pw, sb, ich)
resultis ab
] // end AbReadLookEscSeq


// I C H   R E A D   O C T A L   S B

and IchReadOctalSb(pint, sb, ich) = valof
[
let int = 0
	[
	if ich ge stsize(sb) then break
	let tint = stget(sb, ich) - $0
	ich = ich + 1
	if tint ls 0 % tint gr 7 then break
	int = int lshift 3 + tint
	] repeat
rv pint = int
resultis ich
] // end IchReadOctalSb


// W R I T E   L O O K   E S C   S E Q

and WriteLookEscSeq(ab, pwFirst, pwLast) be
[
let sb = vec 15
sb ! 0 = 0
let tsb = vec 5
stnum(tsb, ab, 8, 0, false, false, false)
stappend(sb, tsb)
stappend(sb, ",")
for pw = pwFirst to pwLast do
	[
	stnum(tsb, rv pw, 8, 0, false, false, false)
	stappend(sb, tsb)
	stappend(sb, ",")
	]
processtsesc($L, sb)
] // end WriteLookEscSeq