DIRECTORY PW, TerminalIO; DemoDecoder: CEDAR PROGRAM IMPORTS PW, TerminalIO = BEGIN OPEN PW; Generate: UserProc = { zero: Object _ Get[design, "zero"]; one: Object _ Get[design, "one"]; left: Object _ Get[design, "left"]; right: Object _ Get[design, "right"]; DecGen: PROC [n: INT] RETURNS [decoder: Object] = { IF n=0 THEN RETURN [NIL] ELSE { subDecoder: Object _ DecGen [n-1]; decoder _ AbutY[ AbutX [ArrayY [zero, TwoToThe[n-1]], subDecoder], AbutX [ArrayY [one, TwoToThe[n-1]], subDecoder] ]; }; }; n: INT _ TerminalIO.RequestInt["How many bits in the decoder? "]; RETURN [AbutX [ ArrayY [left, TwoToThe[n]], DecGen [n], ArrayY [right, TwoToThe[n]] ]]; }; Register[Generate, "Decoder"]; END. ΌDemoDecoder.mesa Copyright c 1985-1986 by Xerox Corporation. All rights reversed. Created by: Monier, May 9, 1985 11:18:58 pm PDT Bertrand Serlet February 17, 1986 11:09:14 am PST Κr˜– "Cedar" stylešœ™Jšœ Οmœ6™AJ™/Icode™1J˜—JšΟk œžœ ˜J˜š Οb œžœžœžœžœ˜3Jšžœžœžœ˜J˜šŸœ˜J˜Jšœ#˜#Jšœ!˜!Jšœ#˜#Jšœ%˜%J˜šΟnœžœžœžœ˜3šžœ˜Jšžœžœžœ˜šžœ˜Jšœ"˜"šœ˜Jšœ1˜1Jšœ/˜/Jšœ˜—J˜——Jšœ˜—J˜Jšœžœ<˜Bšžœ ˜Jšœ˜Jšœ ˜ Jšœ˜Jšœ˜—Jšœ˜J˜—Jšœ˜Jšžœ˜—J™—…—Ζτ