home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume18 / gl_plot / part03 < prev    next >
Encoding:
Internet Message Format  |  1989-03-23  |  34.7 KB

  1. Subject:  v18i061:  GL Graphics Library for AT-clone Unix, Part03/07
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6. Submitted-by: umix!m-net!dtlewis!lewis
  7. Posting-number: Volume 18, Issue 61
  8. Archive-name: gl_plot/part03
  9.  
  10. # To recover, type "sh archive"
  11. echo restoring bitmaps.h
  12. sed 's/^X//' > bitmaps.h <<XxX--EOF--XxX
  13. X/*    @(#) bitmaps.h 5.1 89/02/20    */
  14. X/*
  15. X *    Copyright (c) David T. Lewis 1987, 1988
  16. X *    All rights reserved.
  17. X *
  18. X *    Permission is granted to use this for any personal noncommercial use.
  19. X *    You may not distribute source or executable code for profit, nor
  20. X *    may you distribute it with a commercial product without the written
  21. X *    consent of the author.  Please send modifications to the author for
  22. X *    inclusion in updates to the program.  Thanks.
  23. X */
  24. X
  25. X/* IBM/Epson printer parameters            */
  26. X/* Number of print pixel columns across the page. */
  27. X#define PRINTDENSITY 960
  28. X/* Number of 8 pixel print rows down the page (times 3 for full page). */
  29. X#define PRINTLINES 30
  30. X
  31. X/* HP Laserjet+ printer parameters            */
  32. X/* Number of bytes (8 pixels per byte) across the page. */
  33. X#define LJ_BYTES_PER_LINE 140
  34. X/* Number of 1 pixel print rows down the page (times 3 for full page). */
  35. X#define LJ_LINES 460
  36. X/* Define this so we don't need to rely on the sizeof() operator, which    */
  37. X/* returns an integer value.  This could be trouble for 16 bit integer    */
  38. X/* machines.  The sizeof(LJ_BUF_TYPE) is 140 * 460 = 64400.        */
  39. X#define LJ_BUF_SIZE 64400
  40. X
  41. X/*
  42. X *    Define the structure for CGA video memory.
  43. X */
  44. Xtypedef struct CGAMEM {
  45. X    char page1[100][80];
  46. X    char filler[192];
  47. X    char page2[100][80];
  48. X} CGA_BUF_TYPE;
  49. X
  50. X/*
  51. X *    Define the structure for EGA video memory.
  52. X */
  53. Xtypedef struct EGAMEM {
  54. X    char mem[350][80];
  55. X} EGA_BUF_TYPE;
  56. X
  57. X/*
  58. X *    Define the structure for Hercules video memory.
  59. X */
  60. Xtypedef struct HERCMEM {
  61. X    char page1[87][90];
  62. X    char filler1[362];
  63. X    char page2[87][90];
  64. X    char filler2[362];
  65. X    char page3[87][90];
  66. X    char filler3[362];
  67. X    char page4[87][90];
  68. X} HERC_BUF_TYPE;
  69. X
  70. X/*
  71. X *    Define the structure for a memory buffer for IBM printer bit map
  72. X *    image.  The horizontal resolution may be either 960 bits, or 480
  73. X *    bits (in which case only part of the 960 characters is used in each
  74. X *    line of the buffer).  The buffer is divided into multiple pages so 
  75. X *    that it can fit into two memory segments of < 64K each.  That is, 
  76. X *    three of these structures must be declared to make a complete print
  77. X *    buffer for 90 * 960 byte printing.
  78. X */
  79. Xtypedef struct IBM_PR_BUF {
  80. X        char buf[PRINTLINES][PRINTDENSITY];
  81. X} PR_BUF_TYPE;    /* Three of these required! */
  82. X
  83. Xtypedef struct LJ_PR_BUF {
  84. X        char buf[LJ_LINES][LJ_BYTES_PER_LINE];
  85. X} LJ_BUF_TYPE;    /* Three of these required! */
  86. X
  87. XxX--EOF--XxX
  88. echo restoring cellfont.h
  89. sed 's/^X//' > cellfont.h <<XxX--EOF--XxX
  90. X/*    @(#) cellfont.h 5.1 89/02/20    */
  91. X/* Note: Copyright status unknown.  Presumed public domain.  dtl 3-15-88*/
  92. X
  93. X/* RAM-Loadable Character Sets for the IBM PC
  94. X Richard Wilton
  95. X July 1986 */
  96. X
  97. X/* definitions for 8 by 8 characters 00 through FF */
  98. X
  99. Xstatic char charcell [2048]={
  100. X    0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000,    /* 000 */
  101. X    0x07E,0x081,0x0A5,0x081,0x0BD,0x099,0x081,0x07E,    /* 001 */
  102. X    0x07E,0x0FF,0x000,0x0FF,0x0C3,0x0E7,0x0FF,0x07E,    /* 002 */
  103. X    0x06C,0x0FE,0x0FE,0x0FE,0x07C,0x038,0x010,0x000,    /* 003 */
  104. X    0x010,0x038,0x07C,0x0FE,0x07C,0x038,0x010,0x000,    /* 004 */
  105. X    0x038,0x07C,0x038,0x0FE,0x0FE,0x07C,0x038,0x07C,    /* 005 */
  106. X    0x010,0x010,0x038,0x07C,0x0FE,0x07C,0x038,0x07C,    /* 006 */
  107. X    0x000,0x000,0x018,0x03C,0x03C,0x018,0x000,0x000,    /* 007 */
  108. X    0x0FF,0x0FF,0x0E7,0x0C3,0x0C3,0x0E7,0x0FF,0x0FF,    /* 008 */
  109. X    0x000,0x03C,0x066,0x042,0x042,0x066,0x03C,0x000,    /* 009 */
  110. X    0x0FF,0x0C3,0x099,0x0BD,0x0BD,0x099,0x0C3,0x0FF,    /* 00A */
  111. X    0x00F,0x007,0x00F,0x07D,0x0CC,0x0CC,0x0CC,0x078,    /* 00B */
  112. X    0x03C,0x066,0x066,0x066,0x03C,0x018,0x07E,0x018,    /* 00C */
  113. X    0x03F,0x033,0x03F,0x030,0x030,0x070,0x0F0,0x0E0,    /* 00D */
  114. X    0x07F,0x063,0x07F,0x063,0x063,0x067,0x0E6,0x0C0,    /* 00E */
  115. X    0x099,0x05A,0x03C,0x0E7,0x0E7,0x03C,0x05A,0x099,    /* 00F */
  116. X    0x080,0x0E0,0x0F8,0x0FE,0x0F8,0x0E0,0x080,0x000,    /* 010 */
  117. X    0x002,0x00E,0x03E,0x0FE,0x03E,0x00E,0x002,0x000,    /* 011 */
  118. X    0x018,0x03C,0x07E,0x018,0x018,0x07E,0x03C,0x018,    /* 012 */
  119. X    0x066,0x066,0x066,0x066,0x066,0x000,0x066,0x000,    /* 013 */
  120. X    0x07F,0x000,0x000,0x07B,0x01B,0x01B,0x01B,0x000,    /* 014 */
  121. X    0x03E,0x063,0x038,0x06C,0x06C,0x038,0x0CC,0x078,    /* 015 */
  122. X    0x000,0x000,0x000,0x000,0x07E,0x07E,0x07E,0x000,    /* 016 */
  123. X    0x018,0x03C,0x07E,0x018,0x07E,0x03C,0x018,0x0FF,    /* 017 */
  124. X    0x018,0x03C,0x07E,0x018,0x018,0x018,0x018,0x000,    /* 018 */
  125. X    0x018,0x018,0x018,0x018,0x07E,0x03C,0x018,0x000,    /* 019 */
  126. X    0x000,0x018,0x00C,0x0FE,0x00C,0x018,0x000,0x000,    /* 01A */
  127. X    0x000,0x030,0x060,0x0FE,0x060,0x030,0x000,0x000,    /* 01B */
  128. X    0x000,0x000,0x0C0,0x0C0,0x0C0,0x0FE,0x000,0x000,    /* 01C */
  129. X    0x000,0x024,0x066,0x0FF,0x066,0x024,0x000,0x000,    /* 01D */
  130. X    0x000,0x018,0x03C,0x07E,0x0FF,0x0FF,0x000,0x000,    /* 01E */
  131. X    0x000,0x0FF,0x0FF,0x07E,0x03C,0x018,0x000,0x000,    /* 01F */
  132. X    0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000,    /* 020 */
  133. X    0x030,0x078,0x078,0x030,0x030,0x000,0x030,0x000,    /* 021 */
  134. X    0x06C,0x06C,0x06C,0x000,0x000,0x000,0x000,0x000,    /* 022 */
  135. X    0x06C,0x06C,0x0FE,0x06C,0x0FE,0x06C,0x06C,0x000,    /* 023 */
  136. X    0x030,0x07C,0x0C0,0x078,0x00C,0x0F8,0x030,0x000,    /* 024 */
  137. X    0x000,0x0C6,0x0CC,0x018,0x030,0x066,0x0C6,0x000,    /* 025 */
  138. X    0x038,0x06C,0x038,0x076,0x0DC,0x0CC,0x076,0x000,    /* 026 */
  139. X    0x060,0x060,0x0C0,0x000,0x000,0x000,0x000,0x000,    /* 027 */
  140. X    0x018,0x030,0x060,0x060,0x060,0x030,0x018,0x000,    /* 028 */
  141. X    0x060,0x030,0x018,0x018,0x018,0x030,0x060,0x000,    /* 029 */
  142. X    0x000,0x066,0x03C,0x0FF,0x03C,0x066,0x000,0x000,    /* 02A */
  143. X    0x000,0x030,0x030,0x0FC,0x030,0x030,0x000,0x000,    /* 02B */
  144. X    0x000,0x000,0x000,0x000,0x000,0x030,0x030,0x060,    /* 02C */
  145. X    0x000,0x000,0x000,0x0FC,0x000,0x000,0x000,0x000,    /* 02D */
  146. X    0x000,0x000,0x000,0x000,0x000,0x030,0x030,0x000,    /* 02E */
  147. X    0x006,0x00C,0x018,0x030,0x060,0x0C0,0x080,0x000,    /* 02F */
  148. X    0x07C,0x0C6,0x0CE,0x0DE,0x0F6,0x0E6,0x07C,0x000,    /* 030 */
  149. X    0x030,0x070,0x030,0x030,0x030,0x030,0x0FC,0x000,    /* 031 */
  150. X    0x078,0x0CC,0x00C,0x038,0x060,0x0CC,0x0FC,0x000,    /* 032 */
  151. X    0x078,0x0CC,0x00C,0x038,0x00C,0x0CC,0x078,0x000,    /* 033 */
  152. X    0x01C,0x03C,0x06C,0x0CC,0x0FE,0x00C,0x01E,0x000,    /* 034 */
  153. X    0x0FC,0x0C0,0x0F8,0x00C,0x00C,0x0CC,0x078,0x000,    /* 035 */
  154. X    0x038,0x060,0x0C0,0x0F8,0x0CC,0x0CC,0x078,0x000,    /* 036 */
  155. X    0x0FC,0x0CC,0x00C,0x018,0x030,0x030,0x030,0x000,    /* 037 */
  156. X    0x078,0x0CC,0x0CC,0x078,0x0CC,0x0CC,0x078,0x000,    /* 038 */
  157. X    0x078,0x0CC,0x0CC,0x07C,0x00C,0x018,0x070,0x000,    /* 039 */
  158. X    0x000,0x030,0x030,0x000,0x000,0x030,0x030,0x000,    /* 03A */
  159. X    0x000,0x030,0x030,0x000,0x000,0x030,0x030,0x060,    /* 03B */
  160. X    0x018,0x030,0x060,0x0C0,0x060,0x030,0x018,0x000,    /* 03C */
  161. X    0x000,0x000,0x0FC,0x000,0x000,0x0FC,0x000,0x000,    /* 03D */
  162. X    0x060,0x030,0x018,0x00C,0x018,0x030,0x060,0x000,    /* 03E */
  163. X    0x078,0x0CC,0x00C,0x018,0x030,0x000,0x030,0x000,    /* 03F */
  164. X    0x07C,0x0C6,0x0DE,0x0DE,0x0DE,0x0C0,0x078,0x000,    /* 040 */
  165. X    0x030,0x078,0x0CC,0x0CC,0x0FC,0x0CC,0x0CC,0x000,    /* 041 */
  166. X    0x0FC,0x066,0x066,0x07C,0x066,0x066,0x0FC,0x000,    /* 042 */
  167. X    0x03C,0x066,0x0C0,0x0C0,0x0C0,0x066,0x03C,0x000,    /* 043 */
  168. X    0x0F8,0x06C,0x066,0x066,0x066,0x06C,0x0F8,0x000,    /* 044 */
  169. X    0x0FE,0x062,0x068,0x078,0x068,0x062,0x0FE,0x000,    /* 045 */
  170. X    0x0FE,0x062,0x068,0x078,0x068,0x060,0x0F0,0x000,    /* 046 */
  171. X    0x03C,0x066,0x0C0,0x0C0,0x0CE,0x066,0x03E,0x000,    /* 047 */
  172. X    0x0CC,0x0CC,0x0CC,0x0FC,0x0CC,0x0CC,0x0CC,0x000,    /* 048 */
  173. X    0x078,0x030,0x030,0x030,0x030,0x030,0x078,0x000,    /* 049 */
  174. X    0x01E,0x00C,0x00C,0x00C,0x0CC,0x0CC,0x078,0x000,    /* 04A */
  175. X    0x0E6,0x066,0x06C,0x078,0x06C,0x066,0x0E6,0x000,    /* 04B */
  176. X    0x0F0,0x060,0x060,0x060,0x062,0x066,0x0FE,0x000,    /* 04C */
  177. X    0x0C6,0x0EE,0x0FE,0x0FE,0x0D6,0x0C6,0x0C6,0x000,    /* 04D */
  178. X    0x0C6,0x0E6,0x0F6,0x0DE,0x0CE,0x0C6,0x0C6,0x000,    /* 04E */
  179. X    0x038,0x06C,0x0C6,0x0C6,0x0C6,0x06C,0x038,0x000,    /* 04F */
  180. X    0x0FC,0x066,0x066,0x07C,0x060,0x060,0x0F0,0x000,    /* 050 */
  181. X    0x078,0x0CC,0x0CC,0x0CC,0x0DC,0x078,0x01C,0x000,    /* 051 */
  182. X    0x0FC,0x066,0x066,0x07C,0x06C,0x066,0x0E6,0x000,    /* 052 */
  183. X    0x078,0x0CC,0x0E0,0x070,0x01C,0x0CC,0x078,0x000,    /* 053 */
  184. X    0x0FC,0x0B4,0x030,0x030,0x030,0x030,0x078,0x000,    /* 054 */
  185. X    0x0CC,0x0CC,0x0CC,0x0CC,0x0CC,0x0CC,0x0FC,0x000,    /* 055 */
  186. X    0x0CC,0x0CC,0x0CC,0x0CC,0x0CC,0x078,0x030,0x000,    /* 056 */
  187. X    0x0C6,0x0C6,0x0C6,0x0D6,0x0FE,0x0EE,0x0C6,0x000,    /* 057 */
  188. X    0x0C6,0x0C6,0x06C,0x038,0x038,0x06C,0x0C6,0x000,    /* 058 */
  189. X    0x0CC,0x0CC,0x0CC,0x078,0x030,0x030,0x078,0x000,    /* 059 */
  190. X    0x0FE,0x0C6,0x08C,0x018,0x032,0x066,0x0FE,0x000,    /* 05A */
  191. X    0x078,0x060,0x060,0x060,0x060,0x060,0x078,0x000,    /* 05B */
  192. X    0x0C0,0x060,0x030,0x018,0x00C,0x006,0x002,0x000,    /* 05C */
  193. X    0x078,0x018,0x018,0x018,0x018,0x018,0x078,0x000,    /* 05D */
  194. X    0x010,0x038,0x06C,0x0C6,0x000,0x000,0x000,0x000,    /* 05E */
  195. X    0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x0FF,    /* 05F */
  196. X    0x030,0x030,0x018,0x000,0x000,0x000,0x000,0x000,    /* 060 */
  197. X    0x000,0x000,0x078,0x00C,0x07C,0x0CC,0x076,0x000,    /* 061 */
  198. X    0x0E0,0x060,0x060,0x07C,0x066,0x066,0x0DC,0x000,    /* 062 */
  199. X    0x000,0x000,0x078,0x0CC,0x0C0,0x0CC,0x078,0x000,    /* 063 */
  200. X    0x01C,0x00C,0x00C,0x07C,0x0CC,0x0CC,0x076,0x000,    /* 064 */
  201. X    0x000,0x000,0x078,0x0CC,0x0FC,0x0C0,0x078,0x000,    /* 065 */
  202. X    0x038,0x06C,0x060,0x0F0,0x060,0x060,0x0F0,0x000,    /* 066 */
  203. X    0x000,0x000,0x076,0x0CC,0x0CC,0x07C,0x00C,0x0F8,    /* 067 */
  204. X    0x0E0,0x060,0x06C,0x076,0x066,0x066,0x0E6,0x000,    /* 068 */
  205. X    0x030,0x000,0x070,0x030,0x030,0x030,0x078,0x000,    /* 069 */
  206. X    0x00C,0x000,0x00C,0x00C,0x00C,0x0CC,0x0CC,0x078,    /* 06A */
  207. X    0x0E0,0x060,0x066,0x06C,0x078,0x06C,0x0E6,0x000,    /* 06B */
  208. X    0x070,0x030,0x030,0x030,0x030,0x030,0x078,0x000,    /* 06C */
  209. X    0x000,0x000,0x0CC,0x0FE,0x0FE,0x0D6,0x0C6,0x000,    /* 06D */
  210. X    0x000,0x000,0x0F8,0x0CC,0x0CC,0x0CC,0x0CC,0x000,    /* 06E */
  211. X    0x000,0x000,0x078,0x0CC,0x0CC,0x0CC,0x078,0x000,    /* 06F */
  212. X    0x000,0x000,0x0DC,0x066,0x066,0x07C,0x060,0x0F0,    /* 070 */
  213. X    0x000,0x000,0x076,0x0CC,0x0CC,0x07C,0x00C,0x01E,    /* 071 */
  214. X    0x000,0x000,0x0DC,0x076,0x066,0x060,0x0F0,0x000,    /* 072 */
  215. X    0x000,0x000,0x07C,0x0C0,0x078,0x00C,0x0F8,0x000,    /* 073 */
  216. X    0x010,0x030,0x07C,0x030,0x030,0x034,0x018,0x000,    /* 074 */
  217. X    0x000,0x000,0x0CC,0x0CC,0x0CC,0x0CC,0x076,0x000,    /* 075 */
  218. X    0x000,0x000,0x0CC,0x0CC,0x0CC,0x078,0x030,0x000,    /* 076 */
  219. X    0x000,0x000,0x0C6,0x0D6,0x0FE,0x0FE,0x06C,0x000,    /* 077 */
  220. X    0x000,0x000,0x0C6,0x06C,0x038,0x06C,0x0C6,0x000,    /* 078 */
  221. X    0x000,0x000,0x0CC,0x0CC,0x0CC,0x07C,0x00C,0x0F8,    /* 079 */
  222. X    0x000,0x000,0x0FC,0x098,0x030,0x064,0x0FC,0x000,    /* 07A */
  223. X    0x01C,0x030,0x030,0x0E0,0x030,0x030,0x01C,0x000,    /* 07B */
  224. X    0x018,0x018,0x018,0x000,0x018,0x018,0x018,0x000,    /* 07C */
  225. X    0x0E0,0x030,0x030,0x01C,0x030,0x030,0x0E0,0x000,    /* 07D */
  226. X    0x076,0x0DC,0x000,0x000,0x000,0x000,0x000,0x000,    /* 07E */
  227. X    0x000,0x010,0x038,0x06C,0x0C6,0x0C6,0x0FE,0x000,    /* 07F */
  228. X    0x078,0x0CC,0x0C0,0x0CC,0x078,0x018,0x00C,0x078,    /* 080 */
  229. X    0x000,0x066,0x000,0x066,0x066,0x066,0x03F,0x000,    /* 081 */
  230. X    0x00E,0x000,0x03C,0x066,0x07E,0x060,0x03C,0x000,    /* 082 */
  231. X    0x07E,0x0C3,0x03C,0x006,0x03E,0x066,0x03F,0x000,    /* 083 */
  232. X    0x066,0x000,0x03C,0x006,0x03E,0x066,0x03F,0x000,    /* 084 */
  233. X    0x070,0x000,0x03C,0x006,0x03E,0x066,0x03F,0x000,    /* 085 */
  234. X    0x018,0x018,0x03C,0x006,0x03E,0x066,0x03F,0x000,    /* 086 */
  235. X    0x000,0x000,0x03C,0x060,0x060,0x03C,0x006,0x01C,    /* 087 */
  236. X    0x07E,0x0C3,0x03C,0x066,0x07E,0x060,0x03C,0x000,    /* 088 */
  237. X    0x066,0x000,0x03C,0x066,0x07E,0x060,0x03C,0x000,    /* 089 */
  238. X    0x070,0x000,0x03C,0x066,0x07E,0x060,0x03C,0x000,    /* 08A */
  239. X    0x066,0x000,0x038,0x018,0x018,0x018,0x03C,0x000,    /* 08B */
  240. X    0x07C,0x0C6,0x038,0x018,0x018,0x018,0x03C,0x000,    /* 08C */
  241. X    0x070,0x000,0x038,0x018,0x018,0x018,0x03C,0x000,    /* 08D */
  242. X    0x063,0x01C,0x036,0x063,0x07F,0x063,0x063,0x000,    /* 08E */
  243. X    0x018,0x018,0x000,0x03C,0x066,0x07E,0x066,0x000,    /* 08F */
  244. X    0x00E,0x000,0x07E,0x030,0x03C,0x030,0x07E,0x000,    /* 090 */
  245. X    0x000,0x000,0x07F,0x00C,0x07F,0x0CC,0x07F,0x000,    /* 091 */
  246. X    0x01F,0x036,0x066,0x07F,0x066,0x066,0x067,0x000,    /* 092 */
  247. X    0x03C,0x066,0x000,0x03C,0x066,0x066,0x03C,0x000,    /* 093 */
  248. X    0x000,0x066,0x000,0x03C,0x066,0x066,0x03C,0x000,    /* 094 */
  249. X    0x000,0x070,0x000,0x03C,0x066,0x066,0x03C,0x000,    /* 095 */
  250. X    0x03C,0x066,0x000,0x066,0x066,0x066,0x03F,0x000,    /* 096 */
  251. X    0x000,0x070,0x000,0x066,0x066,0x066,0x03F,0x000,    /* 097 */
  252. X    0x000,0x066,0x000,0x066,0x066,0x03E,0x006,0x07C,    /* 098 */
  253. X    0x0C3,0x018,0x03C,0x066,0x066,0x03C,0x018,0x000,    /* 099 */
  254. X    0x066,0x000,0x066,0x066,0x066,0x066,0x03C,0x000,    /* 09A */
  255. X    0x018,0x018,0x07E,0x0C0,0x0C0,0x07E,0x018,0x018,    /* 09B */
  256. X    0x01C,0x036,0x032,0x078,0x030,0x073,0x07E,0x000,    /* 09C */
  257. X    0x066,0x066,0x03C,0x07E,0x018,0x07E,0x018,0x018,    /* 09D */
  258. X    0x0F8,0x0CC,0x0CC,0x0FA,0x0C6,0x0CF,0x0C6,0x0C7,    /* 09E */
  259. X    0x00E,0x01B,0x018,0x03C,0x018,0x018,0x0D8,0x070,    /* 09F */
  260. X    0x00E,0x000,0x03C,0x006,0x03E,0x066,0x03F,0x000,    /* 0A0 */
  261. X    0x01C,0x000,0x038,0x018,0x018,0x018,0x03C,0x000,    /* 0A1 */
  262. X    0x000,0x00E,0x000,0x03C,0x066,0x066,0x03C,0x000,    /* 0A2 */
  263. X    0x000,0x00E,0x000,0x066,0x066,0x066,0x03F,0x000,    /* 0A3 */
  264. X    0x000,0x07C,0x000,0x07C,0x066,0x066,0x066,0x000,    /* 0A4 */
  265. X    0x07E,0x000,0x066,0x076,0x07E,0x06E,0x066,0x000,    /* 0A5 */
  266. X    0x03C,0x06C,0x06C,0x03E,0x000,0x07E,0x000,0x000,    /* 0A6 */
  267. X    0x038,0x06C,0x06C,0x038,0x000,0x07C,0x000,0x000,    /* 0A7 */
  268. X    0x018,0x000,0x018,0x030,0x060,0x066,0x03C,0x000,    /* 0A8 */
  269. X    0x000,0x000,0x000,0x07E,0x060,0x060,0x000,0x000,    /* 0A9 */
  270. X    0x000,0x000,0x000,0x07E,0x006,0x006,0x000,0x000,    /* 0AA */
  271. X    0x0C3,0x0C6,0x0CC,0x0DE,0x033,0x066,0x0CC,0x00F,    /* 0AB */
  272. X    0x0C3,0x0C6,0x0CC,0x000,0x037,0x06F,0x0CF,0x003,    /* 0AC */
  273. X    0x018,0x018,0x000,0x018,0x018,0x018,0x018,0x000,    /* 0AD */
  274. X    0x000,0x033,0x066,0x0CC,0x066,0x033,0x000,0x000,    /* 0AE */
  275. X    0x000,0x0CC,0x066,0x033,0x066,0x0CC,0x000,0x000,    /* 0AF */
  276. X    0x022,0x088,0x022,0x088,0x022,0x088,0x022,0x088,    /* 0B0 */
  277. X    0x055,0x0AA,0x055,0x0AA,0x055,0x0AA,0x055,0x0AA,    /* 0B1 */
  278. X    0x000,0x077,0x000,0x0EE,0x000,0x077,0x000,0x0EE,    /* 0B2 */
  279. X    0x018,0x018,0x018,0x018,0x018,0x018,0x018,0x018,    /* 0B3 */
  280. X    0x018,0x018,0x018,0x018,0x0F8,0x018,0x018,0x018,    /* 0B4 */
  281. X    0x018,0x018,0x0F8,0x018,0x0F8,0x018,0x018,0x018,    /* 0B5 */
  282. X    0x036,0x036,0x036,0x036,0x0F6,0x036,0x036,0x036,    /* 0B6 */
  283. X    0x000,0x000,0x000,0x000,0x0FE,0x036,0x036,0x036,    /* 0B7 */
  284. X    0x000,0x000,0x0F8,0x018,0x0F8,0x018,0x018,0x018,    /* 0B8 */
  285. X    0x036,0x036,0x0F6,0x006,0x0F6,0x036,0x036,0x036,    /* 0B9 */
  286. X    0x036,0x036,0x036,0x036,0x036,0x036,0x036,0x036,    /* 0BA */
  287. X    0x000,0x000,0x0FE,0x006,0x0F6,0x036,0x036,0x036,    /* 0BB */
  288. X    0x036,0x036,0x0F6,0x006,0x0FE,0x000,0x000,0x000,    /* 0BC */
  289. X    0x036,0x036,0x036,0x036,0x0FE,0x000,0x000,0x000,    /* 0BD */
  290. X    0x018,0x018,0x0F8,0x018,0x0F8,0x000,0x000,0x000,    /* 0BE */
  291. X    0x000,0x000,0x000,0x000,0x0F8,0x018,0x018,0x018,    /* 0BF */
  292. X    0x018,0x018,0x018,0x018,0x01F,0x000,0x000,0x000,    /* 0C0 */
  293. X    0x018,0x018,0x018,0x018,0x0FF,0x000,0x000,0x000,    /* 0C1 */
  294. X    0x000,0x000,0x000,0x000,0x0FF,0x018,0x018,0x018,    /* 0C2 */
  295. X    0x018,0x018,0x018,0x018,0x01F,0x018,0x018,0x018,    /* 0C3 */
  296. X    0x000,0x000,0x000,0x000,0x0FF,0x000,0x000,0x000,    /* 0C4 */
  297. X    0x018,0x018,0x018,0x018,0x0FF,0x018,0x018,0x018,    /* 0C5 */
  298. X    0x018,0x018,0x01F,0x018,0x01F,0x018,0x018,0x018,    /* 0C6 */
  299. X    0x036,0x036,0x036,0x036,0x037,0x036,0x036,0x036,    /* 0C7 */
  300. X    0x036,0x036,0x037,0x030,0x03F,0x000,0x000,0x000,    /* 0C8 */
  301. X    0x000,0x000,0x03F,0x030,0x037,0x036,0x036,0x036,    /* 0C9 */
  302. X    0x036,0x036,0x0F7,0x000,0x0FF,0x000,0x000,0x000,    /* 0CA */
  303. X    0x000,0x000,0x0FF,0x000,0x0F7,0x036,0x036,0x036,    /* 0CB */
  304. X    0x036,0x036,0x037,0x030,0x037,0x036,0x036,0x036,    /* 0CC */
  305. X    0x000,0x000,0x0FF,0x000,0x0FF,0x000,0x000,0x000,    /* 0CD */
  306. X    0x036,0x036,0x0F7,0x000,0x0F7,0x036,0x036,0x036,    /* 0CE */
  307. X    0x018,0x018,0x0FF,0x000,0x0FF,0x000,0x000,0x000,    /* 0CF */
  308. X    0x036,0x036,0x036,0x036,0x0FF,0x000,0x000,0x000,    /* 0D0 */
  309. X    0x000,0x000,0x0FF,0x000,0x0FF,0x018,0x018,0x018,    /* 0D1 */
  310. X    0x000,0x000,0x000,0x000,0x0FF,0x036,0x036,0x036,    /* 0D2 */
  311. X    0x036,0x036,0x036,0x036,0x03F,0x000,0x000,0x000,    /* 0D3 */
  312. X    0x018,0x018,0x01F,0x018,0x01F,0x000,0x000,0x000,    /* 0D4 */
  313. X    0x000,0x000,0x01F,0x018,0x01F,0x018,0x018,0x018,    /* 0D5 */
  314. X    0x000,0x000,0x000,0x000,0x03F,0x036,0x036,0x036,    /* 0D6 */
  315. X    0x036,0x036,0x036,0x036,0x0FF,0x036,0x036,0x036,    /* 0D7 */
  316. X    0x018,0x018,0x0FF,0x018,0x0FF,0x018,0x018,0x018,    /* 0D8 */
  317. X    0x018,0x018,0x018,0x018,0x0F8,0x000,0x000,0x000,    /* 0D9 */
  318. X    0x000,0x000,0x000,0x000,0x01F,0x018,0x018,0x018,    /* 0DA */
  319. X    0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,    /* 0 */
  320. X    0x000,0x000,0x000,0x000,0x0FF,0x0FF,0x0FF,0x0FF,    /* 0DC */
  321. X    0x0F0,0x0F0,0x0F0,0x0F0,0x0F0,0x0F0,0x0F0,0x0F0,    /* 0DD */
  322. X    0x00F,0x00F,0x00F,0x00F,0x00F,0x00F,0x00F,0x00F,    /* 0DE */
  323. X    0x0FF,0x0FF,0x0FF,0x0FF,0x000,0x000,0x000,0x000,    /* 0DF */
  324. X    0x000,0x000,0x03B,0x06E,0x064,0x06E,0x03B,0x000,    /* 0E0 */
  325. X    0x000,0x03C,0x066,0x07C,0x066,0x07C,0x060,0x060,    /* 0E1 */
  326. X    0x000,0x07E,0x066,0x060,0x060,0x060,0x060,0x000,    /* 0E2 */
  327. X    0x000,0x07F,0x036,0x036,0x036,0x036,0x036,0x000,    /* 0E3 */
  328. X    0x07E,0x066,0x030,0x018,0x030,0x066,0x07E,0x000,    /* 0E4 */
  329. X    0x000,0x000,0x03F,0x06C,0x06C,0x06C,0x038,0x000,    /* 0E5 */
  330. X    0x000,0x033,0x033,0x033,0x033,0x03E,0x030,0x060,    /* 0E6 */
  331. X    0x000,0x03B,0x06E,0x00C,0x00C,0x00C,0x00C,0x000,    /* 0E7 */
  332. X    0x07E,0x018,0x03C,0x066,0x066,0x03C,0x018,0x07E,    /* 0E8 */
  333. X    0x01C,0x036,0x063,0x07F,0x063,0x036,0x01C,0x000,    /* 0E9 */
  334. X    0x01C,0x036,0x063,0x063,0x036,0x036,0x077,0x000,    /* 0EA */
  335. X    0x00E,0x018,0x00C,0x03E,0x066,0x066,0x03C,0x000,    /* 0EB */
  336. X    0x000,0x000,0x07E,0x000,0x000,0x07E,0x000,0x000,    /* 0EC */
  337. X    0x006,0x00C,0x07E,0x000,0x000,0x07E,0x060,0x0C0,    /* 0ED */
  338. X    0x01C,0x060,0x0C0,0x0FC,0x0C0,0x060,0x01C,0x000,    /* 0EE */
  339. X    0x03C,0x066,0x066,0x066,0x066,0x066,0x066,0x000,    /* 0EF */
  340. X    0x000,0x07E,0x000,0x07E,0x000,0x07E,0x000,0x000,    /* 0F0 */
  341. X    0x018,0x018,0x07E,0x018,0x018,0x000,0x07E,0x000,    /* 0F1 */
  342. X    0x030,0x018,0x00C,0x018,0x030,0x000,0x07E,0x000,    /* 0F2 */
  343. X    0x00C,0x018,0x030,0x018,0x00C,0x000,0x07E,0x000,    /* 0F3 */
  344. X    0x00E,0x01B,0x01B,0x018,0x018,0x018,0x018,0x018,    /* 0F4 */
  345. X    0x018,0x018,0x018,0x018,0x018,0x0D8,0x0D8,0x070,    /* 0F5 */
  346. X    0x018,0x018,0x000,0x07E,0x000,0x018,0x018,0x000,    /* 0F6 */
  347. X    0x000,0x076,0x0DC,0x000,0x076,0x0DC,0x000,0x000,    /* 0F7 */
  348. X    0x038,0x06C,0x06C,0x038,0x000,0x000,0x000,0x000,    /* 0F8 */
  349. X    0x000,0x000,0x000,0x018,0x018,0x000,0x000,0x000,    /* 0F9 */
  350. X    0x000,0x000,0x000,0x000,0x018,0x000,0x000,0x000,    /* 0FA */
  351. X    0x00F,0x00C,0x00C,0x00C,0x0EC,0x06C,0x03C,0x01C,    /* 0FB */
  352. X    0x078,0x06C,0x06C,0x06C,0x06C,0x000,0x000,0x000,    /* 0FC */
  353. X    0x070,0x018,0x030,0x060,0x078,0x000,0x000,0x000,    /* 0FD */
  354. X    0x000,0x000,0x03C,0x03C,0x03C,0x03C,0x000,0x000,    /* 0FE */
  355. X    0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000        /* 0FF */
  356. X};
  357. XxX--EOF--XxX
  358. echo restoring g_pixctl.c
  359. sed 's/^X//' > g_pixctl.c <<XxX--EOF--XxX
  360. X
  361. X#ifndef lint
  362. Xstatic char sccsid[] = "@(#) g_pixctl.c 5.1 89/02/20";
  363. X#endif
  364. X
  365. X/*
  366. X *    Copyright (c) David T. Lewis 1988
  367. X *    All rights reserved.
  368. X *
  369. X *    Permission is granted to use this for any personal noncommercial use.
  370. X *    You may not distribute source or executable code for profit, nor
  371. X *    may you distribute it with a commercial product without the written
  372. X *    consent of the author.  Please send modifications to the author for
  373. X *    inclusion in updates to the program.  Thanks.
  374. X */
  375. X
  376. X/*
  377. X *    This module contains routines for setting pixel color and writing
  378. X *    mode, and for setting line weight and style.
  379. X */
  380. X
  381. X#include "config.h"
  382. X#include "bitmaps.h"
  383. X#include "gf_types.h"
  384. X#include "graphics.h"
  385. X#include "modes.h"
  386. X
  387. X#define ROT_MASK ((long)0x80000000L)
  388. X
  389. Xextern struct GL_graphics graphics;
  390. Xextern int p_wr_pix();
  391. X
  392. Xstatic int p_mask_pix();
  393. Xstatic long current_style;
  394. X
  395. Xint (*p_do_pix)();    /* Called by n_draw()    */
  396. X
  397. X/* Set the color to be used for all pixel operations.  The returned     */
  398. X/* value is the previous color setting.                    */
  399. X
  400. Xint g_pix_color(color)
  401. Xint color;
  402. X{
  403. X    int last_color;
  404. X    last_color = graphics.color;
  405. X    graphics.color = color;
  406. X    if (graphics.grafmode == EGA_COLOR_MODE)  {
  407. X        /* Write to EGA registers.  Not yet implemented. */
  408. X        /* Ditto for VGA. */
  409. X    }
  410. X    return(last_color);
  411. X}
  412. X
  413. X/* Set the pixel writing mode to update pixels in either OR mode    */
  414. X/* (set the pixel on, regardless of previous state), or XOR mode    */
  415. X/* (pixel is XORed with its previous value).  XOR mode is used for    */
  416. X/* things like graphics cursors which may be placed on the screen    */
  417. X/* without destroying the previous screen contents.            */
  418. X/* The returned value is the previous state of the pixel mode.        */
  419. X
  420. Xint g_pix_mode(mode_val)
  421. Xint mode_val;
  422. X{
  423. X    int last_mode;
  424. X    last_mode = graphics.wrt_mode;
  425. X    switch (mode_val)  {
  426. X        case CLEAR:    /* (Not yet implemented) */
  427. X            graphics.wrt_mode = CLEAR;
  428. X            break;
  429. X        case AND:    /* (Not yet implemented) */
  430. X            graphics.wrt_mode = AND;
  431. X            break;
  432. X        case OR:
  433. X            graphics.wrt_mode = OR;
  434. X            break;
  435. X        case XOR:
  436. X            graphics.wrt_mode = XOR;
  437. X            break;
  438. X        default:
  439. X            graphics.wrt_mode = OR;
  440. X            break;
  441. X    }
  442. X    return(last_mode);
  443. X}
  444. X
  445. X/* Set the line thickness to be used for all line drawing operations.    */
  446. X/* The returned value is the previous line weight setting.        */
  447. X
  448. Xint g_weight(lineweight)
  449. Xint lineweight;
  450. X{
  451. X    int last_weight;
  452. X    last_weight = graphics.lineweight;
  453. X    graphics.lineweight = lineweight;
  454. X    return(last_weight);
  455. X}
  456. X
  457. X/* P_mask_pix() will be used only if a line style is desired.    */
  458. X/* Otherwise, we will directly invoke p_wr_pix().        */
  459. X
  460. Xstatic int p_mask_pix(x, y)
  461. Xint x, y;
  462. X{
  463. X    /* If high bit in graphics.linestyle is a 1, then    */
  464. X    /* write the pixel; otherwise, don't write it.        */
  465. X
  466. X    if (((current_style & ROT_MASK)) != 0)  {
  467. X        /* High bit set, rotate the line style mask    */
  468. X        /* and write the pixel.                */
  469. X        current_style = current_style<<1;
  470. X        current_style++;
  471. X        return (p_wr_pix(x, y));
  472. X    }
  473. X    else  {
  474. X        /* Rotate mask, but don't write pixel.        */
  475. X        current_style = current_style<<1;
  476. X        return(0);
  477. X    }
  478. X}
  479. X
  480. X/* Line style (e.g. dot-dash)        */
  481. X
  482. X/* Set the line style (e.g. dot-dash) to be used for all line drawing    */
  483. X/* operations.  The returned value is the previous line style setting.    */
  484. X
  485. Xlong g_style(linestyle)
  486. Xlong linestyle;
  487. X{
  488. X    long last_style;
  489. X    last_style = graphics.linestyle;
  490. X
  491. X    /* The current "state" of linestyle is stored in    */
  492. X    /* graphics.linestyle, and a copy of this value is    */
  493. X    /* kept locally in current_style, to be manipulated by    */
  494. X    /* the g_mask_pix() routine (above).            */
  495. X    graphics.linestyle = current_style = linestyle;
  496. X
  497. X    /* Decide what type of pixel routine to use.  If we    */
  498. X    /* have to consider line style, then we will use    */
  499. X    /* mask_pix().                        */
  500. X    if (linestyle == SOLID)  {
  501. X        p_do_pix = p_wr_pix;
  502. X    }
  503. X    else  {
  504. X        p_do_pix = p_mask_pix;
  505. X    }
  506. X    return(last_style);
  507. X}
  508. X
  509. X
  510. XxX--EOF--XxX
  511. echo restoring graphics.h
  512. sed 's/^X//' > graphics.h <<XxX--EOF--XxX
  513. X
  514. X/*    @(#) graphics.h 5.1 89/02/20    */
  515. X/*
  516. X *    Copyright (c) David T. Lewis 1987, 1988
  517. X *    All rights reserved.
  518. X *
  519. X *    Permission is granted to use this for any personal noncommercial use.
  520. X *    You may not distribute source or executable code for profit, nor
  521. X *    may you distribute it with a commercial product without the written
  522. X *    consent of the author.  Please send modifications to the author for
  523. X *    inclusion in updates to the program.  Thanks.
  524. X */
  525. X
  526. X/* Sun Dec 20 18:31:11 EST 1987                        */
  527. X/* system5 dtlewis 2 2.2-U AT                        */
  528. X
  529. X#if XENIX_286    /* Support mixed memory model for MS compilers.        */
  530. X#define FAR far
  531. X#else
  532. X#define FAR 
  533. X#endif /* XENIX_286 */
  534. X
  535. X#define TRUE (1)
  536. X#define FALSE (0)
  537. X
  538. X/*
  539. X *    The following are for MS-DOS and BIOS calls.
  540. X */
  541. X#define DOS 0x021
  542. X#define VIDEO_BIOS 0x010
  543. X#define SET_VIDEO_MODE 0x00
  544. X#define GET_VIDEO_MODE 0x0f
  545. X#define DOS_GET_TIME 0x2c
  546. X#define WRT_PIXEL 0x0C
  547. X
  548. X/*
  549. X *    The following are masks for the four possible 2-bit pixel
  550. X *    positions in CGA 320x200 mode.
  551. X */
  552. X#define PIX0 0x0C0
  553. X#define PIX1 0x030
  554. X#define PIX2 0x0C
  555. X#define PIX3 0x03
  556. X
  557. X/*
  558. X *    Define range of the normalized 2D coordinate system
  559. X */
  560. X#define NRM_X_MIN 0
  561. X#define NRM_Y_MIN 0
  562. X#define NRM_X_MAX 32767
  563. X#define NRM_Y_MAX 32767
  564. X#define NRM_X_RANGE 0x7FFFL
  565. X#define NRM_Y_RANGE 0x7FFFL
  566. X
  567. X/*
  568. X *    Define TRIG_SCALE, F_TRIG_SCALE and PTS_PER_QUADRANT for use in
  569. X *    trig.c and related routines.
  570. X */
  571. X#define TRIG_SCALE 32768    /* Factor by which the cos and sin    */
  572. X                /* tables are multiplied in order to    */
  573. X                /* be able to use them in integer math.    */
  574. X                /* This also effects contents of    */
  575. X                /* cos_table and sin_table.        */
  576. X
  577. X#define F_TRIG_SCALE 32768.0    /* Floating point version.        */
  578. X
  579. X#define PTS_PER_QUADRANT 64    /* Don't change this without also    */
  580. X                /* changing the initializations for the    */
  581. X                /* cos_table and sin_table tables also!    */
  582. X
  583. X#define X_CELL_BITS 8        /* Number of bits per character cell    */
  584. X                /* in X direction.            */
  585. X
  586. X#define Y_CELL_BITS 8        /* Number of bits per character cell    */
  587. X                /* in Y direction.            */
  588. X
  589. X/* Define transforms for normalized 2-D drawing space to pixel space.    */
  590. X/* These routines convert from normalized (x,y) coordinates to local    */
  591. X/* screen pixel coordinates.  The normalized coordinate system extends    */
  592. X/* from 0 to 32767 in the x direction, and from 0 to 32767 in the    */
  593. X/* downward y direction,  with the origin at the upper left of the    */
  594. X/* screen.  Screen aspect ratio is not taken into account.        */
  595. X
  596. X#if N_TO_P_MACRO
  597. X#define n_to_p_x(x) ((int)(((long)x * graphics.x_extent) / NRM_X_RANGE))
  598. X#define n_to_p_y(y) ((int)(((long)y * graphics.y_extent) / NRM_Y_RANGE))
  599. X#else
  600. X/* See the machdep.c file for alternative routines for dumb compilers.    */
  601. X#endif /* N_TO_P_MACRO */
  602. X
  603. Xstruct GL_graphics    {
  604. X
  605. X    int initialized;    /* Set true by call to g_init().    */
  606. X
  607. X    /* Pointers to structures representing screen (or printer)    */
  608. X    /* bitmaps.  A separate pointer(s) are used for each possible    */
  609. X    /* bitmap type.                            */
  610. X
  611. X    CGA_BUF_TYPE FAR *cgamem; /* Pointer to video memory segment.    */
  612. X                /* Will be used by the p_wr_pix()     */
  613. X                /* routine.                */
  614. X
  615. X    EGA_BUF_TYPE FAR *egamem; /* Pointer to video memory segment.    */
  616. X                /* Will be used by the p_wr_pix()     */
  617. X                /* routine.                */
  618. X
  619. X    HERC_BUF_TYPE FAR *hercmem; /* Pointer to video memory segment.    */
  620. X                /* Will be used by the p_wr_pix()     */
  621. X                /* routine.                */
  622. X
  623. X    PR_BUF_TYPE FAR *printbuf1; /* Pointers to IBM/Epson printer    */
  624. X    PR_BUF_TYPE FAR *printbuf2; /* bit map segments.  Will be used    */
  625. X    PR_BUF_TYPE FAR *printbuf3; /* by the p_wr_pix() routine.    */
  626. X
  627. X    LJ_BUF_TYPE FAR *lj_buf1; /* Pointers to Laserjet printer bit    */
  628. X    LJ_BUF_TYPE FAR *lj_buf2; /* map segments.  Will be used by    */
  629. X    LJ_BUF_TYPE FAR *lj_buf3; /* the p_wr_pix() routine.        */
  630. X
  631. X    /* The graphics "cursor" is used by all routines operating in    */
  632. X    /* normalized 2-D coordinate space.                */
  633. X
  634. X    int x_cursor;        /* Graphics cursor position in pixel    */
  635. X                /* units on x axis.            */
  636. X    int y_cursor;        /* Graphics cursor position in pixel    */
  637. X                /* units on y axis.            */
  638. X
  639. X    /* Dimensions of the physical screen.  The width of the screen    */
  640. X    /* in pixels is, for example, 639 for a screen with 640     */
  641. X    /* horizontal pixels.  Aspect ratio varies according to the    */
  642. X    /* graphics mode and physical monitor used.            */
  643. X
  644. X    int    x_extent,    /* Width and height of screen in units    */
  645. X        y_extent;    /* of pixels.                */
  646. X
  647. X    float    aspect_ratio;    /* Height of screen divided by width.    */
  648. X
  649. X    /* Variables used for coordinate transformations (partially     */
  650. X    /* implemented).                         */
  651. X
  652. X    float    xlate_x,    /* Translation prior to rotation and    */
  653. X        xlate_y,    /* scaling, perspective, viewports, and    */
  654. X        xlate_z;    /* windows.                */
  655. X
  656. X    float    offset_x,    /* Offset from origin of world         */
  657. X        offset_y,    /* coordinates    (after translation),     */
  658. X        offset_z;    /* about which we will rotate, scale,     */
  659. X                /* and do perspective.            */
  660. X
  661. X    float    theta_x,    /* Angle of rotation about x axis.    */
  662. X                /* (z to y right hand rule.)        */
  663. X        theta_y,    /* Angle of rotation about y axis.    */
  664. X                /* (z to x right hand rule.)        */
  665. X        theta_z;    /* Angle of rotation about x axis.    */
  666. X                /* (x to y right hand rule.)        */
  667. X
  668. X    /* Factors used in the 3D to 2D rotation matrix.  We want to    */
  669. X    /* calculate them once, then use them repeatedly.        */
  670. X
  671. X    float    c_tz_c_ty,    /* cos(theta_z)*cos(theta_y)        */
  672. X        s_tz,        /* sin(theta_z)                */
  673. X        s_ty,        /* sin(theta_y)                */
  674. X        c_tz_c_tx,    /* cos(theta_z)*cos(theta_x)        */
  675. X        s_tx;        /* sin(theta_x)                */
  676. X
  677. X    float    scale_factor;    /* Scaling factor, after rotation,    */
  678. X                /* before perspective.            */
  679. X
  680. X    float    perspect_dist;    /* Perspective viewing distance.    */
  681. X
  682. X    int    x_vport_ll,    /* Lower left and upper right x and y    */
  683. X        y_vport_ll,    /* coordinates of the viewport in the    */
  684. X        x_vport_ur,    /* normalized coordinate space.        */
  685. X        y_vport_ur;
  686. X
  687. X    int    x_window_ll,    /* Lower left and upper right x and y    */
  688. X        y_window_ll,    /* coordinates of the active windo in    */
  689. X        x_window_ur,    /* terms of normalized coordinate    */
  690. X        y_window_ur;    /* space.                */
  691. X
  692. X    /* Drawing control variables.                    */
  693. X
  694. X    int grafmode;         /* Video display mode            */
  695. X
  696. X    int color;        /* Color of line to draw        */
  697. X
  698. X    int lineweight;        /* Line thickness            */
  699. X
  700. X    long linestyle;        /* Line style (e.g. dot-dash)        */
  701. X
  702. X    int wrt_mode;         /* Pixel writing mode (OR, XOR, etc)    */
  703. X
  704. X    /* Stroke font control parameters.                */
  705. X
  706. X    struct  {
  707. X        int xtic;    /* Character to character distance    */
  708. X        int ytic;    /* Line to line distance        */
  709. X        int xsize;    /* Vertical character size        */
  710. X        int ysize;    /* Horizontal character size        */
  711. X        float angle;    /* Rotation angle of text line, in    */
  712. X                /* counterclockwise radians.        */
  713. X        float slant;    /* Char slant angle, in clockwise    */
  714. X                /* radians.                */
  715. X        int angle_flag;    /* Set TRUE if angle is non-zero.    */
  716. X                /* If TRUE, we need to do extra work to    */
  717. X                /* draw characters.            */
  718. X        int slant_flag;    /* Set TRUE if slant is non-zero.    */
  719. X                /* If TRUE, we need to do extra work to    */
  720. X                /* draw characters.            */
  721. X    } strokefont, default_strokefont;
  722. X
  723. X    /* Bitmap font parameters.                    */
  724. X
  725. X    struct  {
  726. X        int chars_per_line;
  727. X        int lines_per_screen;
  728. X        int xtic;    /* Character to character distance    */
  729. X        int ytic;    /* Line to line distance        */
  730. X        int xmult;    /* If 2, then make double wide, etc.    */
  731. X        int ymult;    /* If 2, then make double high, etc.    */
  732. X    } cellfont;
  733. X};
  734. X
  735. XxX--EOF--XxX
  736. echo restoring machdep.c
  737. sed 's/^X//' > machdep.c <<XxX--EOF--XxX
  738. X#ifndef lint
  739. Xstatic char sccsid[] = "@(#) machdep.c 5.1 89/02/20";
  740. X#endif
  741. X
  742. X/*
  743. X *    Copyright (c) David T. Lewis 1989
  744. X *    All rights reserved.
  745. X *
  746. X *    Permission is granted to use this for any personal noncommercial use.
  747. X *    You may not distribute source or executable code for profit, nor
  748. X *    may you distribute it with a commercial product without the written
  749. X *    consent of the author.  Please send modifications to the author for
  750. X *    inclusion in updates to the program.  Thanks.
  751. X */
  752. X
  753. X/* Mon Jan 23 00:01:41 EST 1989                        */
  754. X/* Miscellaneous machine dependent routines required to support MS-DOS    */
  755. X
  756. X#include <stdio.h>
  757. X#include "config.h"
  758. X#include "bitmaps.h"
  759. X#include "gf_types.h"
  760. X#include "graphics.h"
  761. X#if MIX_C
  762. X#include <stdlib.h>
  763. X#else
  764. X#include <sys/types.h>
  765. X#include <math.h>
  766. X#if MS_DOS
  767. X#include <dos.h>
  768. X#endif /* MS_DOS */
  769. X#endif /* MIX_C */
  770. X
  771. X#ifndef M_PI
  772. X#define M_PI    3.14159265358979323846
  773. X#endif /* M_PI */
  774. X
  775. X#define PTR_OK_STAT (0x90)
  776. X#define BIOS_PTR_INT (0x17)
  777. X#define DOS_KBY_STAT 0x0b
  778. X
  779. Xextern struct GL_graphics graphics;
  780. X
  781. X#if MS_DOS
  782. Xstatic REGISTERS inreg, outreg;
  783. X#endif /* MS_DOS */
  784. X
  785. X/* The next two routines can take the place of macros defined in    */
  786. X/* graphics.h, for compilers that can't use them.            */
  787. X
  788. X#if N_TO_P_MACRO
  789. X#else
  790. X
  791. Xint n_to_p_x(x)
  792. Xint x;
  793. X{
  794. X    long lval;
  795. X    lval = x;
  796. X    lval *= graphics.x_extent;
  797. X    lval /= NRM_X_RANGE;
  798. X    return (lval);
  799. X}
  800. X
  801. Xint n_to_p_y(y)
  802. Xint y;
  803. X{
  804. X    long lval;
  805. X    lval = y;
  806. X    lval *= graphics.y_extent;
  807. X    lval /= NRM_Y_RANGE;
  808. X    return (lval);
  809. X}
  810. X#endif /* N_TO_P_MACRO */
  811. X
  812. X#if HAS_FMOD
  813. X#else
  814. X/* fmod(3M) replacement for MIX-C compiler, MS-DOS.    */
  815. X
  816. Xdouble fmod(x,y)
  817. Xdouble x, y;
  818. X{
  819. X    /* x = i*y + f for some value i such that |f| < |y|.     */
  820. X    /* Solve for f.                        */
  821. X
  822. X    long lval;
  823. X    double dval;
  824. X
  825. X    /* Check for zero or overflow    */
  826. X    if (x == 0L || y == 0L) return(0L);
  827. X
  828. X    dval = x / y;
  829. X    lval = (long)dval;
  830. X    return (x - (double)lval * y);
  831. X}
  832. X#endif /* HAS_FMOD */
  833. X
  834. X#if HAS_ATAN2
  835. X#else
  836. X/* atan2(3M) replacement for MIX-C compiler, MS-DOS.    */
  837. X/* Returns arctan of y/x.                */
  838. X
  839. Xdouble atan2(y,x)
  840. Xdouble y, x;
  841. X{
  842. X    if (x>=0)  {
  843. X        /* atan() works fine when angle is in    */
  844. X        /* 1st or 4th quadrant.            */
  845. X        return (atan (y/x));
  846. X    }
  847. X    else  {
  848. X        if (y<0)  {
  849. X            /* 3rd quadrant            */
  850. X            return ( -(M_PI - atan (y/x)));
  851. X        }
  852. X        else  {
  853. X            /* 2nd quadrant            */
  854. X            return (M_PI - atan (y/x));
  855. X        }
  856. X    }
  857. X}
  858. X#endif /* HAS_ATAN2 */
  859. X
  860. X#if HAS_SLEEP
  861. X#else
  862. X/* Replacement for the sleep() function (for some MS-DOS compilers).    */
  863. X
  864. Xint sleep(seconds)  
  865. Xint seconds;
  866. X{
  867. X/* It's OK for this to be inefficient, since we are only wasting    */
  868. X/* time anyhow.  Therefore, use the DOS call rather than BIOS.  That    */
  869. X/* way, we don't screw up the DOS system clock if we call BIOS at    */
  870. X/* midnight.                                */
  871. X#define TICKS_PER_SEC 18.2
  872. X#define A_BIG_NUMBER 360000
  873. X    long time_to_return;
  874. X    long now;
  875. X    /* Get the current time using DOS function 0x2c            */
  876. X    inreg.AH = DOS_GET_TIME;
  877. X    DO_BIOS(DOS, &inreg, &outreg);
  878. X    time_to_return = outreg.DL        /* Hundredths        */
  879. X            + (outreg.DH * 100)    /* Seconds        */
  880. X            + (outreg.CL * 6000)    /* Minutes        */
  881. X            + (outreg.CH * 360000)    /* Hours        */
  882. X            + (seconds * 100);    /* Add delay time    */
  883. X    now = 0L;
  884. X    while (now < time_to_return)  {
  885. X        /* Check the time until done.                */
  886. X        inreg.AH = DOS_GET_TIME;
  887. X        DO_BIOS(DOS, &inreg, &outreg);
  888. X        now = outreg.DL         /* Hundredths        */
  889. X            + (outreg.DH * 100)    /* Seconds        */
  890. X            + (outreg.CL * 6000)    /* Minutes        */
  891. X            + (outreg.CH * 360000);    /* Hours        */
  892. X        /* Check for rollover at midnight            */
  893. X        if ((time_to_return - now) > A_BIG_NUMBER)  {
  894. X            /* Subtract 24 hours                */
  895. X            time_to_return -= 360000 * 24;
  896. X        }
  897. X    }
  898. X    return (0);
  899. X}
  900. X
  901. X#endif /* HAS_SLEEP */
  902. X
  903. X#if MS_DOS
  904. X/* Routines to get and set video modes for MS-DOS.  See the defines in    */
  905. X/* config.h to understand how the register assignments work.          */
  906. X
  907. Xint g_setmod(mode)  
  908. Xint mode;
  909. X{
  910. X    /* BIOS interrupt 0x10 function 0                */
  911. X    inreg.AH = SET_VIDEO_MODE;
  912. X    inreg.AL = mode;    /* Video mode                */
  913. X    DO_BIOS(VIDEO_BIOS, &inreg, &outreg);
  914. X    return (0);
  915. X}
  916. X
  917. Xint g_getmod()
  918. X{
  919. X    /* BIOS interrupt 0x10 function 0x0f                */
  920. X    inreg.AH = GET_VIDEO_MODE;
  921. X    DO_BIOS(VIDEO_BIOS, &inreg, &outreg);
  922. X    return (outreg.AL);
  923. X}
  924. X
  925. Xint bios_print(buffer, itemsize, no_of_items)
  926. Xchar *buffer;
  927. Xint itemsize;
  928. Xint no_of_items;
  929. X{
  930. X    int idx, jdx;
  931. X    int pstat = 0;
  932. X    int size = itemsize * no_of_items;
  933. X    for (idx=0 ;idx < size; idx++)
  934. X    {
  935. X        /* Wait for printer ready status    */
  936. X        for (jdx = 0, pstat = -1; pstat != PTR_OK_STAT; jdx++)
  937. X        {
  938. X            inreg.AH = 2;
  939. X            DO_BIOS(BIOS_PTR_INT, &inreg, &outreg);
  940. X            pstat = (0xf8) & (outreg.AH);
  941. X            if (jdx > 30000)
  942. X            {
  943. X                fprintf(stderr,"Timeout on printer device\n",0);
  944. X                return(0);
  945. X            }
  946. X        }
  947. X
  948. X        /* Send a byte                */
  949. X        inreg.AH = 0;
  950. X        inreg.AL = buffer[idx];
  951. X        DO_BIOS(BIOS_PTR_INT, &inreg, &outreg);
  952. X
  953. X        /* Call to get keyboard status, so DOS can check for    */
  954. X        /* interrupt signal (^C).                */
  955. X        inreg.AH = DOS_KBY_STAT;
  956. X        DO_BIOS(DOS, &inreg, &outreg);
  957. X    }
  958. X    return(no_of_items);
  959. X}
  960. X
  961. X#endif /* MS_DOS */
  962. X
  963. X
  964. XxX--EOF--XxX
  965.  
  966.  
  967.