%include "Moose:Mouse.Inc" %include "GDMR_E:Ether.Inc" %systemroutinespec phex2(%integer x) %systemroutinespec phex4(%integer x) %externalpredicatespec FS lookup(%string(31) what, %integername value) %recordformat ether address fm(%bytearray dest(0 : 5), %bytearray source(0 : 5), %short type) %routine show addrs(%bytename b, %integer size) %record(ether address fm)%name e %integer i e == record(addr(b)) printstring("For: ") %for i = 0, 1, 5 %cycle print symbol('-') %unless i = 0 phex2(e_dest(i)) %repeat printstring(", from: ") %for i = 0, 1, 5 %cycle print symbol('-') %unless i = 0 phex2(e_source(i)) %repeat printstring(", size: ") write(size, 0) printstring(", type: ") %if e_type < 1500 %start printstring("ISO, size "); write(e_type, 0) %else phex4(e_type) %finish newline %end %begin %bytearray b(0 : 1500) %record(ether request fm) r %record(ether request fm)%name rep %record(semaphore fm) s %record(mailbox fm) box %record(mailbox fm)%name ether box %integer x open output(3, ":T"); select output(3) %if FS lookup(ether mailbox name, x) %start ether box == record(x) %else printstring("No ether mailbox"); newline %stop %finish setup semaphore(s) setup mailbox(box, s) setup message(r, size of(r)) r_code = ether register r_type = -1 send message(r, ether box, box) rep == receive message(box) %if rep_status # ether success %start printstring("Register: "); write(rep_status, 0) newline %stop %finish %cycle r_code = ether read r_buffer == b(0) r_bytes = 1500 send message(r, ether box, box) rep == receive message(box) %if rep_status # ether success %start printstring("Read: "); write(rep_status, 0) newline %stop %finish show addrs(b(0), rep_bytes) %repeat %end %of %program