! Dictionary manipulation for new filestores %externalstring(47) copyright %alias "GDMR_(C)_FSDICT" = %c "Copyright (C) 1987 George D.M. Ross" %option "-nonstandard-nocheck-nodiag-noline-nostack" !%option "-nonstandard" %include "Moose:Mouse.Inc" %systemroutinespec phex(%integer i) %conststring(15) FS dictionary name = "FS_DICTIONARY" %systemintegerfnspec global heap get(%integer amount) %constinteger fsd entries = 48 %recordformat fsd entry fm(%string(31) name, %integer value) %recordformat fsd fm(%integer n, %record(fsd entry fm)%array e(1 : fsd entries)) %record(fsd fm)%map find fsd %record(dict fm)%name m %record(fsd fm)%name fsd %integer i, j m == poa_master dict m == m_alt %while m_alt ## nil !! printstring("Master master: top alt at ") !! phex(addr(m)); newline i = find entry(FS dictionary name, m) %if i = 0 %start !! printstring("Master master: creating..."); newline fsd == record(global heap get(size of(fsd))); fsd_n = 0 i = make entry(FS dictionary name, m) %signal 10, 0, 0, "Failed to create FS dictionary" %if i = 0 integer(i) = addr(fsd) %finish !! printstring("Master master: found dictionary at ") !! phex(integer(i)); newline %result == record(integer(i)) %end %externalroutine FS insert(%string(31) name, %integer value) %record(fsd fm)%name fsd %integer i, old SR !! printstring("Insert "); printstring(name) !! printstring(" with value "); write(value, 0) !! printstring(" ("); phex(value); print symbol(')') !! newline old SR = or to SR(16_0600) fsd == find fsd %if fsd == nil %start old SR = set SR(old SR) %signal 10, 0, 0, "Can't find FS dictionary?" %finish %for i = 1, 1, fsd_n %cycle %if fsd_e(i)_name = name %start old SR = set SR(old SR) %signal 10, 0, 0, "Already in FS dictionary" %finish %repeat fsd_n = fsd_n + 1 fsd_e(fsd_n)_name = name fsd_e(fsd_n)_value = value old SR = set SR(old SR) {} %for i = 1, 1, fsd_n %cycle {} phex(fsd_e(i)_value); spaces(3) {} printstring(fsd_e(i)_name); newline {} %repeat {} newline %end %externalpredicate FS lookup(%string(31) name, %integername value) %record(fsd fm)%name fsd %integer i, old SR !! printstring("Look up "); printstring(name) !! newline old SR = or to SR(16_0600) fsd == find fsd %if fsd == nil %start old SR = set SR(old SR) %signal 10, 0, 0, "Can't find FS dictionary?" %finish %for i = 1, 1, fsd_n %cycle %if fsd_e(i)_name = name %start old SR = set SR(old SR) value = fsd_e(i)_value %true %finish %repeat old SR = set SR(old SR) %false %end %end %of %file