|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 22528 (0x5800) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Tile, seg_005361
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─⟦5a81ac88f⟧ »Space Info Vol 1« └─⟦this⟧
with Text_Io; with Main; use Main; with Tile_Bits; use Tile_Bits; with Xlbt_Arithmetic; use Xlbt_Arithmetic; with Xlbt_Image; use Xlbt_Image; with Xlbp_Graphics; use Xlbp_Graphics; with Xlbp_Image; use Xlbp_Image; package body Tile is ------------------------------------------------------------------------------ -- Dragon - a version of Mah-Jongg for X Windows -- -- Author: Gary E. Barnes March 1989 -- -- tile.c - Deals with the individual Mah-Jongg tiles. ------------------------------------------------------------------------------ -- 05/30/90 GEB - Translate to Ada ------------------------------------------------------------------------------ Tile_X11 : S_Short := 28 / 2; -- one column Tile_X21 : S_Short := 28 / 3; -- two columns Tile_X22 : S_Short := 28 * 2 / 3; Tile_X31 : S_Short := 28 / 4; -- three columns Tile_X32 : S_Short := 28 * 2 / 4; Tile_X33 : S_Short := 28 * 3 / 4; Tile_Y11 : S_Short := 32 / 2; -- one row Tile_Y21 : S_Short := 32 / 3; -- two rows Tile_Y22 : S_Short := 32 * 2 / 3; Tile_Y31 : S_Short := 32 / 5; -- three rows Tile_Y32 : S_Short := 32 * 2 / 5; Tile_Y33 : S_Short := 32 * 3 / 5; Number_X : S_Short := 28 - 7; Number_Y : S_Short := 0; Subtile_X : S_Short := 7 / 2; Subtile_Y : S_Short := 8 / 2; --\x0c procedure Configure_Tiles (Size : S_Long) is ------------------------------------------------------------------------------ -- size - Specifies the tile size to use; 1..5 -- -- Called when the Board receives a ConfigureNotify event. We check to see if -- the size of the board/tiles have changed. If so then we reconfigure the -- images of the tiles. ------------------------------------------------------------------------------ W : S_Short; H : S_Short; begin ----Make sure that our caller is rational. if Size < 1 or else Size > 5 then Text_Io.Put_Line ("Bad size given to Configure_Tiles in tile.c [" & S_Long'Image (Size) & "]."); Configure_Tiles (1); return; end if; ----Set up all of the various images. Setup_Images (Natural (Size) - 1); ----Set up the sub-tile positions. W := S_Short (Spring.Width); H := S_Short (Spring.Height); Tile_X11 := W / 2; -- one column Tile_X21 := W / 3; -- two columns Tile_X22 := W - Tile_X21; Tile_X31 := W / 4; -- three columns while Tile_X31 + S_Short (Bam.Width / 2 + Bam.Width * 2) >= S_Short (Spring.Width) loop Tile_X31 := Tile_X31 - 1; end loop; Tile_X32 := Tile_X31 + S_Short (Bam.Width); Tile_X33 := Tile_X32 + S_Short (Bam.Width); Tile_Y11 := H / 2; -- one row Tile_Y21 := H / 3; -- two rows Tile_Y22 := H - Tile_Y21; Tile_Y31 := H * 2 / 5; -- three rows while Tile_Y31 + S_Short (Bam.Height / 2 + Bam.Height * 2) >= S_Short (Spring.Height) loop Tile_Y31 := Tile_Y31 - 1; end loop; Tile_Y32 := Tile_Y31 + S_Short (Bam.Height); Tile_Y33 := Tile_Y32 + S_Short (Bam.Height); Number_X := W - S_Short (One.Width) - 1; Number_Y := 1; Subtile_X := S_Short (Bam.Width) / 2; Subtile_Y := S_Short (Bam.Height) / 2; end Configure_Tiles; --\x0c procedure Draw_Image (Image : X_Image; X : S_Short; Y : S_Short) is ------------------------------------------------------------------------------ -- Do an XPutImage on the image. ------------------------------------------------------------------------------ begin X_Put_Image (Dpy, Board.Drawable, Normal_Gc, Image, 0, 0, X, Y, Image.Width, Image.Height); end Draw_Image; --\x0c procedure Draw_Blank (X : S_Short; Y : S_Short) is ------------------------------------------------------------------------------ -- Draw an empty tile; our caller will fill it in with little images. ------------------------------------------------------------------------------ begin X_Fill_Rectangle (Dpy, Board.Drawable, Reverse_Gc, X, Y, Spring.Width, Spring.Height); end Draw_Blank; --\x0c procedure Draw_Number (Image : X_Image; X : S_Short; Y : S_Short) is ------------------------------------------------------------------------------ -- Called to draw the number in the upper right corner of a numbered tile. ------------------------------------------------------------------------------ begin X_Put_Image (Dpy, Board.Drawable, Xor_Gc, Image, 0, 0, X + Number_X, Y + Number_Y, Image.Width, Image.Height); end Draw_Number; --\x0c procedure Draw_Spring (X : S_Short; Y : S_Short) is begin Draw_Image (Spring, X, Y); end Draw_Spring; procedure Draw_Summer (X : S_Short; Y : S_Short) is begin Draw_Image (Summer, X, Y); end Draw_Summer; procedure Draw_Fall (X : S_Short; Y : S_Short) is begin Draw_Image (Fall, X, Y); end Draw_Fall; procedure Draw_Winter (X : S_Short; Y : S_Short) is begin Draw_Image (Winter, X, Y); end Draw_Winter; --\x0c procedure Draw_Bamboo (X : S_Short; Y : S_Short) is begin Draw_Image (Bamboo, X, Y); end Draw_Bamboo; procedure Draw_Mum (X : S_Short; Y : S_Short) is begin Draw_Image (Mum, X, Y); end Draw_Mum; procedure Draw_Orchid (X : S_Short; Y : S_Short) is begin Draw_Image (Orchid, X, Y); end Draw_Orchid; procedure Draw_Plum (X : S_Short; Y : S_Short) is begin Draw_Image (Plum, X, Y); end Draw_Plum; --\x0c procedure Draw_Gdragon (X : S_Short; Y : S_Short) is begin Draw_Image (Gdragon, X, Y); end Draw_Gdragon; procedure Draw_Rdragon (X : S_Short; Y : S_Short) is begin Draw_Image (Rdragon, X, Y); end Draw_Rdragon; procedure Draw_Wdragon (X : S_Short; Y : S_Short) is begin Draw_Image (Wdragon, X, Y); end Draw_Wdragon; ---\x0c procedure Draw_East (X : S_Short; Y : S_Short) is begin Draw_Image (East, X, Y); end Draw_East; procedure Draw_West (X : S_Short; Y : S_Short) is begin Draw_Image (West, X, Y); end Draw_West; procedure Draw_North (X : S_Short; Y : S_Short) is begin Draw_Image (North, X, Y); end Draw_North; procedure Draw_South (X : S_Short; Y : S_Short) is begin Draw_Image (South, X, Y); end Draw_South; --\x0c procedure Draw_Bam1 (X : S_Short; Y : S_Short) is Bx : S_Short := X - Subtile_X; By : S_Short := Y - Subtile_Y; begin Draw_Blank (X, Y); Draw_Image (Bam, Bx + Tile_X11, By + Tile_Y11); Draw_Number (One, X, Y); end Draw_Bam1; procedure Draw_Bam2 (X : S_Short; Y : S_Short) is Bx : S_Short := X - Subtile_X; By : S_Short := Y - Subtile_Y; begin Draw_Blank (X, Y); Draw_Image (Bam, Bx + Tile_X11, By + Tile_Y21); Draw_Image (Bam, Bx + Tile_X11, By + Tile_Y22); Draw_Number (Two, X, Y); end Draw_Bam2; procedure Draw_Bam3 (X : S_Short; Y : S_Short) is Bx : S_Short := X - Subtile_X; By : S_Short := Y - Subtile_Y; begin Draw_Blank (X, Y); Draw_Image (Bam, Bx + Tile_X11, By + Tile_Y21); Draw_Image (Bam, Bx + Tile_X21, By + Tile_Y22); Draw_Image (Bam, Bx + Tile_X22, By + Tile_Y22); Draw_Number (Three, X, Y); end Draw_Bam3; procedure Draw_Bam4 (X : S_Short; Y : S_Short) is Bx : S_Short := X - Subtile_X; By : S_Short := Y - Subtile_Y; begin Draw_Blank (X, Y); Draw_Image (Bam, Bx + Tile_X21, By + Tile_Y21); Draw_Image (Bam, Bx + Tile_X22, By + Tile_Y21); Draw_Image (Bam, Bx + Tile_X21, By + Tile_Y22); Draw_Image (Bam, Bx + Tile_X22, By + Tile_Y22); Draw_Number (Four, X, Y); end Draw_Bam4; procedure Draw_Bam5 (X : S_Short; Y : S_Short) is Bx : S_Short := X - Subtile_X; By : S_Short := Y - Subtile_Y; begin Draw_Blank (X, Y); Draw_Image (Bam, Bx + Tile_X11, By + Tile_Y31); Draw_Image (Bam, Bx + Tile_X21, By + Tile_Y32); Draw_Image (Bam, Bx + Tile_X22, By + Tile_Y32); Draw_Image (Bam, Bx + Tile_X21, By + Tile_Y33); Draw_Image (Bam, Bx + Tile_X22, By + Tile_Y33); Draw_Number (Five, X, Y); end Draw_Bam5; procedure Draw_Bam6 (X : S_Short; Y : S_Short) is Bx : S_Short := X - Subtile_X; By : S_Short := Y - Subtile_Y; begin Draw_Blank (X, Y); Draw_Image (Bam, Bx + Tile_X21, By + Tile_Y31); Draw_Image (Bam, Bx + Tile_X22, By + Tile_Y31); Draw_Image (Bam, Bx + Tile_X21, By + Tile_Y32); Draw_Image (Bam, Bx + Tile_X22, By + Tile_Y32); Draw_Image (Bam, Bx + Tile_X21, By + Tile_Y33); Draw_Image (Bam, Bx + Tile_X22, By + Tile_Y33); Draw_Number (Six, X, Y); end Draw_Bam6; procedure Draw_Bam7 (X : S_Short; Y : S_Short) is Bx : S_Short := X - Subtile_X; By : S_Short := Y - Subtile_Y; begin Draw_Blank (X, Y); Draw_Image (Bam, Bx + Tile_X21, By + Tile_Y31); Draw_Image (Bam, Bx + Tile_X22, By + Tile_Y31); Draw_Image (Bam, Bx + Tile_X21, By + Tile_Y32); Draw_Image (Bam, Bx + Tile_X22, By + Tile_Y32); Draw_Image (Bam, Bx + Tile_X31, By + Tile_Y33); Draw_Image (Bam, Bx + Tile_X32, By + Tile_Y33); Draw_Image (Bam, Bx + Tile_X33, By + Tile_Y33); Draw_Number (Seven, X, Y); end Draw_Bam7; procedure Draw_Bam8 (X : S_Short; Y : S_Short) is Bx : S_Short := X - Subtile_X; By : S_Short := Y - Subtile_Y; begin Draw_Blank (X, Y); Draw_Image (Bam, Bx + Tile_X21, By + Tile_Y31); Draw_Image (Bam, Bx + Tile_X22, By + Tile_Y31); Draw_Image (Bam, Bx + Tile_X31, By + Tile_Y32); Draw_Image (Bam, Bx + Tile_X32, By + Tile_Y32); Draw_Image (Bam, Bx + Tile_X33, By + Tile_Y32); Draw_Image (Bam, Bx + Tile_X31, By + Tile_Y33); Draw_Image (Bam, Bx + Tile_X32, By + Tile_Y33); Draw_Image (Bam, Bx + Tile_X33, By + Tile_Y33); Draw_Number (Eight, X, Y); end Draw_Bam8; procedure Draw_Bam9 (X : S_Short; Y : S_Short) is Bx : S_Short := X - Subtile_X; By : S_Short := Y - Subtile_Y; begin Draw_Blank (X, Y); Draw_Image (Bam, Bx + Tile_X31, By + Tile_Y31); Draw_Image (Bam, Bx + Tile_X32, By + Tile_Y31); Draw_Image (Bam, Bx + Tile_X33, By + Tile_Y31); Draw_Image (Bam, Bx + Tile_X31, By + Tile_Y32); Draw_Image (Bam, Bx + Tile_X32, By + Tile_Y32); Draw_Image (Bam, Bx + Tile_X33, By + Tile_Y32); Draw_Image (Bam, Bx + Tile_X31, By + Tile_Y33); Draw_Image (Bam, Bx + Tile_X32, By + Tile_Y33); Draw_Image (Bam, Bx + Tile_X33, By + Tile_Y33); Draw_Number (Nine, X, Y); end Draw_Bam9; --\x0c procedure Draw_Dot1 (X : S_Short; Y : S_Short) is Bx : S_Short := X - Subtile_X; By : S_Short := Y - Subtile_Y; begin Draw_Blank (X, Y); Draw_Image (Dot, Bx + Tile_X11, By + Tile_Y11); Draw_Number (One, X, Y); end Draw_Dot1; procedure Draw_Dot2 (X : S_Short; Y : S_Short) is Bx : S_Short := X - Subtile_X; By : S_Short := Y - Subtile_Y; begin Draw_Blank (X, Y); Draw_Image (Dot, Bx + Tile_X11, By + Tile_Y21); Draw_Image (Dot, Bx + Tile_X11, By + Tile_Y22); Draw_Number (Two, X, Y); end Draw_Dot2; procedure Draw_Dot3 (X : S_Short; Y : S_Short) is Bx : S_Short := X - Subtile_X; By : S_Short := Y - Subtile_Y; begin Draw_Blank (X, Y); Draw_Image (Dot, Bx + Tile_X11, By + Tile_Y21); Draw_Image (Dot, Bx + Tile_X21, By + Tile_Y22); Draw_Image (Dot, Bx + Tile_X22, By + Tile_Y22); Draw_Number (Three, X, Y); end Draw_Dot3; procedure Draw_Dot4 (X : S_Short; Y : S_Short) is Bx : S_Short := X - Subtile_X; By : S_Short := Y - Subtile_Y; begin Draw_Blank (X, Y); Draw_Image (Dot, Bx + Tile_X21, By + Tile_Y21); Draw_Image (Dot, Bx + Tile_X22, By + Tile_Y21); Draw_Image (Dot, Bx + Tile_X21, By + Tile_Y22); Draw_Image (Dot, Bx + Tile_X22, By + Tile_Y22); Draw_Number (Four, X, Y); end Draw_Dot4; procedure Draw_Dot5 (X : S_Short; Y : S_Short) is Bx : S_Short := X - Subtile_X; By : S_Short := Y - Subtile_Y; begin Draw_Blank (X, Y); Draw_Image (Dot, Bx + Tile_X11, By + Tile_Y31); Draw_Image (Dot, Bx + Tile_X21, By + Tile_Y32); Draw_Image (Dot, Bx + Tile_X22, By + Tile_Y32); Draw_Image (Dot, Bx + Tile_X21, By + Tile_Y33); Draw_Image (Dot, Bx + Tile_X22, By + Tile_Y33); Draw_Number (Five, X, Y); end Draw_Dot5; procedure Draw_Dot6 (X : S_Short; Y : S_Short) is Bx : S_Short := X - Subtile_X; By : S_Short := Y - Subtile_Y; begin Draw_Blank (X, Y); Draw_Image (Dot, Bx + Tile_X21, By + Tile_Y31); Draw_Image (Dot, Bx + Tile_X22, By + Tile_Y31); Draw_Image (Dot, Bx + Tile_X21, By + Tile_Y32); Draw_Image (Dot, Bx + Tile_X22, By + Tile_Y32); Draw_Image (Dot, Bx + Tile_X21, By + Tile_Y33); Draw_Image (Dot, Bx + Tile_X22, By + Tile_Y33); Draw_Number (Six, X, Y); end Draw_Dot6; procedure Draw_Dot7 (X : S_Short; Y : S_Short) is Bx : S_Short := X - Subtile_X; By : S_Short := Y - Subtile_Y; begin Draw_Blank (X, Y); Draw_Image (Dot, Bx + Tile_X21, By + Tile_Y31); Draw_Image (Dot, Bx + Tile_X22, By + Tile_Y31); Draw_Image (Dot, Bx + Tile_X21, By + Tile_Y32); Draw_Image (Dot, Bx + Tile_X22, By + Tile_Y32); Draw_Image (Dot, Bx + Tile_X31, By + Tile_Y33); Draw_Image (Dot, Bx + Tile_X32, By + Tile_Y33); Draw_Image (Dot, Bx + Tile_X33, By + Tile_Y33); Draw_Number (Seven, X, Y); end Draw_Dot7; procedure Draw_Dot8 (X : S_Short; Y : S_Short) is Bx : S_Short := X - Subtile_X; By : S_Short := Y - Subtile_Y; begin Draw_Blank (X, Y); Draw_Image (Dot, Bx + Tile_X21, By + Tile_Y31); Draw_Image (Dot, Bx + Tile_X22, By + Tile_Y31); Draw_Image (Dot, Bx + Tile_X31, By + Tile_Y32); Draw_Image (Dot, Bx + Tile_X32, By + Tile_Y32); Draw_Image (Dot, Bx + Tile_X33, By + Tile_Y32); Draw_Image (Dot, Bx + Tile_X31, By + Tile_Y33); Draw_Image (Dot, Bx + Tile_X32, By + Tile_Y33); Draw_Image (Dot, Bx + Tile_X33, By + Tile_Y33); Draw_Number (Eight, X, Y); end Draw_Dot8; procedure Draw_Dot9 (X : S_Short; Y : S_Short) is Bx : S_Short := X - Subtile_X; By : S_Short := Y - Subtile_Y; begin Draw_Blank (X, Y); Draw_Image (Dot, Bx + Tile_X31, By + Tile_Y31); Draw_Image (Dot, Bx + Tile_X32, By + Tile_Y31); Draw_Image (Dot, Bx + Tile_X33, By + Tile_Y31); Draw_Image (Dot, Bx + Tile_X31, By + Tile_Y32); Draw_Image (Dot, Bx + Tile_X32, By + Tile_Y32); Draw_Image (Dot, Bx + Tile_X33, By + Tile_Y32); Draw_Image (Dot, Bx + Tile_X31, By + Tile_Y33); Draw_Image (Dot, Bx + Tile_X32, By + Tile_Y33); Draw_Image (Dot, Bx + Tile_X33, By + Tile_Y33); Draw_Number (Nine, X, Y); end Draw_Dot9; --\x0c procedure Draw_Crak1 (X : S_Short; Y : S_Short) is begin Draw_Image (Crak, X, Y); Draw_Number (One, X, Y); end Draw_Crak1; procedure Draw_Crak2 (X : S_Short; Y : S_Short) is begin Draw_Image (Crak, X, Y); Draw_Number (Two, X, Y); end Draw_Crak2; procedure Draw_Crak3 (X : S_Short; Y : S_Short) is begin Draw_Image (Crak, X, Y); Draw_Number (Three, X, Y); end Draw_Crak3; procedure Draw_Crak4 (X : S_Short; Y : S_Short) is begin Draw_Image (Crak, X, Y); Draw_Number (Four, X, Y); end Draw_Crak4; procedure Draw_Crak5 (X : S_Short; Y : S_Short) is begin Draw_Image (Crak, X, Y); Draw_Number (Five, X, Y); end Draw_Crak5; procedure Draw_Crak6 (X : S_Short; Y : S_Short) is begin Draw_Image (Crak, X, Y); Draw_Number (Six, X, Y); end Draw_Crak6; procedure Draw_Crak7 (X : S_Short; Y : S_Short) is begin Draw_Image (Crak, X, Y); Draw_Number (Seven, X, Y); end Draw_Crak7; procedure Draw_Crak8 (X : S_Short; Y : S_Short) is begin Draw_Image (Crak, X, Y); Draw_Number (Eight, X, Y); end Draw_Crak8; procedure Draw_Crak9 (X : S_Short; Y : S_Short) is begin Draw_Image (Crak, X, Y); Draw_Number (Nine, X, Y); end Draw_Crak9; end Tile;
nblk1=15 nid=0 hdr6=2a [0x00] rec0=22 rec1=00 rec2=01 rec3=046 [0x01] rec0=19 rec1=00 rec2=02 rec3=016 [0x02] rec0=00 rec1=00 rec2=15 rec3=004 [0x03] rec0=1d rec1=00 rec2=03 rec3=066 [0x04] rec0=1a rec1=00 rec2=04 rec3=004 [0x05] rec0=00 rec1=00 rec2=14 rec3=004 [0x06] rec0=15 rec1=00 rec2=05 rec3=042 [0x07] rec0=23 rec1=00 rec2=06 rec3=012 [0x08] rec0=26 rec1=00 rec2=07 rec3=01c [0x09] rec0=26 rec1=00 rec2=08 rec3=056 [0x0a] rec0=21 rec1=00 rec2=09 rec3=038 [0x0b] rec0=20 rec1=00 rec2=0a rec3=000 [0x0c] rec0=20 rec1=00 rec2=0b rec3=00a [0x0d] rec0=1a rec1=00 rec2=0c rec3=058 [0x0e] rec0=26 rec1=00 rec2=0d rec3=02c [0x0f] rec0=26 rec1=00 rec2=0e rec3=020 [0x10] rec0=20 rec1=00 rec2=0f rec3=066 [0x11] rec0=20 rec1=00 rec2=10 rec3=024 [0x12] rec0=1b rec1=00 rec2=11 rec3=070 [0x13] rec0=26 rec1=00 rec2=12 rec3=026 [0x14] rec0=19 rec1=00 rec2=13 rec3=000 tail 0x215009bd2819787995582 0x42a00088462063203