DIRECTORY Rope,OracleGen,Convert; OracleGenImpl: CEDAR PROGRAM IMPORTS Rope,Convert EXPORTS OracleGen ~ BEGIN Bin: PUBLIC PROC [k: CARD] RETURNS [s: Rope.ROPE] ~ { s _ Convert.RopeFromCard[from: k, base: 2, showRadix: FALSE]; }; Hex: PUBLIC PROC [k: CARD] RETURNS [s: Rope.ROPE] ~ { s _ Convert.RopeFromCard[from: k, base: 16, showRadix: FALSE]; }; LExtend: PUBLIC PROC [r: Rope.ROPE, i: INT] RETURNS [s: Rope.ROPE] ~ { IF i < Rope.Length[r] THEN ERROR ; s _ r; DO IF i= Rope.Length[s] THEN EXIT ELSE s _ Rope.Concat["0",s]; ENDLOOP; }; BinExt: PUBLIC PROC [k: INT, i: INT] RETURNS [r: Rope.ROPE] ~ { r _ LExtend[Bin[k],i]; }; Expand: PUBLIC PROC [r: Rope.ROPE, i: INT] RETURNS [s: Rope.ROPE] ~ { n: INT; b: Rope.ROPE; b _ ""; FOR i IN [0..i) DO b _ Rope.Concat[" ",b] ENDLOOP; n _ Rope.Length[r]; s _ ""; FOR i IN [0..n) DO s _ Rope.Cat[s,b,Rope.Substr[r,i,1]] ENDLOOP; }; END. ΨOracleGenImpl.mesa Copyright Σ 1987 by Xerox Corporation. All rights reserved. Jean Gastinel August 12, 1987 7:28:18 pm PDT Transform the integer into a Rope which is the binary value of the integer] Convert an integer into a Rope which correspond to its value Left extend the initial Rope by 0 until having the length "i" Convert an Integer to a Rope with left 0 padding for a length of i Expand the initial Rope in inserting "i" space between each digit Κ·˜codešœ™Kšœ<™Kšœ˜K™K™—šŸœœœ œœœ œ˜FK™=Kšœ œ˜"K˜š˜Kšœœ œœ˜=—Kš˜K˜K˜—šŸœœœœœœ œ˜?K™BK˜K˜K˜—šŸœœœ œœœ œ˜EK™AK™Kšœ˜Kšœ˜ K˜Kšœœœœ˜2Kšœ˜K˜Kšœœœ&œ˜@K˜—K˜˜K™—K™˜K˜——K˜Kšœ˜—…—‚