DIRECTORY Buttons USING [Button, ButtonProc, Create], Convert USING [RopeFromInt], MessageWindow USING [Append, Blink], Rope USING [ActionType, Length, Map, ROPE], TEditOps USING [GetSelContents], TiogaOps USING [Delete, InsertRope]; BinaryConvert: CEDAR PROGRAM IMPORTS Buttons, Convert, Rope, MessageWindow, TEditOps, TiogaOps = BEGIN ROPE: TYPE = Rope.ROPE; binaryConvertButton: Buttons.Button _ Buttons.Create[ info: [name: "Binary: 10/8/16"], proc: BinaryConvertButton]; BinaryConvertButton: Buttons.ButtonProc = { selRope : ROPE _ TEditOps.GetSelContents[]; selLength : INT _ Rope.Length[selRope]; selValue : INT _ 0; valueRope : ROPE; mapProc : Rope.ActionType = { selValue _ selValue * 256 + ORD[c]; }; IF selLength = 0 OR selLength > 4 THEN { MessageWindow.Append["Make a selection of 1-4 characters.", TRUE]; MessageWindow.Blink[]; RETURN; }; [] _ Rope.Map[base: selRope, action: mapProc]; valueRope _ Convert.RopeFromInt[from: selValue, base: (SELECT mouseButton FROM red => 10, yellow => 8, ENDCASE => 16)]; IF shift THEN { TiogaOps.Delete[]; TiogaOps.InsertRope[valueRope]; } ELSE MessageWindow.Append[valueRope, TRUE]; }; END. θBinaryConvert.mesa Pavel, December 20, 1985 6:18:30 pm PST [parent: REF ANY, clientData: REF ANY _ NIL, mouseButton: Menus.MouseButton _ red, shift: BOOL _ FALSE, control: BOOL _ FALSE] [c: CHAR] RETURNS [quit: BOOL _ FALSE] Κz˜™Icode™'—J™šΟk ˜ Kšœœ˜+Kšœœ˜Kšœœ˜$Kšœœœ˜+Kšœ œ˜ Kšœ œ˜$—headšœ ˜š˜Kšœ9˜9—šœ˜Kšœœœ˜K˜šœ%˜%šœ˜Kšœ ˜ Kšœ˜——K˜•StartOfExpansion‚ -- [parent: REF ANY, clientData: REF ANY _ NIL, mouseButton: Menus.MouseButton _ red, shift: BOOL _ FALSE, control: BOOL _ FALSE]šΟbœ˜)KšΠck~™~šœ˜Kšœ œ˜+Kšœ œ˜'Kšœ œ˜Kšœ œ˜–* -- [c: CHAR] RETURNS [quit: BOOL _ FALSE]˜KšŸ&™&K˜Kšœœ˜#K˜—K˜Kšœ!˜(˜Kšœ<œ˜BK˜Kšœ˜—K˜K˜K˜.Kšœ7œ œœ ˜wK˜Kšœ˜ ˜K˜K˜—K˜š˜Kšœ œ˜&——K˜——Kšœ˜——…—~ΰ