home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume18 / xsol / part03 < prev    next >
Encoding:
Text File  |  1992-07-29  |  50.2 KB  |  1,486 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!uunet!darwin.sura.net!mips!msi!dcmartin
  3. From: jvb7u@fermi.clas.Virginia.EDU (Jon Brinkmann)
  4. Subject: v18i070: xsol - solitare game for X windows, Part03/04
  5. Message-ID: <1992Jul29.175808.15338@msi.com>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Organization: Molecular Simulations, Inc.
  9. References: <csx-18i068-xsol@uunet.UU.NET>
  10. Date: Wed, 29 Jul 1992 17:58:08 GMT
  11. Approved: dcmartin@msi.com
  12. Lines: 1472
  13.  
  14. Submitted-by: jvb7u@fermi.clas.Virginia.EDU (Jon Brinkmann)
  15. Posting-number: Volume 18, Issue 70
  16. Archive-name: xsol/part03
  17.  
  18. #!/bin/sh
  19. # this is part.03 (part 3 of a multipart archive)
  20. # do not concatenate these parts, unpack them in order with /bin/sh
  21. # file cards.bm continued
  22. #
  23. if test ! -r _shar_seq_.tmp; then
  24.     echo 'Please unpack part 1 first!'
  25.     exit 1
  26. fi
  27. (read Scheck
  28.  if test "$Scheck" != 3; then
  29.     echo Please unpack part "$Scheck" next!
  30.     exit 1
  31.  else
  32.     exit 0
  33.  fi
  34. ) < _shar_seq_.tmp || exit 1
  35. if test ! -f _shar_wnt_.tmp; then
  36.     echo 'x - still skipping cards.bm'
  37. else
  38. echo 'x - continuing file cards.bm'
  39. sed 's/^X//' << 'SHAR_EOF' >> 'cards.bm' &&
  40. X   0x80, 0x01, 0xf8, 0x00, 0x3e, 0x80, 0x01, 0xfc, 0x01, 0x7f, 0x80, 0x01,
  41. X   0xfc, 0x01, 0x7f, 0x80, 0x01, 0xa8, 0x00, 0x2a, 0x80, 0x01, 0x20, 0x00,
  42. X   0x08, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80,
  43. X   0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x9f, 0x01, 0x00,
  44. X   0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x00, 0x88, 0x01, 0x00, 0x00, 0x00,
  45. X   0x88, 0x01, 0x00, 0x00, 0x00, 0x84, 0x01, 0x00, 0x00, 0x00, 0x84, 0x01,
  46. X   0x00, 0x00, 0x00, 0x82, 0x01, 0x00, 0x00, 0x00, 0x82, 0x01, 0x00, 0x00,
  47. X   0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
  48. X   0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00,
  49. X   0x00, 0x00, 0x80, 0x71, 0x00, 0x00, 0x00, 0x80, 0x89, 0x00, 0x00, 0x00,
  50. X   0x80, 0x89, 0x00, 0x00, 0x00, 0x80, 0x71, 0x00, 0x00, 0x00, 0x80, 0x89,
  51. X   0x00, 0x00, 0x00, 0x80, 0x89, 0x00, 0x00, 0x00, 0x80, 0x89, 0x00, 0x00,
  52. X   0x00, 0x80, 0x71, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80,
  53. X   0x01, 0x20, 0x00, 0x08, 0x80, 0x01, 0x70, 0x00, 0x1c, 0x80, 0x01, 0xf8,
  54. X   0x00, 0x3e, 0x80, 0x01, 0xfc, 0x01, 0x7f, 0x80, 0x01, 0xfc, 0x01, 0x7f,
  55. X   0x80, 0x01, 0xa8, 0x00, 0x2a, 0x80, 0x01, 0x20, 0x00, 0x08, 0x80, 0x01,
  56. X   0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00,
  57. X   0x00, 0x80, 0x01, 0x20, 0x00, 0x08, 0x80, 0x01, 0x70, 0x00, 0x1c, 0x80,
  58. X   0x01, 0xf8, 0x00, 0x3e, 0x80, 0x01, 0xfc, 0x01, 0x7f, 0x80, 0x01, 0xfc,
  59. X   0x01, 0x7f, 0x80, 0x01, 0xa8, 0x00, 0x2a, 0x80, 0x01, 0x20, 0x00, 0x08,
  60. X   0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01,
  61. X   0x00, 0x00, 0x00, 0x80, 0x01, 0x20, 0x00, 0x08, 0x80, 0x01, 0x70, 0x00,
  62. X   0x1c, 0x80, 0x01, 0xf8, 0x00, 0x3e, 0x80, 0x01, 0xfc, 0x01, 0x7f, 0x80,
  63. X   0x01, 0xfc, 0x01, 0x7f, 0x80, 0x01, 0xa8, 0x00, 0x2a, 0x80, 0x01, 0x20,
  64. X   0x00, 0x08, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00,
  65. X   0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x20, 0x00, 0x08, 0x80, 0x01,
  66. X   0x70, 0x00, 0x1c, 0x80, 0x01, 0xf8, 0x00, 0x3e, 0x80, 0x01, 0xfc, 0x01,
  67. X   0x7f, 0x80, 0x01, 0xfc, 0x01, 0x7f, 0x80, 0x01, 0xa8, 0x00, 0x2a, 0x80,
  68. X   0x01, 0x20, 0x00, 0x08, 0x80, 0x01, 0x00, 0x00, 0x00, 0x8e, 0x01, 0x00,
  69. X   0x00, 0x00, 0x91, 0x01, 0x00, 0x00, 0x00, 0x91, 0x01, 0x00, 0x00, 0x00,
  70. X   0x8e, 0x01, 0x00, 0x00, 0x00, 0x91, 0x01, 0x00, 0x00, 0x00, 0x91, 0x01,
  71. X   0x00, 0x00, 0x00, 0x91, 0x01, 0x00, 0x00, 0x00, 0x8e, 0x01, 0x00, 0x00,
  72. X   0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
  73. X   0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00,
  74. X   0x00, 0x00, 0x80, 0x71, 0x00, 0x00, 0x00, 0x80, 0x89, 0x00, 0x00, 0x00,
  75. X   0x80, 0x89, 0x00, 0x00, 0x00, 0x80, 0x89, 0x00, 0x00, 0x00, 0x80, 0xf1,
  76. X   0x00, 0x00, 0x00, 0x80, 0x81, 0x00, 0x00, 0x00, 0x80, 0x89, 0x00, 0x00,
  77. X   0x00, 0x80, 0x71, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80,
  78. X   0x01, 0x20, 0x00, 0x08, 0x80, 0x01, 0x70, 0x00, 0x1c, 0x80, 0x01, 0xf8,
  79. X   0x00, 0x3e, 0x80, 0x01, 0xfc, 0x01, 0x7f, 0x80, 0x01, 0xfc, 0x01, 0x7f,
  80. X   0x80, 0x01, 0xa8, 0x00, 0x2a, 0x80, 0x01, 0x20, 0x00, 0x08, 0x80, 0x01,
  81. X   0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00,
  82. X   0x00, 0x80, 0x01, 0x20, 0x00, 0x08, 0x80, 0x01, 0x70, 0x00, 0x1c, 0x80,
  83. X   0x01, 0xf8, 0x00, 0x3e, 0x80, 0x01, 0xfc, 0x01, 0x7f, 0x80, 0x01, 0xfc,
  84. X   0x01, 0x7f, 0x80, 0x01, 0xa8, 0x10, 0x2a, 0x80, 0x01, 0x20, 0x38, 0x08,
  85. X   0x80, 0x01, 0x00, 0x7c, 0x00, 0x80, 0x01, 0x00, 0xfe, 0x00, 0x80, 0x01,
  86. X   0x00, 0xfe, 0x00, 0x80, 0x01, 0x20, 0x54, 0x08, 0x80, 0x01, 0x70, 0x10,
  87. X   0x1c, 0x80, 0x01, 0xf8, 0x00, 0x3e, 0x80, 0x01, 0xfc, 0x01, 0x7f, 0x80,
  88. X   0x01, 0xfc, 0x01, 0x7f, 0x80, 0x01, 0xa8, 0x00, 0x2a, 0x80, 0x01, 0x20,
  89. X   0x00, 0x08, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00,
  90. X   0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x20, 0x00, 0x08, 0x80, 0x01,
  91. X   0x70, 0x00, 0x1c, 0x80, 0x01, 0xf8, 0x00, 0x3e, 0x80, 0x01, 0xfc, 0x01,
  92. X   0x7f, 0x80, 0x01, 0xfc, 0x01, 0x7f, 0x80, 0x01, 0xa8, 0x00, 0x2a, 0x80,
  93. X   0x01, 0x20, 0x00, 0x08, 0x80, 0x01, 0x00, 0x00, 0x00, 0x8e, 0x01, 0x00,
  94. X   0x00, 0x00, 0x91, 0x01, 0x00, 0x00, 0x00, 0x91, 0x01, 0x00, 0x00, 0x00,
  95. X   0x91, 0x01, 0x00, 0x00, 0x00, 0x9e, 0x01, 0x00, 0x00, 0x00, 0x90, 0x01,
  96. X   0x00, 0x00, 0x00, 0x91, 0x01, 0x00, 0x00, 0x00, 0x8e, 0x01, 0x00, 0x00,
  97. X   0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
  98. X   0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00,
  99. X   0x00, 0x00, 0x80, 0xc9, 0x00, 0x00, 0x00, 0x80, 0x29, 0x01, 0x00, 0x00,
  100. X   0x80, 0x29, 0x01, 0x00, 0x00, 0x80, 0x29, 0x01, 0x00, 0x00, 0x80, 0x29,
  101. X   0x01, 0x00, 0x00, 0x80, 0x29, 0x01, 0x00, 0x00, 0x80, 0x29, 0x01, 0x00,
  102. X   0x00, 0x80, 0xc9, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80,
  103. X   0x01, 0x20, 0x00, 0x08, 0x80, 0x01, 0x70, 0x00, 0x1c, 0x80, 0x01, 0xf8,
  104. X   0x00, 0x3e, 0x80, 0x01, 0xfc, 0x01, 0x7f, 0x80, 0x01, 0xfc, 0x01, 0x7f,
  105. X   0x80, 0x01, 0xa8, 0x10, 0x2a, 0x80, 0x01, 0x20, 0x38, 0x08, 0x80, 0x01,
  106. X   0x00, 0x7c, 0x00, 0x80, 0x01, 0x00, 0xfe, 0x00, 0x80, 0x01, 0x00, 0xfe,
  107. X   0x00, 0x80, 0x01, 0x20, 0x54, 0x08, 0x80, 0x01, 0x70, 0x10, 0x1c, 0x80,
  108. X   0x01, 0xf8, 0x00, 0x3e, 0x80, 0x01, 0xfc, 0x01, 0x7f, 0x80, 0x01, 0xfc,
  109. X   0x01, 0x7f, 0x80, 0x01, 0xa8, 0x00, 0x2a, 0x80, 0x01, 0x20, 0x00, 0x08,
  110. X   0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01,
  111. X   0x00, 0x00, 0x00, 0x80, 0x01, 0x20, 0x00, 0x08, 0x80, 0x01, 0x70, 0x00,
  112. X   0x1c, 0x80, 0x01, 0xf8, 0x00, 0x3e, 0x80, 0x01, 0xfc, 0x01, 0x7f, 0x80,
  113. X   0x01, 0xfc, 0x01, 0x7f, 0x80, 0x01, 0xa8, 0x10, 0x2a, 0x80, 0x01, 0x20,
  114. X   0x38, 0x08, 0x80, 0x01, 0x00, 0x7c, 0x00, 0x80, 0x01, 0x00, 0xfe, 0x00,
  115. X   0x80, 0x01, 0x00, 0xfe, 0x00, 0x80, 0x01, 0x20, 0x54, 0x08, 0x80, 0x01,
  116. X   0x70, 0x10, 0x1c, 0x80, 0x01, 0xf8, 0x00, 0x3e, 0x80, 0x01, 0xfc, 0x01,
  117. X   0x7f, 0x80, 0x01, 0xfc, 0x01, 0x7f, 0x80, 0x01, 0xa8, 0x00, 0x2a, 0x80,
  118. X   0x01, 0x20, 0x00, 0x08, 0x80, 0x01, 0x00, 0x00, 0x80, 0x8c, 0x01, 0x00,
  119. X   0x00, 0x80, 0x92, 0x01, 0x00, 0x00, 0x80, 0x92, 0x01, 0x00, 0x00, 0x80,
  120. X   0x92, 0x01, 0x00, 0x00, 0x80, 0x92, 0x01, 0x00, 0x00, 0x80, 0x92, 0x01,
  121. X   0x00, 0x00, 0x80, 0x92, 0x01, 0x00, 0x00, 0x80, 0x8c, 0x01, 0x00, 0x00,
  122. X   0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
  123. X   0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00,
  124. X   0x00, 0x00, 0x80, 0xc1, 0x01, 0x00, 0x00, 0x80, 0x81, 0x00, 0x00, 0x00,
  125. X   0x80, 0x81, 0x00, 0x00, 0x00, 0x80, 0x81, 0x00, 0x00, 0x00, 0x80, 0x81,
  126. X   0x00, 0x00, 0x00, 0x80, 0x89, 0x00, 0x00, 0x00, 0x80, 0x89, 0x00, 0x00,
  127. X   0x00, 0x80, 0x71, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80,
  128. X   0x01, 0x00, 0x00, 0x00, 0x80, 0x41, 0x00, 0x00, 0x00, 0x80, 0xe1, 0x00,
  129. X   0x00, 0x00, 0x80, 0xf1, 0x01, 0x00, 0x00, 0x80, 0xf9, 0x03, 0x00, 0x00,
  130. X   0x80, 0xf9, 0x03, 0x00, 0x00, 0x80, 0x51, 0x01, 0x00, 0x00, 0x80, 0x41,
  131. X   0x00, 0x00, 0x00, 0x80, 0x01, 0x20, 0x08, 0x02, 0x80, 0x01, 0x60, 0x14,
  132. X   0x03, 0x80, 0x01, 0xa0, 0xa2, 0x02, 0x80, 0x01, 0x20, 0x41, 0x02, 0x80,
  133. X   0x01, 0xe0, 0xff, 0x03, 0x80, 0x01, 0x20, 0x00, 0x02, 0x80, 0x01, 0x20,
  134. X   0x00, 0x02, 0x80, 0x01, 0xa0, 0xe3, 0x02, 0x80, 0x01, 0x20, 0x08, 0x02,
  135. X   0x80, 0x01, 0x20, 0x08, 0x02, 0x80, 0x01, 0x20, 0x08, 0x02, 0x80, 0x01,
  136. X   0x20, 0x1c, 0x02, 0x80, 0x01, 0x20, 0x00, 0x02, 0x80, 0x01, 0x40, 0x00,
  137. X   0x01, 0x80, 0x01, 0x40, 0x3e, 0x01, 0x80, 0x01, 0x80, 0x80, 0x00, 0x80,
  138. X   0x01, 0x80, 0x80, 0x00, 0x80, 0x01, 0x00, 0x41, 0x00, 0x80, 0x01, 0x00,
  139. X   0x3e, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00,
  140. X   0x82, 0x01, 0x00, 0x00, 0x00, 0x87, 0x01, 0x00, 0x00, 0x80, 0x8f, 0x01,
  141. X   0x00, 0x00, 0xc0, 0x9f, 0x01, 0x00, 0x00, 0xc0, 0x9f, 0x01, 0x00, 0x00,
  142. X   0x80, 0x8a, 0x01, 0x00, 0x00, 0x00, 0x82, 0x01, 0x00, 0x00, 0x00, 0x80,
  143. X   0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x9c, 0x01, 0x00,
  144. X   0x00, 0x00, 0x88, 0x01, 0x00, 0x00, 0x00, 0x88, 0x01, 0x00, 0x00, 0x00,
  145. X   0x88, 0x01, 0x00, 0x00, 0x00, 0x88, 0x01, 0x00, 0x00, 0x80, 0x88, 0x01,
  146. X   0x00, 0x00, 0x80, 0x88, 0x01, 0x00, 0x00, 0x00, 0x87, 0x01, 0x00, 0x00,
  147. X   0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
  148. X   0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00,
  149. X   0x00, 0x00, 0x80, 0xf1, 0x00, 0x00, 0x00, 0x80, 0x09, 0x01, 0x00, 0x00,
  150. X   0x80, 0x09, 0x01, 0x00, 0x00, 0x80, 0x09, 0x01, 0x00, 0x00, 0x80, 0x09,
  151. X   0x01, 0x00, 0x00, 0x80, 0x49, 0x01, 0x00, 0x00, 0x80, 0x89, 0x01, 0x00,
  152. X   0x00, 0x80, 0xf1, 0x00, 0x00, 0x00, 0x80, 0x01, 0x01, 0x00, 0x00, 0x80,
  153. X   0x01, 0x00, 0x00, 0x00, 0x80, 0x41, 0x00, 0x00, 0x00, 0x80, 0xe1, 0x00,
  154. X   0x00, 0x00, 0x80, 0xf1, 0x01, 0x00, 0x00, 0x80, 0xf9, 0x03, 0x00, 0x00,
  155. X   0x80, 0xf9, 0x03, 0x00, 0x00, 0x80, 0x51, 0x21, 0x22, 0x02, 0x80, 0x41,
  156. X   0x20, 0x22, 0x02, 0x80, 0x01, 0x50, 0x55, 0x05, 0x80, 0x01, 0x50, 0x55,
  157. X   0x05, 0x80, 0x01, 0x90, 0x88, 0x04, 0x80, 0x01, 0x10, 0x00, 0x04, 0x80,
  158. X   0x01, 0xf0, 0xff, 0x07, 0x80, 0x01, 0x30, 0x00, 0x06, 0x80, 0x01, 0x30,
  159. X   0x00, 0x06, 0x80, 0x01, 0xb0, 0xe3, 0x06, 0x80, 0x01, 0x30, 0x08, 0x06,
  160. X   0x80, 0x01, 0x30, 0x08, 0x06, 0x80, 0x01, 0x30, 0x08, 0x06, 0x80, 0x01,
  161. X   0x30, 0x1c, 0x06, 0x80, 0x01, 0x30, 0x00, 0x06, 0x80, 0x01, 0x70, 0x22,
  162. X   0x07, 0x80, 0x01, 0x70, 0x3e, 0x07, 0x80, 0x01, 0xf8, 0x80, 0x0f, 0x80,
  163. X   0x01, 0xfe, 0x80, 0x3f, 0x80, 0x01, 0x3c, 0x63, 0x1e, 0x80, 0x01, 0x00,
  164. X   0x1c, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00,
  165. X   0x82, 0x01, 0x00, 0x00, 0x00, 0x87, 0x01, 0x00, 0x00, 0x80, 0x8f, 0x01,
  166. X   0x00, 0x00, 0xc0, 0x9f, 0x01, 0x00, 0x00, 0xc0, 0x9f, 0x01, 0x00, 0x00,
  167. X   0x80, 0x8a, 0x01, 0x00, 0x00, 0x00, 0x82, 0x01, 0x00, 0x00, 0x00, 0x80,
  168. X   0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x01, 0x00,
  169. X   0x00, 0x80, 0x90, 0x01, 0x00, 0x00, 0x80, 0x90, 0x01, 0x00, 0x00, 0x80,
  170. X   0x90, 0x01, 0x00, 0x00, 0x80, 0x90, 0x01, 0x00, 0x00, 0x80, 0x94, 0x01,
  171. X   0x00, 0x00, 0x80, 0x98, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x01, 0x00, 0x00,
  172. X   0x00, 0x90, 0x01, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
  173. X   0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00,
  174. X   0x00, 0x00, 0x80, 0x89, 0x00, 0x00, 0x00, 0x80, 0x89, 0x00, 0x00, 0x00,
  175. X   0x80, 0x49, 0x00, 0x00, 0x00, 0x80, 0x29, 0x00, 0x00, 0x00, 0x80, 0x19,
  176. X   0x00, 0x00, 0x00, 0x80, 0x29, 0x00, 0x00, 0x00, 0x80, 0x49, 0x00, 0x00,
  177. X   0x00, 0x80, 0x89, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80,
  178. X   0x01, 0x00, 0x00, 0x00, 0x80, 0x41, 0x00, 0x00, 0x00, 0x80, 0xe1, 0x00,
  179. X   0x00, 0x00, 0x80, 0xf1, 0x01, 0x00, 0x00, 0x80, 0xf9, 0x03, 0x00, 0x00,
  180. X   0x80, 0xf9, 0x03, 0x00, 0x00, 0x80, 0x51, 0x21, 0x22, 0x02, 0x80, 0x41,
  181. X   0x20, 0x22, 0x02, 0x80, 0x01, 0x50, 0x55, 0x05, 0x80, 0x01, 0x50, 0x55,
  182. X   0x05, 0x80, 0x01, 0x90, 0x88, 0x04, 0x80, 0x01, 0x10, 0x00, 0x04, 0x80,
  183. X   0x01, 0xf0, 0xff, 0x07, 0x80, 0x01, 0x10, 0x00, 0x04, 0x80, 0x01, 0x10,
  184. X   0x00, 0x04, 0x80, 0x01, 0x90, 0xe3, 0x04, 0x80, 0x01, 0x10, 0x08, 0x04,
  185. X   0x80, 0x01, 0x10, 0x08, 0x04, 0x80, 0x01, 0x10, 0x08, 0x04, 0x80, 0x01,
  186. X   0x10, 0x1c, 0x04, 0x80, 0x01, 0x10, 0x00, 0x04, 0x80, 0x01, 0x30, 0x00,
  187. X   0x06, 0x80, 0x01, 0x20, 0x3e, 0x02, 0x80, 0x01, 0x60, 0x00, 0x03, 0x80,
  188. X   0x01, 0xc0, 0x80, 0x01, 0x80, 0x01, 0xc0, 0xe3, 0x01, 0x80, 0x01, 0x80,
  189. X   0xff, 0x00, 0x80, 0x01, 0x00, 0x7f, 0x00, 0x80, 0x01, 0x00, 0x7f, 0x00,
  190. X   0x82, 0x01, 0x00, 0x3e, 0x00, 0x87, 0x01, 0x00, 0x1c, 0x80, 0x8f, 0x01,
  191. X   0x00, 0x00, 0xc0, 0x9f, 0x01, 0x00, 0x00, 0xc0, 0x9f, 0x01, 0x00, 0x00,
  192. X   0x80, 0x8a, 0x01, 0x00, 0x00, 0x00, 0x82, 0x01, 0x00, 0x00, 0x00, 0x80,
  193. X   0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x91, 0x01, 0x00,
  194. X   0x00, 0x00, 0x91, 0x01, 0x00, 0x00, 0x00, 0x89, 0x01, 0x00, 0x00, 0x00,
  195. X   0x85, 0x01, 0x00, 0x00, 0x00, 0x83, 0x01, 0x00, 0x00, 0x00, 0x85, 0x01,
  196. X   0x00, 0x00, 0x00, 0x89, 0x01, 0x00, 0x00, 0x00, 0x91, 0x01, 0x00, 0x00,
  197. X   0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff};
  198. SHAR_EOF
  199. echo 'File cards.bm is complete' &&
  200. chmod 0644 cards.bm ||
  201. echo 'restore of cards.bm failed'
  202. Wc_c="`wc -c < 'cards.bm'`"
  203. test 97581 -eq "$Wc_c" ||
  204.     echo 'cards.bm: original size 97581, current size' "$Wc_c"
  205. rm -f _shar_wnt_.tmp
  206. fi
  207. # ============= club.bm ==============
  208. if test -f 'club.bm' -a X"$1" != X"-c"; then
  209.     echo 'x - skipping club.bm (File already exists)'
  210.     rm -f _shar_wnt_.tmp
  211. else
  212. > _shar_wnt_.tmp
  213. echo 'x - extracting club.bm (Text)'
  214. sed 's/^X//' << 'SHAR_EOF' > 'club.bm' &&
  215. #define club_width 11
  216. #define club_height 11
  217. static char club_bits[] = {
  218. X   0x20, 0x00, 0x70, 0x00, 0xf8, 0x00, 0x74, 0x01, 0xae, 0x03, 0xff, 0x07,
  219. X   0xae, 0x03, 0x24, 0x01, 0x20, 0x00, 0x20, 0x00, 0x70, 0x00};
  220. SHAR_EOF
  221. chmod 0644 club.bm ||
  222. echo 'restore of club.bm failed'
  223. Wc_c="`wc -c < 'club.bm'`"
  224. test 212 -eq "$Wc_c" ||
  225.     echo 'club.bm: original size 212, current size' "$Wc_c"
  226. rm -f _shar_wnt_.tmp
  227. fi
  228. # ============= cursor.bm ==============
  229. if test -f 'cursor.bm' -a X"$1" != X"-c"; then
  230.     echo 'x - skipping cursor.bm (File already exists)'
  231.     rm -f _shar_wnt_.tmp
  232. else
  233. > _shar_wnt_.tmp
  234. echo 'x - extracting cursor.bm (Text)'
  235. sed 's/^X//' << 'SHAR_EOF' > 'cursor.bm' &&
  236. #define cursor_width 16
  237. #define cursor_height 16
  238. #define cursor_x_hot 2
  239. #define cursor_y_hot 0
  240. static char cursor_bits[] = {
  241. X   0x1c, 0x00, 0x24, 0x00, 0x48, 0x00, 0x90, 0x10, 0x20, 0x29, 0x70, 0x2a,
  242. X   0x90, 0x2c, 0x1c, 0x21, 0x64, 0x20, 0x0a, 0x20, 0x32, 0x40, 0x04, 0x40,
  243. X   0x18, 0x80, 0x60, 0x40, 0x80, 0x21, 0x00, 0x1e};
  244. SHAR_EOF
  245. chmod 0644 cursor.bm ||
  246. echo 'restore of cursor.bm failed'
  247. Wc_c="`wc -c < 'cursor.bm'`"
  248. test 327 -eq "$Wc_c" ||
  249.     echo 'cursor.bm: original size 327, current size' "$Wc_c"
  250. rm -f _shar_wnt_.tmp
  251. fi
  252. # ============= diamond.bm ==============
  253. if test -f 'diamond.bm' -a X"$1" != X"-c"; then
  254.     echo 'x - skipping diamond.bm (File already exists)'
  255.     rm -f _shar_wnt_.tmp
  256. else
  257. > _shar_wnt_.tmp
  258. echo 'x - extracting diamond.bm (Text)'
  259. sed 's/^X//' << 'SHAR_EOF' > 'diamond.bm' &&
  260. #define diamond_width 11
  261. #define diamond_height 11
  262. static char diamond_bits[] = {
  263. X   0x20, 0x00, 0x70, 0x00, 0xf8, 0x00, 0xfc, 0x01, 0xfe, 0x03, 0xff, 0x07,
  264. X   0xfe, 0x03, 0xfc, 0x01, 0xf8, 0x00, 0x70, 0x00, 0x20, 0x00};
  265. SHAR_EOF
  266. chmod 0644 diamond.bm ||
  267. echo 'restore of diamond.bm failed'
  268. Wc_c="`wc -c < 'diamond.bm'`"
  269. test 221 -eq "$Wc_c" ||
  270.     echo 'diamond.bm: original size 221, current size' "$Wc_c"
  271. rm -f _shar_wnt_.tmp
  272. fi
  273. # ============= draw.bm ==============
  274. if test -f 'draw.bm' -a X"$1" != X"-c"; then
  275.     echo 'x - skipping draw.bm (File already exists)'
  276.     rm -f _shar_wnt_.tmp
  277. else
  278. > _shar_wnt_.tmp
  279. echo 'x - extracting draw.bm (Text)'
  280. sed 's/^X//' << 'SHAR_EOF' > 'draw.bm' &&
  281. #define draw_width 16
  282. #define draw_height 16
  283. static short draw_bits[] = {
  284. X   0x8181, 0x4242, 0x2424, 0x1818,
  285. X   0x1818, 0x2424, 0x4242, 0x8181,
  286. X   0x8181, 0x4242, 0x2424, 0x1818,
  287. X   0x1818, 0x2424, 0x4242, 0x8181};
  288. SHAR_EOF
  289. chmod 0644 draw.bm ||
  290. echo 'restore of draw.bm failed'
  291. Wc_c="`wc -c < 'draw.bm'`"
  292. test 215 -eq "$Wc_c" ||
  293.     echo 'draw.bm: original size 215, current size' "$Wc_c"
  294. rm -f _shar_wnt_.tmp
  295. fi
  296. # ============= draw2.bm ==============
  297. if test -f 'draw2.bm' -a X"$1" != X"-c"; then
  298.     echo 'x - skipping draw2.bm (File already exists)'
  299.     rm -f _shar_wnt_.tmp
  300. else
  301. > _shar_wnt_.tmp
  302. echo 'x - extracting draw2.bm (Text)'
  303. sed 's/^X//' << 'SHAR_EOF' > 'draw2.bm' &&
  304. #define draw2_width 16
  305. #define draw2_height 16
  306. static char draw2_bits[] = {
  307. X   0x81, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24,
  308. X   0x42, 0x42, 0x81, 0x81, 0x81, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18,
  309. X   0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0x81, 0x81};
  310. SHAR_EOF
  311. chmod 0644 draw2.bm ||
  312. echo 'restore of draw2.bm failed'
  313. Wc_c="`wc -c < 'draw2.bm'`"
  314. test 278 -eq "$Wc_c" ||
  315.     echo 'draw2.bm: original size 278, current size' "$Wc_c"
  316. rm -f _shar_wnt_.tmp
  317. fi
  318. # ============= exit.bm ==============
  319. if test -f 'exit.bm' -a X"$1" != X"-c"; then
  320.     echo 'x - skipping exit.bm (File already exists)'
  321.     rm -f _shar_wnt_.tmp
  322. else
  323. > _shar_wnt_.tmp
  324. echo 'x - extracting exit.bm (Text)'
  325. sed 's/^X//' << 'SHAR_EOF' > 'exit.bm' &&
  326. #define exit_width 48
  327. #define exit_height 16
  328. static char exit_bits[] = {
  329. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  330. X   0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
  331. X   0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
  332. X   0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x92, 0x0f, 0x00,
  333. X   0x00, 0xe0, 0x23, 0x12, 0x02, 0x00, 0x00, 0x20, 0x40, 0x11, 0x02, 0x00,
  334. X   0x00, 0x20, 0x80, 0x10, 0x02, 0x00, 0x00, 0x20, 0x40, 0x11, 0x02, 0x00,
  335. X   0x00, 0x20, 0x20, 0x12, 0x02, 0x00, 0x00, 0xe0, 0x27, 0x12, 0x02, 0x00,
  336. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  337. SHAR_EOF
  338. chmod 0644 exit.bm ||
  339. echo 'restore of exit.bm failed'
  340. Wc_c="`wc -c < 'exit.bm'`"
  341. test 674 -eq "$Wc_c" ||
  342.     echo 'exit.bm: original size 674, current size' "$Wc_c"
  343. rm -f _shar_wnt_.tmp
  344. fi
  345. # ============= flip.bm ==============
  346. if test -f 'flip.bm' -a X"$1" != X"-c"; then
  347.     echo 'x - skipping flip.bm (File already exists)'
  348.     rm -f _shar_wnt_.tmp
  349. else
  350. > _shar_wnt_.tmp
  351. echo 'x - extracting flip.bm (Text)'
  352. sed 's/^X//' << 'SHAR_EOF' > 'flip.bm' &&
  353. #define flip_width 48
  354. #define flip_height 16
  355. static char flip_bits[] = {
  356. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  357. X   0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
  358. X   0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
  359. X   0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x90, 0x07, 0x00,
  360. X   0x00, 0xe0, 0x23, 0x90, 0x08, 0x00, 0x00, 0x20, 0x20, 0x90, 0x08, 0x00,
  361. X   0x00, 0x20, 0x20, 0x90, 0x07, 0x00, 0x00, 0x20, 0x20, 0x90, 0x00, 0x00,
  362. X   0x00, 0x20, 0x20, 0x90, 0x00, 0x00, 0x00, 0x20, 0xe0, 0x93, 0x00, 0x00,
  363. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  364. SHAR_EOF
  365. chmod 0644 flip.bm ||
  366. echo 'restore of flip.bm failed'
  367. Wc_c="`wc -c < 'flip.bm'`"
  368. test 674 -eq "$Wc_c" ||
  369.     echo 'flip.bm: original size 674, current size' "$Wc_c"
  370. rm -f _shar_wnt_.tmp
  371. fi
  372. # ============= gray3.bitmap ==============
  373. if test -f 'gray3.bitmap' -a X"$1" != X"-c"; then
  374.     echo 'x - skipping gray3.bitmap (File already exists)'
  375.     rm -f _shar_wnt_.tmp
  376. else
  377. > _shar_wnt_.tmp
  378. echo 'x - extracting gray3.bitmap (Text)'
  379. sed 's/^X//' << 'SHAR_EOF' > 'gray3.bitmap' &&
  380. #define gray3_width 16
  381. #define gray3_height 16
  382. static char gray3_bits[] = {
  383. X   0x11, 0x11, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00,
  384. X   0x44, 0x44, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00,
  385. X   0x11, 0x11, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00};
  386. SHAR_EOF
  387. chmod 0644 gray3.bitmap ||
  388. echo 'restore of gray3.bitmap failed'
  389. Wc_c="`wc -c < 'gray3.bitmap'`"
  390. test 278 -eq "$Wc_c" ||
  391.     echo 'gray3.bitmap: original size 278, current size' "$Wc_c"
  392. rm -f _shar_wnt_.tmp
  393. fi
  394. # ============= heart.bm ==============
  395. if test -f 'heart.bm' -a X"$1" != X"-c"; then
  396.     echo 'x - skipping heart.bm (File already exists)'
  397.     rm -f _shar_wnt_.tmp
  398. else
  399. > _shar_wnt_.tmp
  400. echo 'x - extracting heart.bm (Text)'
  401. sed 's/^X//' << 'SHAR_EOF' > 'heart.bm' &&
  402. #define heart_width 11
  403. #define heart_height 11
  404. static char heart_bits[] = {
  405. X   0x8c, 0xf9, 0xde, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  406. X   0xfe, 0xfb, 0xfc, 0xf9, 0xf8, 0xf8, 0x70, 0xf8, 0x20, 0xf8};
  407. SHAR_EOF
  408. chmod 0644 heart.bm ||
  409. echo 'restore of heart.bm failed'
  410. Wc_c="`wc -c < 'heart.bm'`"
  411. test 215 -eq "$Wc_c" ||
  412.     echo 'heart.bm: original size 215, current size' "$Wc_c"
  413. rm -f _shar_wnt_.tmp
  414. fi
  415. # ============= mkPixmap.c ==============
  416. if test -f 'mkPixmap.c' -a X"$1" != X"-c"; then
  417.     echo 'x - skipping mkPixmap.c (File already exists)'
  418.     rm -f _shar_wnt_.tmp
  419. else
  420. > _shar_wnt_.tmp
  421. echo 'x - extracting mkPixmap.c (Text)'
  422. sed 's/^X//' << 'SHAR_EOF' > 'mkPixmap.c' &&
  423. #include    <X11/Xlib.h>
  424. X
  425. Pixmap 
  426. MakePixmap(dpy, scr, root, data, width, height, ximage)
  427. Display    *dpy;
  428. int    scr;
  429. Drawable root;
  430. short *data;
  431. int width, height;
  432. XXImage    *ximage;
  433. {
  434. X    GC pgc;
  435. X    XGCValues gcv;
  436. X    Pixmap pid;
  437. X
  438. X    pid = XCreatePixmap(dpy, root, width, height, DefaultDepth(dpy, scr));
  439. X
  440. X    gcv.foreground = BlackPixel(dpy, scr);
  441. X    gcv.background = WhitePixel(dpy, scr);
  442. X    pgc = XCreateGC(dpy, pid, GCForeground | GCBackground, &gcv);
  443. X
  444. X    ximage->height = height;
  445. X    ximage->width = width;
  446. X    ximage->xoffset = 0;
  447. X    ximage->format = XYBitmap;
  448. X    ximage->data = (char *)data;
  449. X    ximage->byte_order = LSBFirst;
  450. X    ximage->bitmap_unit = 16;
  451. X    ximage->bitmap_bit_order = LSBFirst;
  452. X    ximage->bitmap_pad = 16;
  453. X    ximage->bytes_per_line = (width+7)/8;
  454. X    ximage->depth = 1;
  455. X
  456. X    XPutImage(dpy, pid, pgc, ximage, 0, 0, 0, 0, width, height);
  457. X    XFreeGC(dpy, pgc);
  458. X    return(pid);
  459. }
  460. X
  461. MakeImage(width, height, data, ximage)
  462. int    width, height;
  463. char    *data;
  464. XXImage    *ximage;
  465. {
  466. X    ximage->height = height;
  467. X    ximage->width = width;
  468. X    ximage->xoffset = 0;
  469. X    ximage->format = XYBitmap;
  470. X    ximage->data = (char *)data;
  471. X    ximage->byte_order = LSBFirst;
  472. X    ximage->bitmap_unit = 16;
  473. X    ximage->bitmap_bit_order = LSBFirst;
  474. X    ximage->bitmap_pad = 16;
  475. X    ximage->bytes_per_line = (width+7)/8;
  476. X    ximage->depth = 1;
  477. }
  478. SHAR_EOF
  479. chmod 0644 mkPixmap.c ||
  480. echo 'restore of mkPixmap.c failed'
  481. Wc_c="`wc -c < 'mkPixmap.c'`"
  482. test 1341 -eq "$Wc_c" ||
  483.     echo 'mkPixmap.c: original size 1341, current size' "$Wc_c"
  484. rm -f _shar_wnt_.tmp
  485. fi
  486. # ============= restart.bm ==============
  487. if test -f 'restart.bm' -a X"$1" != X"-c"; then
  488.     echo 'x - skipping restart.bm (File already exists)'
  489.     rm -f _shar_wnt_.tmp
  490. else
  491. > _shar_wnt_.tmp
  492. echo 'x - extracting restart.bm (Text)'
  493. sed 's/^X//' << 'SHAR_EOF' > 'restart.bm' &&
  494. #define restart_width 48
  495. #define restart_height 16
  496. static char restart_bits[] = {
  497. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  498. X   0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00,
  499. X   0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00,
  500. X   0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x84, 0x78, 0x9c, 0x8f, 0x71, 0x7c,
  501. X   0x7c, 0x08, 0x02, 0x42, 0x92, 0x10, 0x44, 0x08, 0x02, 0x42, 0x92, 0x10,
  502. X   0x44, 0x38, 0x0c, 0xc2, 0x73, 0x10, 0x84, 0x08, 0x10, 0x42, 0x52, 0x10,
  503. X   0x84, 0x08, 0x10, 0x42, 0x92, 0x10, 0x04, 0x79, 0x0e, 0x42, 0x92, 0x10,
  504. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  505. SHAR_EOF
  506. chmod 0644 restart.bm ||
  507. echo 'restore of restart.bm failed'
  508. Wc_c="`wc -c < 'restart.bm'`"
  509. test 683 -eq "$Wc_c" ||
  510.     echo 'restart.bm: original size 683, current size' "$Wc_c"
  511. rm -f _shar_wnt_.tmp
  512. fi
  513. # ============= spade.bm ==============
  514. if test -f 'spade.bm' -a X"$1" != X"-c"; then
  515.     echo 'x - skipping spade.bm (File already exists)'
  516.     rm -f _shar_wnt_.tmp
  517. else
  518. > _shar_wnt_.tmp
  519. echo 'x - extracting spade.bm (Text)'
  520. sed 's/^X//' << 'SHAR_EOF' > 'spade.bm' &&
  521. #define spade_width 11
  522. #define spade_height 11
  523. static char spade_bits[] = {
  524. X   0x20, 0x00, 0x70, 0x00, 0xf8, 0x00, 0xfc, 0x01, 0xfe, 0x03, 0xff, 0x07,
  525. X   0xff, 0x07, 0xff, 0x07, 0xae, 0x03, 0x20, 0x00, 0x70, 0x00};
  526. SHAR_EOF
  527. chmod 0644 spade.bm ||
  528. echo 'restore of spade.bm failed'
  529. Wc_c="`wc -c < 'spade.bm'`"
  530. test 215 -eq "$Wc_c" ||
  531.     echo 'spade.bm: original size 215, current size' "$Wc_c"
  532. rm -f _shar_wnt_.tmp
  533. fi
  534. # ============= xsol.c ==============
  535. if test -f 'xsol.c' -a X"$1" != X"-c"; then
  536.     echo 'x - skipping xsol.c (File already exists)'
  537.     rm -f _shar_wnt_.tmp
  538. else
  539. > _shar_wnt_.tmp
  540. echo 'x - extracting xsol.c (Text)'
  541. sed 's/^X//' << 'SHAR_EOF' > 'xsol.c' &&
  542. /*
  543. X * solitaire.c - A simple solitaire card game for X Windows. 
  544. X * Written by David W. Burleigh, April 1987, for the 
  545. X * Workstation Sales Support Training.
  546. X * 
  547. X */
  548. /*
  549. X * Converted to handle B & W displays 
  550. X * Dave Lemke, 
  551. X * 7/13/87, 
  552. X * UCDavis Computer Science
  553. X * 
  554. X * 
  555. X * Args: 
  556. X * hostname:display -r    
  557. X * -r    flag to turn off black cards reversed in B & W 
  558. X *    - makes them simpler to read
  559. X */
  560. /*
  561. X * converted to X11, 7/16/87 - 8/6/87 Dave Lemke
  562. X */
  563. /*
  564. X * Final conversion work, optimizing, cleanup:
  565. X * Dave Lemke
  566. X * lemke@sun.com
  567. X * Wed Jul 20 21:52:00 PDT 1988
  568. X */
  569. X
  570. /************************************************************
  571. Copyright 1988 by Sun Microsystems, Inc. Mountain View, CA.
  572. X
  573. X        All Rights Reserved
  574. X
  575. Permission to use, copy, modify, and distribute this software and its
  576. documentation for any purpose and without fee is hereby granted, 
  577. provided that the above copyright notice appear in all copies and that
  578. both that copyright notice and this permission notice appear in 
  579. supporting documentation, and that the names of Sun or MIT not be
  580. used in advertising or publicity pertaining to distribution of the
  581. software without specific prior written permission. Sun and M.I.T. 
  582. make no representations about the suitability of this software for 
  583. any purpose. It is provided "as is" without any express or implied warranty.
  584. X
  585. SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  586. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  587. PURPOSE. IN NO EVENT SHALL SUN BE LIABLE FOR ANY SPECIAL, INDIRECT
  588. OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
  589. OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
  590. OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  591. OR PERFORMANCE OF THIS SOFTWARE.
  592. ************************************************************/
  593. X
  594. #include <X11/Xos.h>
  595. #include <X11/Xlib.h>
  596. #include <X11/X10.h>
  597. #include <X11/Xatom.h>
  598. #include <X11/Xutil.h>
  599. #include <stdio.h>
  600. #include <strings.h>
  601. #include "cards.bm"        /* Bitmaps for playing cards */
  602. #include "draw.bm"        /* Bitmap for back of card deck */
  603. #include "heart.bm"        /* Bitmaps for suits */
  604. #include "club.bm"
  605. #include "diamond.bm"
  606. #include "spade.bm"
  607. #include "cursor.bm"        /* Bitmap for cursor */
  608. #include "restart.bm"        /* Bitmap for Restart button */
  609. #include "flip.bm"        /* Bitmap for Flip button - Added JB */
  610. #include "exit.bm"        /* Bitmap for Exit button */
  611. X
  612. #include "gray3.bitmap"    /* bitmap for B & W background */
  613. X
  614. #define    Border_width    3
  615. #define    Defwidth    360    /* Default dimensions for window */
  616. #define    Defheight    500
  617. #define    Offset        25    /* y offset for stacking cards */
  618. X
  619. #define    Hearts        0
  620. #define    Diamonds    1
  621. #define    Clubs        2
  622. #define    Spades        3
  623. X
  624. #define    Ace        1
  625. #define    King        13
  626. X
  627. #define    Draw        52    /* Array index for draw window */
  628. X
  629. int ndeck;            /* Number of cards in deck - Added JB */
  630. X
  631. struct Card {
  632. X    Window          self;    /* window id */
  633. X    short           suit;    /* Hearts,Diamonds,Clubs,Spades */
  634. X    short           value;    /* Ace,2,3,4,5,6,7,8,9,10,Jack,Queen,King */
  635. X    short           x, y;    /* Origin coordinates */
  636. X    short           stack;    /* Indicates which stack the card is in */
  637. X    struct Card    *prev;    /* Points to previous stacked card */
  638. X    struct Card    *next;    /* Points to next stacked card */
  639. X    XImage          image;    /* windows image */
  640. }               deck[Draw];
  641. struct Card     card_window;
  642. X
  643. struct {            /* Locations for stacking card windows */
  644. X    short           x, y;
  645. X    short           count;
  646. }               stack[12] = {
  647. X    59, 9, 52, 
  648. X    9, 79, 0, 
  649. X    59, 79, 0, 
  650. X    109, 79, 0,
  651. X    159, 79, 0, 
  652. X    209, 79, 0, 
  653. X    259, 79, 0, 
  654. X    309, 79, 0,
  655. X    129, 9, 0, 
  656. X    179, 9, 0, 
  657. X    229, 9, 0, 
  658. X    279, 9, 0
  659. };
  660. X
  661. #define    CNULL    (struct Card *) 0
  662. X
  663. #define    TRUE    1
  664. #define    FALSE    0
  665. X
  666. short           iscolor = False;
  667. short           rflag = 42;
  668. X
  669. short           order[Draw][2];    /* Shuffling array */
  670. X
  671. XXAssocTable    *Key;        /* Pointer to the association table for
  672. X                 * matching windows to data structures */
  673. X
  674. static XColor   foreground = {0L, 65535, 65535, 65535};
  675. static XColor   bground = {0L, 0, 0, 0};
  676. X
  677. XXColor          Red, Green, Black, White;
  678. Window          Table, Restart, Exit;    /* Display window and button ids */
  679. Window        Flip;            /* Added JB */
  680. GC              gc, rgc, Redgc, out_gc;
  681. XXImage          res_image, exit_image;
  682. XXImage        flip_image;        /* Added JB */
  683. Pixmap          background, draw_pixmap;
  684. Pixmap        icon_pixmap;
  685. Atom        protocol_atom, kill_atom;
  686. X
  687. Bool    have_card = False;
  688. Bool    no_drag = False;
  689. X
  690. #define    Usage    {fprintf(stderr, "xsol: [-d display] [-r] [-nodrag]\n"); exit(0);}
  691. X
  692. Display        *dpy;
  693. int             screen;
  694. X
  695. main(argc, argv)
  696. X    int             argc;    /* Number of arguments  */
  697. X    char           *argv[];    /* Array of pointers to arguments          */
  698. {
  699. X    register int    i;
  700. X    Pixmap          cursor_bitmap;
  701. X    struct Card    *from = (struct Card *) 0,
  702. X               *to = (struct Card *) 0;    /* User-selected cards */
  703. X    char           *display = NULL;
  704. X    XImage          timage;
  705. X    char           *progname;
  706. X    XSizeHints    hints;
  707. X
  708. X    progname = argv[0];
  709. X    for (i = 1; i < argc; i++) {
  710. X        if (index(argv[i], ':'))
  711. X            display = argv[i];
  712. X        else if (strncmp(argv[i], "-d", 2) == 0)    {
  713. X            if (argv[++i])
  714. X                display = argv[i];
  715. X            else Usage;
  716. X        }
  717. X        else if (strncmp(argv[i], "-r", 2) == 0)
  718. X            rflag = 1;
  719. X        else if (strncmp(argv[i], "+r", 2) == 0)
  720. X            rflag = 0;
  721. X        else if (strncmp(argv[i], "-n", 2) == 0)
  722. X            no_drag = True;
  723. X        else
  724. X            Usage;
  725. X    }
  726. X
  727. X    if (!(dpy = XOpenDisplay(display))) {
  728. X        fprintf(stderr, "%s: Can't open display.\n", progname);
  729. X        exit(1);
  730. X    }
  731. X    screen = DefaultScreen(dpy);
  732. X
  733. X    gc = XCreateGC(dpy, RootWindow(dpy, screen), 0, NULL);
  734. X    rgc = XCreateGC(dpy, RootWindow(dpy, screen), 0, NULL);
  735. X    Redgc = XCreateGC(dpy, RootWindow(dpy, screen), 0, NULL);
  736. X    out_gc = XCreateGC(dpy, RootWindow(dpy, screen), 0, NULL);
  737. X
  738. X    XSetForeground(dpy, gc, BlackPixel(dpy, screen));
  739. X    XSetForeground(dpy, rgc, WhitePixel(dpy, screen));
  740. X
  741. X    XSetBackground(dpy, gc, WhitePixel(dpy, screen));
  742. X    XSetBackground(dpy, rgc, BlackPixel(dpy, screen));
  743. X
  744. X    XSetForeground(dpy, out_gc, BlackPixel(dpy, screen));
  745. X    XSetFunction(dpy, out_gc, GXxor);
  746. X    XSetSubwindowMode(dpy, out_gc, IncludeInferiors);
  747. X
  748. X    if (DisplayCells(dpy, screen) > 2)
  749. X        iscolor = TRUE;
  750. X    if (iscolor) {
  751. X        XAllocNamedColor(dpy, DefaultColormap(dpy, screen),
  752. X                 "red", &Red, &Red);
  753. X        XAllocNamedColor(dpy, DefaultColormap(dpy, screen),
  754. X                 "green", &Green, &Green);
  755. X        XAllocNamedColor(dpy, DefaultColormap(dpy, screen),
  756. X                 "black", &Black, &Black);
  757. X        XAllocNamedColor(dpy, DefaultColormap(dpy, screen),
  758. X                 "white", &White, &White);
  759. X        XSetForeground(dpy, Redgc, Red.pixel);
  760. X        XSetBackground(dpy, Redgc, White.pixel);
  761. X        if (rflag == 42)
  762. X            rflag = 0;
  763. X    }
  764. X    if (!iscolor && rflag == 42)
  765. X        rflag = 1;
  766. X        
  767. X    /* Fill in parent window parameters */
  768. X
  769. X    if (!iscolor) {
  770. X        background = MakePixmap(dpy, screen, RootWindow(dpy, screen),
  771. X                gray3_bits, gray3_width, gray3_height, &timage);
  772. X    }
  773. X    /* Store pixmaps for tiling areas */
  774. X
  775. X    draw_pixmap = MakePixmap(dpy, screen, RootWindow(dpy, screen),
  776. X                   draw_bits, draw_width, draw_height, &timage);
  777. X
  778. X    icon_pixmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
  779. X        32, 32, DefaultDepth(dpy, screen));
  780. X
  781. X    {
  782. X    XImage    temp;
  783. X    GC    redgc = (iscolor) ? Redgc : gc;
  784. X    GC    icon_gc, redicon_gc;
  785. X
  786. X    icon_gc = XCreateGC(dpy, icon_pixmap, 0, NULL);
  787. X    redicon_gc = XCreateGC(dpy, icon_pixmap, 0, NULL);
  788. X    if (iscolor)    {
  789. X        XSetForeground(dpy, icon_gc, Green.pixel);
  790. X        XFillRectangle(dpy, icon_pixmap, icon_gc, 0, 0, 32, 32);
  791. X        XSetForeground(dpy, redicon_gc, Red.pixel);
  792. X        XSetBackground(dpy, redicon_gc, Green.pixel);
  793. X        XSetForeground(dpy, icon_gc, BlackPixel(dpy, screen));
  794. X        XSetBackground(dpy, icon_gc, Green.pixel);
  795. X    } else    {
  796. X        XSetForeground(dpy, icon_gc, WhitePixel(dpy, screen));
  797. X        XSetBackground(dpy, icon_gc, WhitePixel(dpy, screen));
  798. X        XSetBackground(dpy, redicon_gc, WhitePixel(dpy, screen));
  799. X        XFillRectangle(dpy, icon_pixmap, icon_gc, 0, 0, 32, 32);
  800. X        XSetForeground(dpy, icon_gc, BlackPixel(dpy, screen));
  801. X        XSetForeground(dpy, redicon_gc, BlackPixel(dpy, screen));
  802. X    }
  803. X
  804. X    MakeImage(spade_width, spade_height, spade_bits, &temp);
  805. X    XPutImage(dpy, icon_pixmap, icon_gc, &temp, 0, 0, 2, 2, 
  806. X        spade_width, spade_height);
  807. X    MakeImage(heart_width, heart_height, heart_bits, &temp);
  808. X    XPutImage(dpy, icon_pixmap, redicon_gc, &temp, 0, 0, 17, 2, 
  809. X        heart_width, heart_height);
  810. X    MakeImage(club_width, club_height, club_bits, &temp);
  811. X    XPutImage(dpy, icon_pixmap, icon_gc, &temp, 0, 0, 17, 17, 
  812. X        club_width, club_height);
  813. X    MakeImage(diamond_width, diamond_height, diamond_bits, &temp);
  814. X    XPutImage(dpy, icon_pixmap, redicon_gc, &temp, 0, 0, 2, 17, 
  815. X        diamond_width, diamond_height);
  816. X    XFreeGC(dpy, icon_gc);
  817. X    XFreeGC(dpy, redicon_gc);
  818. X    }
  819. X
  820. X    /* Try to create the display window and icon window */
  821. X
  822. X    Table = XCreateSimpleWindow(dpy, RootWindow(dpy, screen), 100, 100,
  823. X         Defwidth, Defheight, Border_width, BlackPixel(dpy, screen),
  824. X                    BlackPixel(dpy, screen));
  825. X    if (iscolor)
  826. X        XSetWindowBackground(dpy, Table, Green.pixel);
  827. X    else
  828. X        XSetWindowBackgroundPixmap(dpy, Table, background);
  829. X
  830. X    protocol_atom = XInternAtom(dpy, "WM_PROTOCOLS", False);
  831. X    kill_atom = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
  832. X    XSetWMProtocols(dpy, Table, &kill_atom, 1);
  833. X
  834. X    if (!Table) {
  835. X        fprintf(stderr, "%s: can't create display window.\n", progname);
  836. X        exit(1);
  837. X    }
  838. X    
  839. X    hints.flags = PSize | PMinSize | PMaxSize;
  840. X    /* doesn't like to be resized */
  841. X    hints.width = hints.min_width = hints.max_width = Defwidth;
  842. X    hints.height = hints.min_height = hints.max_height = Defheight;
  843. X
  844. X    XSetStandardProperties(dpy, Table, "Xsol", "Xsol", icon_pixmap,
  845. X        argv, argc, &hints);
  846. X
  847. X    /* Create windows for Restart and Exit buttons */
  848. X
  849. X    Restart = XCreateSimpleWindow(dpy, Table, 0, Defheight - restart_height,
  850. X        restart_width, restart_height, 1, BlackPixel(dpy, screen), 
  851. X        WhitePixel(dpy, screen));
  852. X    MakeImage(restart_width, restart_height, restart_bits, &res_image);
  853. X
  854. X    Exit = XCreateSimpleWindow(dpy, Table, Defwidth - exit_width,
  855. X        Defheight - exit_height, exit_width, exit_height,
  856. X        1, BlackPixel(dpy, screen), WhitePixel(dpy, screen));
  857. X    MakeImage(exit_width, exit_height, exit_bits, &exit_image);
  858. X
  859. /* ++    Create window for Flip button - Added by Jon Brinkmann 7/20/90 */
  860. X
  861. X    Flip = XCreateSimpleWindow(dpy, Table, (Defwidth - flip_width) / 2,
  862. X        Defheight - flip_height, flip_width, flip_height, 1,
  863. X        BlackPixel(dpy, screen), WhitePixel(dpy, screen));
  864. X    MakeImage(flip_width, flip_height, flip_bits, &flip_image);
  865. X    if (!(Restart && Flip && Exit)) {
  866. /* -- */
  867. /*    if (!(Restart && Exit)) { */
  868. X        fprintf(stderr, "%s: can't create button subwindows.\n", 
  869. X            progname);
  870. X        exit(1);
  871. X    }
  872. X
  873. X    /* Associate the cursor with the display window */
  874. X    cursor_bitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
  875. X        cursor_bits, cursor_width, cursor_height);
  876. X
  877. X    XDefineCursor(dpy, Table, XCreatePixmapCursor(dpy, cursor_bitmap,
  878. X        cursor_bitmap, &bground, &foreground, 0, 0));
  879. X
  880. X    /* Initialize subwindow structures and create card subwindows */
  881. X
  882. X    if (!InitCardWindows(Table)) {
  883. X        fprintf(stderr, "%s: Can't create subwindows.\n", progname);
  884. X        exit(1);
  885. X    }
  886. X    /* Tell the X-window server which events we're interested in */
  887. X
  888. X    XSelectInput(dpy, card_window.self, ButtonPressMask);
  889. X    /* table sucks buttons so they don't slide through to parent
  890. X     * when player slips off card */
  891. X    XSelectInput(dpy, Table, ExposureMask | ButtonPressMask |
  892. X        ((no_drag) ? PointerMotionMask : 0));
  893. X    XSelectInput(dpy, Restart, ExposureMask | ButtonPressMask);
  894. X    XSelectInput(dpy, Flip, ExposureMask | ButtonPressMask); /* Added JB */
  895. X    XSelectInput(dpy, Exit, ExposureMask | ButtonPressMask);
  896. X
  897. X    DealCards();        /* Shuffle cards and deal to playing field */
  898. X
  899. X    XMapWindow(dpy, Table);
  900. X    XMapWindow(dpy, Restart);
  901. X    XMapWindow(dpy, Flip);    /* Added JB */
  902. X    XMapWindow(dpy, Exit);
  903. X    XMapWindow(dpy, card_window.self);
  904. X
  905. X    while (1) {        /* Process events */
  906. X        XEvent          event;
  907. X        int    oldx, oldy;
  908. X        int    mx, my;
  909. X        int    num_cards;
  910. X        struct Card    *t;
  911. X
  912. X        XNextEvent(dpy, &event);
  913. X
  914. X        switch (event.type) {
  915. X
  916. X        case ClientMessage:
  917. X            {
  918. X            XClientMessageEvent    *ev = (XClientMessageEvent *)&event;
  919. X
  920. X            if (ev->message_type == protocol_atom && 
  921. X            ev->data.l[0] == kill_atom)
  922. X            exit(0);
  923. X            }
  924. X            break;
  925. X        case Expose:
  926. X            DisplayCard(event.xexpose.window);
  927. X            break;
  928. X        case ButtonPress:
  929. X            if (!have_card)    {
  930. X            SelectCard(event.xbutton.window, &from);
  931. X            if (from)    {
  932. X                /* count cards */
  933. X                for (num_cards = 0, t = from; t->next; 
  934. X                    t = t->next, num_cards++)
  935. X                    ;
  936. X                oldx = oldy = -1;
  937. X                mx = event.xbutton.x;
  938. X                my = event.xbutton.y;
  939. X                }
  940. X            }
  941. X            else    {
  942. X            if (from != CNULL)    /* only w/ no_drag */
  943. X                /* erase old outline */
  944. X                draw_outline(oldx, oldy, num_cards);
  945. X                have_card = False;
  946. X                MoveCard(event.xbutton.window, 
  947. X                    &from, &to);
  948. X                }
  949. X            break;
  950. X        case MotionNotify:
  951. X            if (have_card)    {
  952. X                draw_outline(oldx, oldy, num_cards);
  953. X                oldx = ((XMotionEvent *) &(event))->x_root - mx;
  954. X                oldy = ((XMotionEvent *) &(event))->y_root - my;
  955. X                draw_outline(oldx, oldy, num_cards);
  956. X                }
  957. X            break;
  958. X        case ButtonRelease:    /* only w/o nodrag */
  959. X            if (from != CNULL)    {
  960. X                /* erase old outline */
  961. X                draw_outline(oldx, oldy, num_cards);
  962. X                have_card = False;
  963. X                MoveCard(event.xbutton.window, &from, &to);
  964. X                }
  965. X            break;
  966. X        }
  967. X    }
  968. }
  969. X
  970. InitCardWindows(Table)        /* Fill in subwindow structures */
  971. X    Window          Table;
  972. X
  973. {
  974. X    register int    i;
  975. X    XAssocTable    *XCreateAssocTable();
  976. X    XSetWindowAttributes watt;
  977. X    Pixmap    pmap;
  978. X
  979. X    /* Initialize OpaqueFrame structures and shuffling array */
  980. X
  981. X    watt.backing_store = Always;
  982. X    for (i = 0; i < Draw; i++) {
  983. X        deck[i].x = stack[0].x;
  984. X        deck[i].y = stack[0].y;
  985. X        deck[i].stack = 0;
  986. X        deck[i].next = deck[i].prev = CNULL;
  987. X        deck[i].self = XCreateSimpleWindow(dpy, Table, 
  988. X            deck[i].x, deck[i].y, card_width, card_height, 
  989. X            0, (Pixmap) 0, WhitePixel(dpy, screen));
  990. X        XSelectInput(dpy, deck[i].self,
  991. X            ExposureMask | ButtonPressMask |
  992. X            ((no_drag) ? 0 :
  993. X            (ButtonReleaseMask | OwnerGrabButtonMask 
  994. X            | Button1MotionMask)));
  995. X        XChangeWindowAttributes(dpy, deck[i].self, 
  996. X            CWBackingStore, &watt);
  997. X        MakeImage(card_width, card_height, card_bits[i],
  998. X            &(deck[i].image));
  999. X    }
  1000. X    card_window.x = card_window.y = 9;
  1001. X    card_window.self = XCreateSimpleWindow(dpy, Table, 
  1002. X        card_window.x, card_window.y, 
  1003. X        (card_width - 4), (card_height - 4), 
  1004. X        2, BlackPixel(dpy, 0), (Pixmap) 0);
  1005. X    XSetWindowBackgroundPixmap(dpy, card_window.self, draw_pixmap);
  1006. X
  1007. X    /* Make a table for associating window ids to Card structures */
  1008. X
  1009. X    if (!(Key = XCreateAssocTable(16)))    /* 16-bucket hash table */
  1010. X        return (0);
  1011. X
  1012. X    for (i = 0; i < Draw; i++) {
  1013. X
  1014. X        /* Associate address of card with card's window id */
  1015. X        XMakeAssoc(dpy, Key, deck[i].self, &deck[i]);
  1016. X    }
  1017. X
  1018. X    /* Initialize the cards to their suits and values */
  1019. X
  1020. X    for (i = 0; i < 13; i++) {
  1021. X        deck[i].suit = Hearts;
  1022. X        deck[i].value = i + 1;
  1023. X    }
  1024. X    for (; i < 26; i++) {
  1025. X        deck[i].suit = Diamonds;
  1026. X        deck[i].value = i - 12;
  1027. X    }
  1028. X    for (; i < 39; i++) {
  1029. X        deck[i].suit = Clubs;
  1030. X        deck[i].value = i - 25;
  1031. X    }
  1032. X    for (; i < Draw; i++) {
  1033. X        deck[i].suit = Spades;
  1034. X        deck[i].value = i - 38;
  1035. X    }
  1036. X
  1037. X    srandom((int) time(0));    /* Seed the random number generator with the
  1038. X                 * system time */
  1039. X
  1040. X    return (1);
  1041. }
  1042. X
  1043. DealCards()
  1044. {
  1045. X    register int    i, j, k;
  1046. X    int             compare();
  1047. X
  1048. X    for (i = 0; i < Draw; i++) {
  1049. X        order[i][0] = i;    /* Moved here from InitCardWindows JB */
  1050. X        order[i][1] = random();    /* Fill the shuffling array with
  1051. X                     * random numbers */
  1052. X    }
  1053. X
  1054. X    qsort((char *) order, Draw, 4, compare);    /* Shuffle by sorting the
  1055. X                         * random numbers */
  1056. X
  1057. X    /* Deal the cards to the field stacks */
  1058. X
  1059. X    ndeck = Draw;            /* Added JB */
  1060. X
  1061. X    for (i = 1; i < 8; i++) {
  1062. X        for (j = i; j < 8; j++) {
  1063. X            /* Get index of next card in deck */
  1064. X            k = order[--stack[0].count][0];    
  1065. X            ndeck--;                /* Added JB */
  1066. X            /* Move it to its new stack */
  1067. X            XMoveWindow(dpy, deck[k].self,
  1068. X                stack[j].x, stack[j].y);
  1069. X            if (j == i) /* Make it visible if its on the top */
  1070. X                XMapRaised(dpy, deck[k].self);    
  1071. X            deck[k].x = stack[j].x;    /* Update locator fields */
  1072. X            deck[k].y = stack[j].y;
  1073. X            deck[k].stack = j;    /* Update stack number */
  1074. X            ++stack[j].count;    /* Update card count in stack */
  1075. X        }
  1076. X    }
  1077. X
  1078. X    /* map later, so we don't give any hints about what's in each stack */
  1079. X    for (i = 0; i < Draw; i++)    {
  1080. X        /* don't map cards in draw deck */
  1081. /*        if (deck[i].y != stack[0].y)    */
  1082. X        if (deck[i].stack != 0)
  1083. X            XMapWindow(dpy, deck[i].self);
  1084. X        }
  1085. X    /* map first draw */
  1086. X    XMapRaised(dpy, deck[order[--stack[0].count][0]].self);
  1087. }
  1088. X
  1089. compare(arg1, arg2)        /* Compare low-order word only, for use in
  1090. X                 * qsort */
  1091. X    long           *arg1, *arg2;
  1092. X
  1093. {
  1094. #if defined(vax) || defined(i386)
  1095. X    return ((*arg2 & 0xffff0000) - (*arg1 & 0xffff0000));
  1096. #else
  1097. X    return ((*arg2 & 0xffff) - (*arg1 & 0xffff));
  1098. #endif
  1099. }
  1100. X
  1101. DisplayCard(window)        /* Service ExposeWindow events */
  1102. X    Window          window;
  1103. X
  1104. {
  1105. X    if (window == Restart)
  1106. X        XPutImage(dpy, Restart, gc, &res_image, 0, 0, 0, 0,
  1107. X              restart_width, restart_height);
  1108. /* ++    Added by Jon Brinkmann 7/20/90 */
  1109. X    else if (window == Flip)
  1110. X        XPutImage(dpy, Flip, gc, &flip_image, 0, 0, 0, 0,
  1111. X              flip_width, flip_height);
  1112. /* -- */
  1113. X    else if (window == Exit)
  1114. X        XPutImage(dpy, Exit, gc, &exit_image, 0, 0, 0, 0, 
  1115. X            exit_width, exit_height);
  1116. X    else if (window == Table)
  1117. X        ;        /* noop (for now) */
  1118. X    else {
  1119. X        struct Card    *c;
  1120. X
  1121. X        /* Find the card structure that corresponds to the window */
  1122. X
  1123. X        c = (struct Card *) XLookUpAssoc(dpy, Key, window);
  1124. X
  1125. X        /* Fill the card window with its bitmap */
  1126. X
  1127. X        if (iscolor)
  1128. X            if (rflag)
  1129. X            XPutImage(dpy, window, (c->suit < 2) ? Redgc : rgc, 
  1130. X                &(c->image), 0, 0, 0, 0, 
  1131. X                card_width, card_height);
  1132. X            else
  1133. X            XPutImage(dpy, window, (c->suit < 2) ? Redgc : gc, 
  1134. X                &(c->image), 0, 0, 0, 0, 
  1135. X                card_width, card_height);
  1136. X        else if (rflag)
  1137. X            XPutImage(dpy, window, (c->suit < 2) ? gc : rgc, 
  1138. X                &(c->image), 0, 0, 0, 0, 
  1139. X                card_width, card_height);
  1140. X        else
  1141. X            XPutImage(dpy, window, gc, &(c->image), 
  1142. X                0, 0, 0, 0, card_width, card_height);
  1143. X    }
  1144. X    return;
  1145. }
  1146. X
  1147. SelectCard(window, pfrom)    /* Service ButtonPressed events */
  1148. X    Window          window;
  1149. X    struct Card   **pfrom;
  1150. X
  1151. {
  1152. X    if (window == Restart)    {
  1153. X        NewGame();
  1154. X        }
  1155. /* ++    Added by Jon Brinkmann 7/20/90 */
  1156. X    else if (window == Flip)    {
  1157. X        if (stack[0].count <= 0)    {
  1158. X            if (ndeck > 1) XMapWindow(dpy, card_window.self); /*    Remove deck */
  1159. X            stack[0].count = ndeck;
  1160. X            while (stack[0].count)
  1161. X                XUnmapWindow(dpy, deck[order[--stack[0].count][0]].self);
  1162. X            stack[0].count = ndeck;
  1163. /*    Display top card */
  1164. X            XMapRaised(dpy, deck[order[--stack[0].count][0]].self);
  1165. X            return;
  1166. X        } else    XBell(dpy, 50);
  1167. X    }
  1168. /* -- */
  1169. X    else if (window == Table)
  1170. X        *pfrom = (struct Card *) 0;
  1171. X    else if (window == Exit)
  1172. X        exit(0);
  1173. X    else if (window == card_window.self) {  /* Draw next card, if any */
  1174. X        if (stack[0].count)     {
  1175. X            XMapRaised(dpy, deck[order[--stack[0].count][0]].self);
  1176. X            if (stack[0].count == 0)        {
  1177. X                /* pull draw stack card */
  1178. X                XUnmapWindow(dpy, card_window.self);
  1179. X                }
  1180. X            }
  1181. X        else
  1182. X            /* should never happen */
  1183. X            XBell(dpy, 50);
  1184. X    } else {        /* Select an exposed card */
  1185. X        register int    i;
  1186. X        struct Card    *from, *to;
  1187. X
  1188. X        from = *pfrom = (struct Card *) XLookUpAssoc(dpy, Key, window);
  1189. X
  1190. X        if (from->stack > 7) {    /* Can't move a card from the home
  1191. X                     * stacks */
  1192. X            XBell(dpy, 50);
  1193. X            *pfrom = NULL;
  1194. X            return;
  1195. X        } else {    /* Aces and Kings are moved automatically
  1196. X                 * upon selection; others are moved at
  1197. X                 * ButtonReleased event */
  1198. X
  1199. X            if (from->value == Ace) {/* Move Ace to home area */
  1200. X                /* Skip non-vacant stacks */
  1201. X                for (i = 8; stack[i].count; i++)
  1202. X                    ;
  1203. X
  1204. X                /*
  1205. X                 * Reset card location fields and stack
  1206. X                 * counters
  1207. X                 */
  1208. X
  1209. X                updateOrder(from);    /* Added JB */
  1210. X
  1211. X                if (from->stack)
  1212. X                    --stack[from->stack].count;
  1213. X                ++stack[i].count;
  1214. X                from->stack = i;
  1215. X                from->x = stack[i].x;
  1216. X                from->y = stack[i].y;
  1217. X
  1218. X                /*
  1219. X                 * Move the card window, and signal that
  1220. X                 * we've done it
  1221. X                 */
  1222. X
  1223. X                XRaiseWindow(dpy, window);
  1224. X                XMoveWindow(dpy, window, from->x, from->y);
  1225. X                *pfrom = NULL;
  1226. X                return;
  1227. X            } else if (from->value == King) {    
  1228. X            /* Move King to the first vacant column */
  1229. X
  1230. X                if (from->stack) {
  1231. X                    if (stack[from->stack].count == 1)
  1232. X                        return;
  1233. X                }
  1234. X                /* Look for a vacancy */
  1235. X                for (i = 1; ((i < 8) && stack[i].count); i++)
  1236. X                    ;
  1237. X                if (i < 8) {
  1238. X
  1239. X                    /*
  1240. X                     * Reset card location fields and
  1241. X                     * stack counters
  1242. X                     */
  1243. X
  1244. X                    updateOrder(from);    /* Added JB */
  1245. X
  1246. X                    if (from->stack)
  1247. X                        --stack[from->stack].count;
  1248. X                    ++stack[i].count;
  1249. X                    from->stack = i;
  1250. X                    from->x = stack[i].x;
  1251. X                    from->y = stack[i].y;
  1252. X
  1253. X                    /*
  1254. X                     * Move the card window, and any
  1255. X                     * cards stacked upon it
  1256. X                     */
  1257. X
  1258. X                    XRaiseWindow(dpy, window);
  1259. X                    XMoveWindow(dpy, window, 
  1260. X                        from->x, from->y);
  1261. X
  1262. X                    if (from->next != CNULL) {
  1263. X                        to = from;
  1264. X                        from = from->next;
  1265. X                        Restack(&from, &to);
  1266. X                    }
  1267. X                    *pfrom = NULL;
  1268. X                    return;
  1269. X                }
  1270. X            }
  1271. X        else
  1272. X            have_card = True;
  1273. X        }
  1274. X    }
  1275. }
  1276. X
  1277. MoveCard(window, pfrom, pto)
  1278. X    Window        window;
  1279. X    struct Card   **pfrom, **pto;
  1280. X
  1281. {
  1282. X    struct Card    *from, *to;    /* Locals to make syntax less funky */
  1283. X
  1284. X    from = *pfrom;
  1285. X    to = *pto = (struct Card *) XLookUpAssoc(dpy, Key, window);
  1286. X
  1287. X    if (to == NULL)
  1288. X        return;
  1289. X
  1290. X    if (to->next == CNULL) {/* Can't move here unless it's top card */
  1291. X        if (to->stack > 7) {    /* Try to move card to home area */
  1292. X            if ((from->next == CNULL) && (to->suit == from->suit)
  1293. X                && (to->value == (from->value - 1))) {
  1294. X
  1295. X                updateOrder(from);    /* Added JB */
  1296. X
  1297. X                XRaiseWindow(dpy, from->self);
  1298. X                XMoveWindow(dpy, from->self, to->x, to->y);
  1299. X                /* Fix underlying card's forward pointer */
  1300. X                if (from->prev != CNULL)
  1301. X                    (from->prev)->next = CNULL;    
  1302. X                from->prev = to;    /* Fix back pointer */
  1303. X                from->x = to->x;
  1304. X                from->y = to->y;
  1305. X                if (from->stack)
  1306. X                    --stack[from->stack].count;
  1307. X                ++stack[to->stack].count;
  1308. X                from->stack = to->stack;
  1309. X
  1310. X                return;
  1311. X            }
  1312. X        } else if (to->stack) {    /* Try to restack the card */
  1313. X            if ((to->value == (from->value + 1)) &&
  1314. X                (((to->suit < 2) && (from->suit > 1)) ||
  1315. X                 ((to->suit > 1) && (from->suit < 2)))) {
  1316. X
  1317. X                updateOrder(from);    /* Added JB */
  1318. X
  1319. X                to->next = from;
  1320. X                /* Fix underlying card's forward pointer */
  1321. X                if (from->prev != CNULL)
  1322. X                    (from->prev)->next = CNULL;    
  1323. X                from->prev = to;    /* Fix back pointer */
  1324. X                Restack(&from, &to);    /* Move this card and
  1325. X                             * any stacked on top of
  1326. X                             * it */
  1327. X                return;
  1328. X            }
  1329. X        }
  1330. X    }
  1331. X    XBell(dpy, 50);        /* Illegal move */
  1332. X    return;
  1333. }
  1334. X
  1335. Restack(pfrom, pto)        /* Recursive function to restack cards */
  1336. X    struct Card   **pfrom, **pto;
  1337. X
  1338. {
  1339. X    struct Card    *from, *to;
  1340. X
  1341. X    from = *pfrom;
  1342. X    to = *pto;
  1343. X    from->x = to->x;
  1344. X    from->y = to->y + Offset;
  1345. X    XMoveWindow(dpy, from->self, from->x, from->y);
  1346. X    XRaiseWindow(dpy, from->self);
  1347. X    if (from->stack)
  1348. X        --stack[from->stack].count;
  1349. X    ++stack[to->stack].count;
  1350. X    from->stack = to->stack;
  1351. X    if (from->next != CNULL) {
  1352. X        to = from;
  1353. X        from = from->next;
  1354. X        Restack(&from, &to);
  1355. X    }
  1356. X    return;
  1357. }
  1358. X
  1359. /* ++    Added by Jon Brinkmann 7/20/90 */
  1360. #define    CardIndex(card)    13 * card->suit + card->value - 1
  1361. X
  1362. #define    Suite(index)    (index) / 13 + 1
  1363. #define    Value(index)    (index) % 13 + 1
  1364. static char *suite[4] = {"Hearts", "Diamonds", "Clubs", "Spades"};
  1365. static char *value[13]= {"Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10",
  1366. X    "Jack", "Queen", "King"};
  1367. #define    Ssuite(index)    suite[(index) / 13]
  1368. #define    Svalue(index)    value[(index) % 13]
  1369. X
  1370. updateOrder(card)
  1371. X    struct Card   *card;
  1372. {
  1373. X    register int i, j;
  1374. X
  1375. X    if (card->stack == 0) {
  1376. X        j = CardIndex(card);
  1377. X        for (i = stack[0].count; i < ndeck; i++) {
  1378. X            if (j == order[i][0]) {
  1379. /*                printf ("%d %d Card %d %d (%s of %s) taken\n",
  1380. X                    stack[0].count, ndeck, i, j,
  1381. X                    Svalue(j), Ssuite(j));    */
  1382. X                for (j = i; j < ndeck; j++)
  1383. X                    order[j][0] = order[j + 1][0];
  1384. X                ndeck--;
  1385. /*                for (j = i; j < ndeck; j++)
  1386. X                    printf ("%2d %2d (%s of %s)\n", j, order[j][0],
  1387. X                        Svalue(order[j][0]), Ssuite(order[j][0]));    */
  1388. X                return;
  1389. X            }
  1390. X        }    
  1391. X        fprintf (stderr, "Can't find card!\n");
  1392. X        exit(1);
  1393. X    }
  1394. X    return;
  1395. }
  1396. /* --    */
  1397. NewGame()
  1398. {                /* Re-initialize the card deck, shuffle and
  1399. X                 * deal */
  1400. X    register int    i;
  1401. X
  1402. X    XUnmapSubwindows(dpy, Table);
  1403. X    XMapRaised(dpy, card_window.self);
  1404. X    XMapRaised(dpy, Restart);
  1405. X    XMapRaised(dpy, Flip);    /* Added JB */
  1406. X    XMapRaised(dpy, Exit);
  1407. X
  1408. X    /* Relocate all cards to the draw stack */
  1409. X
  1410. X    for (i = 0; i < Draw; i++) {
  1411. X        deck[i].x = stack[0].x;
  1412. X        deck[i].y = stack[0].y;
  1413. X        deck[i].stack = 0;
  1414. X        deck[i].prev = deck[i].next = CNULL;
  1415. X        XMoveWindow(dpy, deck[i].self, stack[0].x, stack[0].y);
  1416. X    }
  1417. X
  1418. X    stack[0].count = Draw;
  1419. X    for (i = 1; i < 12; i++)
  1420. X        stack[i].count = 0;
  1421. X
  1422. X    DealCards();
  1423. X
  1424. X    return;
  1425. }
  1426. X
  1427. draw_outline(x, y, n)
  1428. int    x, y, n;
  1429. {
  1430. X    if ((x == -1) && (y == -1))
  1431. X        return;
  1432. X    XDrawRectangle(dpy, RootWindow(dpy, screen), out_gc, x, y, 
  1433. X        card_width, card_height + n * 25);
  1434. }
  1435. SHAR_EOF
  1436. chmod 0644 xsol.c ||
  1437. echo 'restore of xsol.c failed'
  1438. Wc_c="`wc -c < 'xsol.c'`"
  1439. test 24628 -eq "$Wc_c" ||
  1440.     echo 'xsol.c: original size 24628, current size' "$Wc_c"
  1441. rm -f _shar_wnt_.tmp
  1442. fi
  1443. # ============= xsol.man ==============
  1444. if test -f 'xsol.man' -a X"$1" != X"-c"; then
  1445.     echo 'x - skipping xsol.man (File already exists)'
  1446.     rm -f _shar_wnt_.tmp
  1447. else
  1448. > _shar_wnt_.tmp
  1449. echo 'x - extracting xsol.man (Text)'
  1450. sed 's/^X//' << 'SHAR_EOF' > 'xsol.man' &&
  1451. .\" @(#)xsol.man 1.4 89/06/16; Copyright (c) 1988 - Sun Microsystems
  1452. .TH xsol 1 "15 Aug 1988"
  1453. .SH NAME
  1454. xsol \- play solitaire
  1455. .SH SYNOPSIS
  1456. .B xsol
  1457. [
  1458. .BI \-display " connection"
  1459. ]
  1460. [
  1461. .BI \-nodrag
  1462. ]
  1463. [
  1464. .BI [\-,+]r
  1465. ]
  1466. .SH DESCRIPTION
  1467. .I xsol
  1468. plays a solitaire game simliar to Klondike.  
  1469. The playing field is made up of seven slots,
  1470. where stacks are built in descending value with alternating suits.
  1471. Aces are built on at the top, and ascending order in the same suit.
  1472. Kings can be moved to any empty space in the playing field.
  1473. The deck is gone through only once, card by card.
  1474. SHAR_EOF
  1475. true || echo 'restore of xsol.man failed'
  1476. fi
  1477. echo 'End of  part 3'
  1478. echo 'File xsol.man is continued in part 4'
  1479. echo 4 > _shar_seq_.tmp
  1480. exit 0
  1481. -- 
  1482. Senior Systems Scientist        mail: dcmartin@msi.com
  1483. Molecular Simulations, Inc.        uucp: uunet!dcmartin
  1484. 796 North Pastoria Avenue        at&t: 408/522-9236
  1485. Sunnyvale, California 94086        fax: 408/732-0831
  1486.