DIRECTORY Commander USING [CommandProc, Register], IO, FS, Rope USING [ROPE]; MakeTT: CEDAR PROGRAM IMPORTS Commander, IO, FS = BEGIN Test: Commander.CommandProc = BEGIN ins, outs, pterms: NAT; outFile: Rope.ROPE; outStream: IO.STREAM; cmd.out.PutF["Name of output file? "]; outFile _ cmd.in.GetLineRope[]; outStream _ FS.StreamOpen[outFile, $create]; cmd.out.PutF["How many inputs? "]; ins _ cmd.in.GetInt[]; cmd.out.PutF["How many outputs? "]; outs _ cmd.in.GetInt[]; cmd.out.PutF["How many product terms? "]; pterms _ cmd.in.GetInt[]; FOR pterm: NAT IN [1 .. pterms) DO val: INT _ pterm; FOR in: NAT IN [1 .. ins) DO IF val MOD 2 = 1 THEN outStream.PutF["1"] ELSE outStream.PutF["0"]; val _ val / 2; ENDLOOP; outStream.PutF[" | "]; val _ pterms; FOR out: NAT IN [1 .. outs) DO IF val MOD 2 = 1 THEN outStream.PutF["1"] ELSE outStream.PutF["0"]; val _ val / 2; ENDLOOP; outStream.PutF["\n"]; ENDLOOP; IO.Close[outStream]; cmd.out.PutF["Done.\n"]; END; Commander.Register[key: "MakeTT", proc: Test, doc: "Make a truth table"]; END. ʪ˜šÏk ˜ Jšœ œ˜(Jšœœ˜šœœœ˜J˜——J˜šÏbœœœ˜Jšœ œ˜!˜J˜—šžœ˜#Jšœœ˜Jšœœ˜Jšœ œœ˜J˜&Jšœ˜Jšœ œ˜,J˜"Jšœ˜J˜#Jšœ˜J˜)Jšœ˜šœœœ˜"Jšœœ ˜šœœœ ˜Jšœœœœ˜DJ˜Jšœ˜—Jšœ˜Jšœ ˜ šœœœ ˜Jšœœœœ˜DJ˜Jšœ˜—Jšœ˜Jš˜—Jšœ˜J˜Jšœ˜J˜—JšœI˜IJšœ˜——…—È