home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume40 / gnuplot / part08 < prev    next >
Encoding:
Text File  |  1993-10-21  |  78.6 KB  |  2,167 lines

  1. Newsgroups: comp.sources.misc
  2. From: woo@playfair.stanford.edu ("Alexander Woo")
  3. Subject: v40i020:  gnuplot - interactive function plotting utility, Part08/33
  4. Message-ID: <1993Oct21.144434.1859@sparky.sterling.com>
  5. X-Md4-Signature: 6632020fd749f75fca25ab9a3a2c9e56
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Thu, 21 Oct 1993 14:44:34 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: woo@playfair.stanford.edu ("Alexander Woo")
  12. Posting-number: Volume 40, Issue 20
  13. Archive-name: gnuplot/part08
  14. Environment: UNIX, MS-DOS, VMS
  15. Supersedes: gnuplot3: Volume 24, Issue 23-48
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # Contents:  gnuplot/bitmap.c gnuplot/header.mac gnuplot/readline.c
  22. # Wrapped by kent@sparky on Wed Oct 20 17:14:41 1993
  23. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  24. echo If this archive is complete, you will see the following message:
  25. echo '          "shar: End of archive 8 (of 33)."'
  26. if test -f 'gnuplot/bitmap.c' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'gnuplot/bitmap.c'\"
  28. else
  29.   echo shar: Extracting \"'gnuplot/bitmap.c'\" \(52378 characters\)
  30.   sed "s/^X//" >'gnuplot/bitmap.c' <<'END_OF_FILE'
  31. X#ifndef lint
  32. Xstatic char *RCSid = "$Id: bitmap.c%v 3.50 1993/07/09 05:35:24 woo Exp $";
  33. X#endif
  34. X
  35. X
  36. X/* GNUPLOT - bitmap.c */
  37. X/*
  38. X * Copyright (C) 1986 - 1993   Thomas Williams, Colin Kelley
  39. X *
  40. X * Permission to use, copy, and distribute this software and its
  41. X * documentation for any purpose with or without fee is hereby granted, 
  42. X * provided that the above copyright notice appear in all copies and 
  43. X * that both that copyright notice and this permission notice appear 
  44. X * in supporting documentation.
  45. X *
  46. X * Permission to modify the software is granted, but not the right to
  47. X * distribute the modified code.  Modifications are to be distributed 
  48. X * as patches to released version.
  49. X *  
  50. X * This software is provided "as is" without express or implied warranty.
  51. X * 
  52. X *
  53. X * AUTHORS
  54. X * 
  55. X *   Original Software:
  56. X *     Jyrki Yli-Nokari <jty@intrin.UUCP>
  57. X *     Ronald J. Hartranft <rjh2@ns.cc.lehigh.edu>
  58. X *     Russell Lang <rjl@monu1.cc.monash.edu.au>
  59. X * 
  60. X * There is a mailing list for gnuplot users. Note, however, that the
  61. X * newsgroup 
  62. X *    comp.graphics.gnuplot 
  63. X * is identical to the mailing list (they
  64. X * both carry the same set of messages). We prefer that you read the
  65. X * messages through that newsgroup, to subscribing to the mailing list.
  66. X * (If you can read that newsgroup, and are already on the mailing list,
  67. X * please send a message info-gnuplot-request@dartmouth.edu, asking to be
  68. X * removed from the mailing list.)
  69. X *
  70. X * The address for mailing to list members is
  71. X *       info-gnuplot@dartmouth.edu
  72. X * and for mailing administrative requests is 
  73. X *       info-gnuplot-request@dartmouth.edu
  74. X * The mailing list for bug reports is 
  75. X *       bug-gnuplot@dartmouth.edu
  76. X * The list of those interested in beta-test versions is
  77. X *       info-gnuplot-beta@dartmouth.edu
  78. X */
  79. X
  80. X/*
  81. X** General raster plotting routines.
  82. X** Raster routines written and copyrighted 1987 by
  83. X** Jyrki Yli-Nokari (jty@intrin.UUCP)
  84. X** Intrinsic, Ltd.
  85. X**
  86. X** You may use this code for anything you like as long as
  87. X** you are not selling it and the credit is given and
  88. X** this message retained.
  89. X**
  90. X*/
  91. X
  92. X/* Bitmap plotting routines derived from above raster plotting routines
  93. X * Russell Lang, 1990
  94. X */
  95. X
  96. X#include <stdio.h>
  97. X#include "plot.h"
  98. X#include "bitmap.h"
  99. X
  100. Xbitmap *b_p = (bitmap *)NULL;    /* global pointer to bitmap */
  101. Xunsigned int b_currx, b_curry;    /* the current coordinates */
  102. Xunsigned int b_xsize, b_ysize;    /* the size of the bitmap */
  103. Xunsigned int b_planes;            /* number of color planes */
  104. Xunsigned int b_psize;            /* size of each plane */
  105. Xunsigned int b_rastermode;        /* raster mode rotates -90deg */
  106. Xunsigned int b_linemask = 0xffff;    /* 16 bit mask for dotted lines */
  107. Xunsigned int b_value = 1;        /* colour of lines */
  108. Xunsigned int b_hchar;            /* width of characters */
  109. Xunsigned int b_hbits;            /* actual bits in char horizontally */
  110. Xunsigned int b_vchar;            /* height of characters */
  111. Xunsigned int b_vbits;            /* actual bits in char vertically */
  112. Xunsigned int b_angle;            /* rotation of text */
  113. Xchar_box b_font[FNT_CHARS];    /* the current font */
  114. Xunsigned int b_pattern[] = {0xffff, 0x1111,
  115. X    0xffff, 0x5555, 0x3333, 0x7777, 0x3f3f, 0x0f0f, 0x5f5f};
  116. Xint b_maskcount = 0;
  117. Xunsigned int b_lastx, b_lasty;    /* last pixel set - used by b_line */
  118. X
  119. X#define IN(i,size)  ((unsigned)i < (unsigned)size)
  120. X
  121. X/* 5x9 font, bottom row first, left pixel in lsb */
  122. Xchar_row GPFAR fnt5x9[FNT_CHARS][FNT5X9_VBITS] = {
  123. X  /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000},
  124. X  /*!*/  {000000,000000,0x0004,000000,0x0004,0x0004,0x0004,0x0004,0x0004},
  125. X  /*"*/  {000000,000000,000000,000000,000000,000000,0x000a,0x000a,0x000a},
  126. X  /*#*/  {000000,000000,0x000a,0x000a,0x001f,0x000a,0x001f,0x000a,0x000a},
  127. X  /*$*/  {000000,000000,0x0004,0x000f,0x0014,0x000e,0x0005,0x001e,0x0004},
  128. X  /*%*/  {000000,000000,0x0018,0x0019,0x0002,0x0004,0x0008,0x0013,0x0003},
  129. X  /*&*/  {000000,000000,0x0016,0x0009,0x0015,0x0002,0x0005,0x0005,0x0002},
  130. X  /*'*/  {000000,000000,000000,000000,000000,0x0002,0x0004,0x0006,0x0006},
  131. X  /*(*/  {000000,000000,0x0008,0x0004,0x0002,0x0002,0x0002,0x0004,0x0008},
  132. X  /*)*/  {000000,000000,0x0002,0x0004,0x0008,0x0008,0x0008,0x0004,0x0002},
  133. X  /***/  {000000,000000,0x0004,0x0015,0x000e,0x001f,0x000e,0x0015,0x0004},
  134. X  /*+*/  {000000,000000,000000,0x0004,0x0004,0x001f,0x0004,0x0004,000000},
  135. X  /*,*/  {000000,0x0002,0x0004,0x0006,0x0006,000000,000000,000000,000000},
  136. X  /*-*/  {000000,000000,000000,000000,000000,0x001f,000000,000000,000000},
  137. X  /*.*/  {000000,000000,0x0006,0x0006,000000,000000,000000,000000,000000},
  138. X  /*-/-*/{000000,000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,000000},
  139. X  /*0*/  {000000,000000,0x000e,0x0011,0x0013,0x0015,0x0019,0x0011,0x000e},
  140. X  /*1*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0006,0x0004},
  141. X  /*2*/  {000000,000000,0x001f,0x0001,0x0001,0x000e,0x0010,0x0011,0x000e},
  142. X  /*3*/  {000000,000000,0x000e,0x0011,0x0010,0x000c,0x0010,0x0011,0x000e},
  143. X  /*4*/  {000000,000000,0x0008,0x0008,0x001f,0x0009,0x000a,0x000c,0x0008},
  144. X  /*5*/  {000000,000000,0x000e,0x0011,0x0010,0x0010,0x000f,0x0001,0x001f},
  145. X  /*6*/  {000000,000000,0x000e,0x0011,0x0011,0x000f,0x0001,0x0002,0x000c},
  146. X  /*7*/  {000000,000000,0x0001,0x0001,0x0002,0x0004,0x0008,0x0010,0x001f},
  147. X  /*8*/  {000000,000000,0x000e,0x0011,0x0011,0x000e,0x0011,0x0011,0x000e},
  148. X  /*9*/  {000000,000000,0x0006,0x0008,0x0010,0x001e,0x0011,0x0011,0x000e},
  149. X  /*:*/  {000000,000000,000000,0x0006,0x0006,000000,0x0006,0x0006,000000},
  150. X  /*;*/  {000000,0x0001,0x0002,0x0006,0x0006,000000,0x0006,0x0006,000000},
  151. X  /*<*/  {000000,000000,0x0008,0x0004,0x0002,0x0001,0x0002,0x0004,0x0008},
  152. X  /*=*/  {000000,000000,000000,000000,0x001f,000000,0x001f,000000,000000},
  153. X  /*>*/  {000000,000000,0x0002,0x0004,0x0008,0x0010,0x0008,0x0004,0x0002},
  154. X  /*?*/  {000000,000000,0x0004,000000,0x0004,0x0008,0x0010,0x0011,0x000e},
  155. X  /*@*/  {000000,000000,0x000e,0x0015,0x0015,0x0016,0x0010,0x0011,0x000e},
  156. X  /*A*/  {000000,000000,0x0011,0x0011,0x001f,0x0011,0x0011,0x000a,0x0004},
  157. X  /*B*/  {000000,000000,0x000f,0x0012,0x0012,0x000e,0x0012,0x0012,0x000f},
  158. X  /*C*/  {000000,000000,0x000e,0x0011,0x0001,0x0001,0x0001,0x0011,0x000e},
  159. X  /*D*/  {000000,000000,0x000f,0x0012,0x0012,0x0012,0x0012,0x0012,0x000f},
  160. X  /*E*/  {000000,000000,0x001f,0x0001,0x0001,0x0007,0x0001,0x0001,0x001f},
  161. X  /*F*/  {000000,000000,0x0001,0x0001,0x0001,0x0007,0x0001,0x0001,0x001f},
  162. X  /*G*/  {000000,000000,0x001e,0x0011,0x0011,0x0019,0x0001,0x0001,0x001e},
  163. X  /*H*/  {000000,000000,0x0011,0x0011,0x0011,0x001f,0x0011,0x0011,0x0011},
  164. X  /*I*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0004,0x000e},
  165. X  /*J*/  {000000,000000,0x000e,0x0011,0x0010,0x0010,0x0010,0x0010,0x0010},
  166. X  /*K*/  {000000,000000,0x0011,0x0009,0x0005,0x0003,0x0005,0x0009,0x0011},
  167. X  /*L*/  {000000,000000,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  168. X  /*M*/  {000000,000000,0x0011,0x0011,0x0011,0x0015,0x0015,0x001b,0x0011},
  169. X  /*N*/  {000000,000000,0x0011,0x0011,0x0011,0x0019,0x0015,0x0013,0x0011},
  170. X  /*O*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x0011,0x0011,0x000e},
  171. X  /*P*/  {000000,000000,0x0001,0x0001,0x0001,0x000f,0x0011,0x0011,0x000f},
  172. X  /*Q*/  {000000,0x0018,0x000e,0x0015,0x0011,0x0011,0x0011,0x0011,0x000e},
  173. X  /*R*/  {000000,000000,0x0011,0x0009,0x0005,0x000f,0x0011,0x0011,0x000f},
  174. X  /*S*/  {000000,000000,0x000e,0x0011,0x0010,0x000e,0x0001,0x0011,0x000e},
  175. X  /*T*/  {000000,000000,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x001f},
  176. X  /*U*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x0011,0x0011,0x0011},
  177. X  /*V*/  {000000,000000,0x0004,0x0004,0x000a,0x000a,0x0011,0x0011,0x0011},
  178. X  /*W*/  {000000,000000,0x0011,0x001b,0x0015,0x0011,0x0011,0x0011,0x0011},
  179. X  /*X*/  {000000,000000,0x0011,0x0011,0x000a,0x0004,0x000a,0x0011,0x0011},
  180. X  /*Y*/  {000000,000000,0x0004,0x0004,0x0004,0x0004,0x000a,0x0011,0x0011},
  181. X  /*Z*/  {000000,000000,0x001f,0x0001,0x0002,0x0004,0x0008,0x0010,0x001f},
  182. X  /*[*/  {000000,000000,0x000e,0x0002,0x0002,0x0002,0x0002,0x0002,0x000e},
  183. X  /*\*/  {000000,000000,000000,0x0010,0x0008,0x0004,0x0002,0x0001,000000},
  184. X  /*]*/  {000000,000000,0x000e,0x0008,0x0008,0x0008,0x0008,0x0008,0x000e},
  185. X  /*^*/  {000000,000000,000000,000000,000000,000000,0x0011,0x000a,0x0004},
  186. X  /*_*/  {000000,000000,0x001f,000000,000000,000000,000000,000000,000000},
  187. X  /*`*/  {000000,000000,000000,000000,000000,0x0008,0x0004,0x000c,0x000c},
  188. X  /*a*/  {000000,000000,0x001e,0x0011,0x001e,0x0010,0x000e,000000,000000},
  189. X  /*b*/  {000000,000000,0x000d,0x0013,0x0011,0x0013,0x000d,0x0001,0x0001},
  190. X  /*c*/  {000000,000000,0x000e,0x0011,0x0001,0x0011,0x000e,000000,000000},
  191. X  /*d*/  {000000,000000,0x0016,0x0019,0x0011,0x0019,0x0016,0x0010,0x0010},
  192. X  /*e*/  {000000,000000,0x000e,0x0001,0x001f,0x0011,0x000e,000000,000000},
  193. X  /*f*/  {000000,000000,0x0004,0x0004,0x0004,0x000e,0x0004,0x0014,0x0008},
  194. X  /*g*/  {0x000e,0x0011,0x0016,0x0019,0x0011,0x0019,0x0016,000000,000000},
  195. X  /*h*/  {000000,000000,0x0011,0x0011,0x0011,0x0013,0x000d,0x0001,0x0001},
  196. X  /*i*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0006,000000,0x0004},
  197. X  /*j*/  {0x0006,0x0009,0x0008,0x0008,0x0008,0x0008,0x000c,000000,0x0008},
  198. X  /*k*/  {000000,000000,0x0009,0x0005,0x0003,0x0005,0x0009,0x0001,0x0001},
  199. X  /*l*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0004,0x0006},
  200. X  /*m*/  {000000,000000,0x0015,0x0015,0x0015,0x0015,0x000b,000000,000000},
  201. X  /*n*/  {000000,000000,0x0011,0x0011,0x0011,0x0013,0x000d,000000,000000},
  202. X  /*o*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x000e,000000,000000},
  203. X  /*p*/  {0x0001,0x0001,0x000d,0x0013,0x0011,0x0013,0x000d,000000,000000},
  204. X  /*q*/  {0x0010,0x0010,0x0016,0x0019,0x0011,0x0019,0x0016,000000,000000},
  205. X  /*r*/  {000000,000000,0x0001,0x0001,0x0001,0x0013,0x000d,000000,000000},
  206. X  /*s*/  {000000,000000,0x000f,0x0010,0x000e,0x0001,0x001e,000000,000000},
  207. X  /*t*/  {000000,000000,0x0008,0x0014,0x0004,0x0004,0x001f,0x0004,0x0004},
  208. X  /*u*/  {000000,000000,0x0016,0x0019,0x0011,0x0011,0x0011,000000,000000},
  209. X  /*v*/  {000000,000000,0x0004,0x000a,0x0011,0x0011,0x0011,000000,000000},
  210. X  /*w*/  {000000,000000,0x000a,0x0015,0x0015,0x0011,0x0011,000000,000000},
  211. X  /*x*/  {000000,000000,0x0011,0x000a,0x0004,0x000a,0x0011,000000,000000},
  212. X  /*y*/  {0x000e,0x0010,0x001e,0x0011,0x0011,0x0011,0x0011,000000,000000},
  213. X  /*z*/  {000000,000000,0x001f,0x0002,0x0004,0x0008,0x001f,000000,000000},
  214. X  /*{*/  {000000,000000,0x0008,0x0004,0x0004,0x0002,0x0004,0x0004,0x0008},
  215. X  /*|*/  {000000,000000,0x0004,0x0004,0x0004,000000,0x0004,0x0004,0x0004},
  216. X  /*}*/  {000000,000000,0x0002,0x0004,0x0004,0x0008,0x0004,0x0004,0x0002},
  217. X  /*~*/  {000000,000000,000000,000000,000000,000000,0x0008,0x0015,0x0002},
  218. X  /*DEL*/{000000,000000,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f},
  219. X};
  220. X
  221. X/* 9x17 font, bottom row first, left pixel in lsb */
  222. Xchar_row GPFAR fnt9x17[FNT_CHARS][FNT9X17_VBITS] = {
  223. X  /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  224. X          000000,000000,000000,000000,000000,000000,000000,000000},
  225. X  /*!*/  {000000,000000,000000,000000,0x0010,000000,000000,000000,0x0010,
  226. X          0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010},
  227. X  /*"*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  228. X          000000,000000,000000,0x0044,0x0044,0x0044,0x0044,0x0044},
  229. X  /*#*/  {000000,000000,000000,000000,0x0044,0x0044,0x0044,0x0044,0x01ff,
  230. X          0x0044,0x0044,0x0044,0x01ff,0x0044,0x0044,0x0044,0x0044},
  231. X  /*$*/  {000000,000000,000000,000000,0x0010,0x0010,0x007e,0x0091,0x0110,
  232. X          0x0090,0x007c,0x0012,0x0011,0x0112,0x00fc,0x0010,0x0010},
  233. X  /*%*/  {000000,000000,000000,000000,0x0080,0x0141,0x0081,0x0002,0x0004,
  234. X          0x0008,0x0010,0x0020,0x0040,0x0080,0x0102,0x0105,0x0002},
  235. X  /*&*/  {000000,000000,000000,000000,0x011c,0x00a2,0x0041,0x00c1,0x0141,
  236. X          0x0022,0x001c,0x0014,0x0022,0x0022,0x001c,000000,000000},
  237. X  /*'*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  238. X          000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010},
  239. X  /*(*/  {000000,000000,000000,000000,0x0040,0x0020,0x0010,0x0008,0x0008,
  240. X          0x0004,0x0004,0x0004,0x0008,0x0008,0x0010,0x0020,0x0040},
  241. X  /*)*/  {000000,000000,000000,000000,0x0004,0x0008,0x0010,0x0020,0x0020,
  242. X          0x0040,0x0040,0x0040,0x0020,0x0020,0x0010,0x0008,0x0004},
  243. X  /***/  {000000,000000,000000,000000,0x0010,0x0010,0x0111,0x0092,0x0054,
  244. X          0x0038,0x01ff,0x0038,0x0054,0x0092,0x0111,0x0010,0x0010},
  245. X  /*+*/  {000000,000000,000000,000000,000000,000000,0x0010,0x0010,0x0010,
  246. X          0x0010,0x01ff,0x0010,0x0010,0x0010,0x0010,000000,000000},
  247. X  /*,*/  {000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010,000000,
  248. X          000000,000000,000000,000000,000000,000000,000000,000000},
  249. X  /*-*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  250. X          000000,0x01ff,000000,000000,000000,000000,000000,000000},
  251. X  /*.*/  {000000,000000,000000,000000,0x0010,0x0038,0x0010,000000,000000,
  252. X          000000,000000,000000,000000,000000,000000,000000,000000},
  253. X  /*-/-*/{000000,000000,000000,000000,000000,000000,0x0001,0x0002,0x0004,
  254. X          0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,000000,000000},
  255. X  /*0*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0103,0x0105,
  256. X          0x0109,0x0111,0x0121,0x0141,0x0181,0x0101,0x0082,0x007c},
  257. X  /*1*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  258. X          0x0010,0x0010,0x0010,0x0010,0x0010,0x001c,0x0018,0x0010},
  259. X  /*2*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0001,0x0001,0x0001,
  260. X          0x0002,0x007c,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
  261. X  /*3*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  262. X          0x0080,0x0078,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
  263. X  /*4*/  {000000,000000,000000,000000,0x0040,0x0040,0x0040,0x0040,0x0040,
  264. X          0x01ff,0x0041,0x0042,0x0044,0x0048,0x0050,0x0060,0x0040},
  265. X  /*5*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  266. X          0x0100,0x0080,0x007f,0x0001,0x0001,0x0001,0x0001,0x01ff},
  267. X  /*6*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  268. X          0x0081,0x007f,0x0001,0x0001,0x0001,0x0002,0x0084,0x0078},
  269. X  /*7*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0002,0x0004,
  270. X          0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0100,0x01ff},
  271. X  /*8*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  272. X          0x0082,0x007c,0x0082,0x0101,0x0101,0x0101,0x0082,0x007c},
  273. X  /*9*/  {000000,000000,000000,000000,0x001c,0x0022,0x0040,0x0080,0x0100,
  274. X          0x0100,0x01fc,0x0102,0x0101,0x0101,0x0101,0x0082,0x007c},
  275. X  /*:*/  {000000,000000,000000,000000,000000,000000,0x0010,0x0038,0x0010,
  276. X          000000,000000,000000,0x0010,0x0038,0x0010,000000,000000},
  277. X  /*;*/  {000000,000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010,
  278. X          000000,000000,000000,0x0010,0x0038,0x0010,000000,000000},
  279. X  /*<*/  {000000,000000,000000,000000,0x0040,0x0020,0x0010,0x0008,0x0004,
  280. X          0x0002,0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040},
  281. X  /*=*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x01ff,
  282. X          000000,000000,000000,0x01ff,000000,000000,000000,000000},
  283. X  /*>*/  {000000,000000,000000,000000,0x0004,0x0008,0x0010,0x0020,0x0040,
  284. X          0x0080,0x0100,0x0080,0x0040,0x0020,0x0010,0x0008,0x0004},
  285. X  /*?*/  {000000,000000,000000,0x0010,0x0038,0x0010,000000,0x0010,0x0010,
  286. X          0x0020,0x0040,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
  287. X  /*@*/  {000000,000000,000000,000000,0x007c,0x0002,0x0001,0x01f9,0x0145,
  288. X          0x0145,0x0145,0x0179,0x0101,0x0101,0x0101,0x0082,0x007c},
  289. X  /*A*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x01ff,
  290. X          0x0101,0x0082,0x0082,0x0044,0x0044,0x0028,0x0028,0x0010},
  291. X  /*B*/  {000000,000000,000000,000000,0x007f,0x0084,0x0104,0x0104,0x0104,
  292. X          0x0084,0x007c,0x0084,0x0104,0x0104,0x0104,0x0084,0x007f},
  293. X  /*C*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0001,0x0001,
  294. X          0x0001,0x0001,0x0001,0x0001,0x0001,0x0101,0x0082,0x007c},
  295. X  /*D*/  {000000,000000,000000,000000,0x007f,0x0084,0x0104,0x0104,0x0104,
  296. X          0x0104,0x0104,0x0104,0x0104,0x0104,0x0104,0x0084,0x007f},
  297. X  /*E*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0001,0x0001,0x0001,
  298. X          0x0001,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x01ff},
  299. X  /*F*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
  300. X          0x0001,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x01ff},
  301. X  /*G*/  {000000,000000,000000,000000,0x00fc,0x0102,0x0101,0x0101,0x0101,
  302. X          0x0101,0x01c1,0x0001,0x0001,0x0001,0x0001,0x0102,0x00fc},
  303. X  /*H*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  304. X          0x0101,0x01ff,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
  305. X  /*I*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  306. X          0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x007c},
  307. X  /*J*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  308. X          0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0180},
  309. X  /*K*/  {000000,000000,000000,000000,0x0101,0x0081,0x0041,0x0021,0x0011,
  310. X          0x0009,0x0005,0x000b,0x0011,0x0021,0x0041,0x0081,0x0101},
  311. X  /*L*/  {000000,000000,000000,000000,0x01ff,0x0101,0x0001,0x0001,0x0001,
  312. X          0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  313. X  /*M*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  314. X          0x0101,0x0111,0x0111,0x0129,0x0145,0x0145,0x0183,0x0101},
  315. X  /*N*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0181,0x0141,
  316. X          0x0141,0x0121,0x0111,0x0109,0x0105,0x0105,0x0103,0x0101},
  317. X  /*O*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  318. X          0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0082,0x007c},
  319. X  /*P*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
  320. X          0x0001,0x007f,0x0081,0x0101,0x0101,0x0101,0x0081,0x007f},
  321. X  /*Q*/  {000000,000000,0x0180,0x0040,0x007c,0x0092,0x0101,0x0101,0x0101,
  322. X          0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0082,0x007c},
  323. X  /*R*/  {000000,000000,000000,000000,0x0101,0x0081,0x0041,0x0021,0x0011,
  324. X          0x0009,0x007f,0x0081,0x0101,0x0101,0x0101,0x0081,0x007f},
  325. X  /*S*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  326. X          0x0080,0x007c,0x0002,0x0001,0x0001,0x0101,0x0082,0x007c},
  327. X  /*T*/  {000000,000000,000000,000000,0x0038,0x0010,0x0010,0x0010,0x0010,
  328. X          0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0111,0x01ff},
  329. X  /*U*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  330. X          0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
  331. X  /*V*/  {000000,000000,000000,000000,0x0010,0x0010,0x0028,0x0028,0x0044,
  332. X          0x0044,0x0082,0x0082,0x0101,0x0101,0x0101,0x0101,0x0101},
  333. X  /*W*/  {000000,000000,000000,000000,0x0101,0x0183,0x0145,0x0145,0x0129,
  334. X          0x0111,0x0111,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
  335. X  /*X*/  {000000,000000,000000,000000,0x0101,0x0101,0x0082,0x0082,0x0044,
  336. X          0x0028,0x0010,0x0028,0x0044,0x0082,0x0082,0x0101,0x0101},
  337. X  /*Y*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
  338. X          0x0010,0x0010,0x0028,0x0044,0x0082,0x0082,0x0101,0x0101},
  339. X  /*Z*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0002,0x0002,0x0004,
  340. X          0x0008,0x0010,0x0020,0x0040,0x0080,0x0080,0x0100,0x01ff},
  341. X  /*[*/  {000000,000000,000000,000000,0x007c,0x0004,0x0004,0x0004,0x0004,
  342. X          0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x007c},
  343. X  /*\*/  {000000,000000,000000,000000,000000,000000,0x0100,0x0080,0x0040,
  344. X          0x0020,0x0010,0x0008,0x0004,0x0002,0x0001,000000,000000},
  345. X  /*]*/  {000000,000000,000000,000000,0x007c,0x0040,0x0040,0x0040,0x0040,
  346. X          0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x007c},
  347. X  /*^*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  348. X          000000,000000,000000,0x0101,0x0082,0x0044,0x0028,0x0010},
  349. X  /*_*/  {000000,000000,000000,000000,0x01ff,000000,000000,000000,000000,
  350. X          000000,000000,000000,000000,000000,000000,000000,000000},
  351. X  /*`*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  352. X          000000,000000,0x0020,0x0010,0x0008,0x000c,0x001c,0x0008},
  353. X  /*a*/  {000000,000000,000000,000000,0x03fc,0x0102,0x0101,0x0102,0x01fc,
  354. X          0x0100,0x0100,0x0080,0x007c,000000,000000,000000,000000},
  355. X  /*b*/  {000000,000000,000000,000000,0x007d,0x0083,0x0101,0x0101,0x0101,
  356. X          0x0101,0x0101,0x0083,0x007d,0x0001,0x0001,0x0001,0x0001},
  357. X  /*c*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0001,0x0001,
  358. X          0x0001,0x0101,0x0082,0x007c,000000,000000,000000,000000},
  359. X  /*d*/  {000000,000000,000000,000000,0x017c,0x0182,0x0101,0x0101,0x0101,
  360. X          0x0101,0x0101,0x0182,0x017c,0x0100,0x0100,0x0100,0x0100},
  361. X  /*e*/  {000000,000000,000000,000000,0x007c,0x0002,0x0001,0x0001,0x01ff,
  362. X          0x0101,0x0101,0x0082,0x007c,000000,000000,000000,000000},
  363. X  /*f*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
  364. X          0x0010,0x007c,0x0010,0x0010,0x0010,0x0110,0x00a0,0x0040},
  365. X  /*g*/  {0x007c,0x0082,0x0101,0x0100,0x017c,0x0182,0x0101,0x0101,0x0101,
  366. X          0x0101,0x0101,0x0182,0x017c,000000,000000,000000,000000},
  367. X  /*h*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  368. X          0x0103,0x0103,0x0085,0x0079,0x0001,0x0001,0x0001,0x0001},
  369. X  /*i*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  370. X          0x0010,0x0010,0x0018,000000,000000,0x0018,0x0018,000000},
  371. X  /*j*/  {0x003c,0x0042,0x0081,0x0080,0x0080,0x0080,0x0080,0x0080,0x0080,
  372. X          0x0080,0x0080,0x00c0,000000,000000,0x00c0,0x00c0,000000},
  373. X  /*k*/  {000000,000000,000000,000000,0x0082,0x0042,0x0022,0x0012,0x000a,
  374. X          0x0016,0x0022,0x0042,0x0002,0x0002,0x0002,0x0002,0x0002},
  375. X  /*l*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  376. X          0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x001c},
  377. X  /*m*/  {000000,000000,000000,000000,0x0111,0x0111,0x0111,0x0111,0x0111,
  378. X          0x0111,0x0111,0x00ab,0x0045,000000,000000,000000,000000},
  379. X  /*n*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  380. X          0x0101,0x0101,0x0083,0x007d,000000,000000,000000,000000},
  381. X  /*o*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  382. X          0x0101,0x0101,0x0082,0x007c,000000,000000,000000,000000},
  383. X  /*p*/  {0x0001,0x0001,0x0001,0x0001,0x007d,0x0003,0x0081,0x0101,0x0101,
  384. X          0x0101,0x0101,0x0083,0x007d,000000,000000,000000,000000},
  385. X  /*q*/  {0x0100,0x0100,0x0100,0x0100,0x017c,0x0182,0x0101,0x0101,0x0101,
  386. X          0x0101,0x0101,0x0182,0x017c,000000,000000,000000,000000},
  387. X  /*r*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
  388. X          0x0001,0x0103,0x0085,0x0079,000000,000000,000000,000000},
  389. X  /*s*/  {000000,000000,000000,000000,0x007e,0x0081,0x0100,0x0080,0x007c,
  390. X          0x0002,0x0001,0x0102,0x00fc,000000,000000,000000,000000},
  391. X  /*t*/  {000000,000000,000000,000000,0x0040,0x00a0,0x0110,0x0010,0x0010,
  392. X          0x0010,0x0010,0x0010,0x00fe,0x0010,0x0010,0x0010,0x0010},
  393. X  /*u*/  {000000,000000,000000,000000,0x013c,0x0142,0x0181,0x0101,0x0101,
  394. X          0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  395. X  /*v*/  {000000,000000,000000,000000,0x0010,0x0028,0x0044,0x0082,0x0101,
  396. X          0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  397. X  /*w*/  {000000,000000,000000,000000,0x0044,0x00aa,0x0111,0x0111,0x0101,
  398. X          0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  399. X  /*x*/  {000000,000000,000000,000000,0x0101,0x0082,0x0044,0x0028,0x0010,
  400. X          0x0028,0x0044,0x0082,0x0101,000000,000000,000000,000000},
  401. X  /*y*/  {0x007c,0x0082,0x0101,0x0100,0x0100,0x01fc,0x0102,0x0101,0x0101,
  402. X          0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  403. X  /*z*/  {000000,000000,000000,000000,0x01ff,0x0002,0x0004,0x0008,0x0010,
  404. X          0x0020,0x0040,0x0080,0x01ff,000000,000000,000000,000000},
  405. X  /*{*/  {000000,000000,000000,000000,0x00c0,0x0020,0x0010,0x0010,0x0010,
  406. X          0x0008,0x0004,0x0008,0x0010,0x0010,0x0010,0x0020,0x00c0},
  407. X  /*|*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
  408. X          000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010},
  409. X  /*}*/  {000000,000000,000000,000000,0x0006,0x0008,0x0010,0x0010,0x0010,
  410. X          0x0020,0x0040,0x0020,0x0010,0x0010,0x0010,0x0008,0x0006},
  411. X  /*~*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  412. X          000000,000000,000000,0x0040,0x00a0,0x0111,0x000a,0x0004},
  413. X  /*DEL*/{000000,000000,000000,000000,0x0155,000000,0x0155,000000,0x0155,
  414. X          000000,0x0155,000000,0x0155,000000,0x0155,000000,0x0155},
  415. X};
  416. X
  417. X/* 13x25 font, bottom row first, left pixel in lsb */
  418. Xchar_row GPFAR fnt13x25[FNT_CHARS][FNT13X25_VBITS] = {
  419. X  /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  420. X          000000,000000,000000,000000,000000,000000,000000,000000,000000,
  421. X          000000,000000,000000,000000,000000,000000,000000},
  422. X  /*!*/  {000000,000000,000000,000000,000000,0x00e0,0x00e0,0x00e0,000000,
  423. X          000000,000000,0x0040,0x0040,0x0040,0x0040,0x0040,0x00e0,0x00e0,
  424. X          0x00e0,0x00e0,0x00e0,0x00e0,0x00e0,0x00e0,0x0040},
  425. X  /*"*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  426. X          000000,000000,000000,000000,000000,000000,000000,000000,000000,
  427. X          0x0208,0x0208,0x0208,0x0208,0x0208,0x0208,0x0208},
  428. X  /*#*/  {000000,000000,000000,000000,000000,000000,0x0208,0x0208,0x0208,
  429. X          0x0208,0x0208,0x0208,0x1fff,0x0208,0x0208,0x0208,0x0208,0x0208,
  430. X          0x1fff,0x0208,0x0208,0x0208,0x0208,0x0208,0x0208},
  431. X  /*$*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  432. X          0x03f8,0x0444,0x0842,0x0840,0x0840,0x0440,0x03f8,0x0044,0x0042,
  433. X          0x0042,0x0842,0x0444,0x03f8,0x0040,0x0040,0x0040},
  434. X  /*%*/  {000000,000000,000000,000000,000000,000000,0x0c00,0x1200,0x1201,
  435. X          0x0c01,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  436. X          0x0200,0x0400,0x0800,0x1006,0x1009,0x0009,0x0006},
  437. X  /*&*/  {000000,000000,000000,000000,000000,000000,0x1078,0x1084,0x0902,
  438. X          0x0601,0x0601,0x0901,0x1081,0x0042,0x0024,0x0018,0x0018,0x0024,
  439. X          0x0042,0x0042,0x0042,0x0042,0x0024,0x0018,000000},
  440. X  /*'*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  441. X          000000,000000,000000,000000,000000,0x0001,0x0002,0x0004,0x0008,
  442. X          0x0010,0x0030,0x0078,0x0078,0x0078,0x0030,000000},
  443. X  /*(*/  {000000,000000,000000,000000,000000,000000,0x0080,0x0040,0x0020,
  444. X          0x0020,0x0010,0x0008,0x0008,0x0004,0x0004,0x0004,0x0004,0x0004,
  445. X          0x0008,0x0008,0x0010,0x0020,0x0020,0x0040,0x0080},
  446. X  /*)*/  {000000,000000,000000,000000,000000,000000,0x0020,0x0040,0x0080,
  447. X          0x0080,0x0100,0x0200,0x0200,0x0400,0x0400,0x0400,0x0400,0x0400,
  448. X          0x0200,0x0200,0x0100,0x0080,0x0080,0x0040,0x0020},
  449. X  /***/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  450. X          0x1041,0x0842,0x0444,0x0248,0x0150,0x00e0,0x1fff,0x00e0,0x0150,
  451. X          0x0248,0x0444,0x0842,0x1041,0x0040,0x0040,0x0040},
  452. X  /*+*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  453. X          0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x1fff,0x0040,0x0040,
  454. X          0x0040,0x0040,0x0040,0x0040,000000,000000,000000},
  455. X  /*,*/  {000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0030,0x0078,
  456. X          0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
  457. X          000000,000000,000000,000000,000000,000000,000000},
  458. X  /*-*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  459. X          000000,000000,000000,000000,000000,000000,0x1fff,000000,000000,
  460. X          000000,000000,000000,000000,000000,000000,000000},
  461. X  /*.*/  {000000,000000,000000,000000,000000,000000,000000,0x0038,0x007c,
  462. X          0x007c,0x007c,0x0038,000000,000000,000000,000000,000000,000000,
  463. X          000000,000000,000000,000000,000000,000000,000000},
  464. X  /*-/-*/{000000,000000,000000,000000,000000,000000,000000,000000,0x0001,
  465. X          0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  466. X          0x0200,0x0400,0x0800,0x1000,0x1000,000000,000000},
  467. X  /*0*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  468. X          0x1001,0x1003,0x1005,0x1009,0x1011,0x1021,0x1041,0x1081,0x1101,
  469. X          0x1201,0x1401,0x1801,0x1001,0x0802,0x0404,0x03f8},
  470. X  /*1*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  471. X          0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  472. X          0x0040,0x0040,0x0040,0x0048,0x0070,0x0060,0x0040},
  473. X  /*2*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
  474. X          0x0001,0x0001,0x0001,0x0001,0x0002,0x03fc,0x0400,0x0800,0x1000,
  475. X          0x1000,0x1000,0x1000,0x1001,0x0802,0x0404,0x03f8},
  476. X  /*3*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  477. X          0x1001,0x1000,0x1000,0x1000,0x0800,0x0400,0x03e0,0x0400,0x0800,
  478. X          0x1000,0x1000,0x1000,0x1001,0x0802,0x0404,0x03f8},
  479. X  /*4*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0200,0x0200,
  480. X          0x0200,0x0200,0x0200,0x0200,0x1fff,0x0201,0x0201,0x0202,0x0204,
  481. X          0x0208,0x0210,0x0220,0x0240,0x0280,0x0300,0x0200},
  482. X  /*5*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  483. X          0x1001,0x1000,0x1000,0x1000,0x1000,0x1000,0x0800,0x0400,0x03ff,
  484. X          0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
  485. X  /*6*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  486. X          0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff,0x0001,0x0001,
  487. X          0x0001,0x0001,0x0002,0x0004,0x0808,0x0410,0x03e0},
  488. X  /*7*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  489. X          0x0002,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  490. X          0x0200,0x0400,0x0800,0x0800,0x1000,0x1000,0x1fff},
  491. X  /*8*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  492. X          0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8,0x0404,0x0802,
  493. X          0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  494. X  /*9*/  {000000,000000,000000,000000,000000,000000,0x00f8,0x0104,0x0202,
  495. X          0x0400,0x0800,0x1000,0x1000,0x1000,0x1000,0x1ff8,0x1004,0x1002,
  496. X          0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  497. X  /*:*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x0030,
  498. X          0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
  499. X          0x0030,0x0078,0x0078,0x0030,000000,000000,000000},
  500. X  /*;*/  {000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0030,0x0078,
  501. X          0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
  502. X          0x0030,0x0078,0x0078,0x0030,000000,000000,000000},
  503. X  /*<*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0100,0x0080,
  504. X          0x0040,0x0020,0x0010,0x0008,0x0004,0x0002,0x0001,0x0002,0x0004,
  505. X          0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200},
  506. X  /*=*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  507. X          000000,000000,000000,0x1fff,000000,000000,000000,000000,000000,
  508. X          0x1fff,000000,000000,000000,000000,000000,000000},
  509. X  /*>*/  {000000,000000,000000,000000,000000,000000,0x0008,0x0010,0x0020,
  510. X          0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,0x1000,0x0800,0x0400,
  511. X          0x0200,0x0100,0x0080,0x0040,0x0020,0x0010,0x0008},
  512. X  /*?*/  {000000,000000,000000,000000,000000,0x0040,0x00e0,0x0040,000000,
  513. X          000000,000000,0x0040,0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,
  514. X          0x1000,0x1000,0x1001,0x1001,0x0802,0x0404,0x03f8},
  515. X  /*@*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0002,
  516. X          0x0001,0x0001,0x0ee1,0x1111,0x1111,0x1111,0x1111,0x1111,0x12e1,
  517. X          0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  518. X  /*A*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  519. X          0x1001,0x1001,0x1001,0x1fff,0x1001,0x1001,0x1001,0x1001,0x0802,
  520. X          0x0802,0x0404,0x0208,0x0110,0x00a0,0x00a0,0x0040},
  521. X  /*B*/  {000000,000000,000000,000000,000000,000000,0x03ff,0x0408,0x0808,
  522. X          0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03f8,0x0408,0x0808,
  523. X          0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03ff},
  524. X  /*C*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  525. X          0x1001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
  526. X          0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,0x03f8},
  527. X  /*D*/  {000000,000000,000000,000000,000000,000000,0x03ff,0x0408,0x0808,
  528. X          0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,
  529. X          0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03ff},
  530. X  /*E*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
  531. X          0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x007f,0x0001,0x0001,
  532. X          0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
  533. X  /*F*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  534. X          0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x007f,0x0001,0x0001,
  535. X          0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
  536. X  /*G*/  {000000,000000,000000,000000,000000,000000,0x0ff8,0x1004,0x1002,
  537. X          0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1f01,0x0001,0x0001,
  538. X          0x0001,0x0001,0x0001,0x0001,0x0002,0x1004,0x0ff8},
  539. X  /*H*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  540. X          0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1fff,0x1001,0x1001,
  541. X          0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  542. X  /*I*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  543. X          0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  544. X          0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x03f8},
  545. X  /*J*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  546. X          0x1001,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
  547. X          0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1e00},
  548. X  /*K*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0801,0x0401,
  549. X          0x0201,0x0101,0x0081,0x0041,0x0021,0x0011,0x000f,0x0009,0x0011,
  550. X          0x0021,0x0041,0x0081,0x0101,0x0201,0x0401,0x0801},
  551. X  /*L*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x1001,0x1001,
  552. X          0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
  553. X          0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  554. X  /*M*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  555. X          0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1041,0x1041,0x10a1,
  556. X          0x10a1,0x1111,0x1209,0x1209,0x1405,0x1803,0x1001},
  557. X  /*N*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  558. X          0x1001,0x1801,0x1401,0x1201,0x1201,0x1101,0x1081,0x1041,0x1041,
  559. X          0x1021,0x1011,0x1009,0x1009,0x1005,0x1003,0x1001},
  560. X  /*O*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  561. X          0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  562. X          0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  563. X  /*P*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  564. X          0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x03ff,0x0401,0x0801,
  565. X          0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff},
  566. X  /*Q*/  {000000,000000,000000,000000,0x0c00,0x0200,0x03f8,0x0494,0x0862,
  567. X          0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  568. X          0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  569. X  /*R*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0801,0x0401,
  570. X          0x0201,0x0101,0x0081,0x0041,0x0021,0x0011,0x03ff,0x0401,0x0801,
  571. X          0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff},
  572. X  /*S*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  573. X          0x1001,0x1000,0x1000,0x1000,0x0800,0x0400,0x03f8,0x0004,0x0002,
  574. X          0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,0x03f8},
  575. X  /*T*/  {000000,000000,000000,000000,000000,000000,0x00e0,0x0040,0x0040,
  576. X          0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  577. X          0x0040,0x0040,0x0040,0x0040,0x0040,0x1041,0x1fff},
  578. X  /*U*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  579. X          0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  580. X          0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  581. X  /*V*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x00a0,
  582. X          0x00a0,0x0110,0x0110,0x0208,0x0208,0x0404,0x0404,0x0802,0x0802,
  583. X          0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  584. X  /*W*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1803,
  585. X          0x1405,0x1405,0x1209,0x1209,0x1111,0x1111,0x10a1,0x1041,0x1001,
  586. X          0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  587. X  /*X*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  588. X          0x0802,0x0802,0x0404,0x0208,0x0110,0x00a0,0x0040,0x00a0,0x0110,
  589. X          0x0208,0x0404,0x0802,0x0802,0x1001,0x1001,0x1001},
  590. X  /*Y*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  591. X          0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x00a0,0x0110,0x0208,
  592. X          0x0404,0x0802,0x0802,0x1001,0x1001,0x1001,0x1001},
  593. X  /*Z*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
  594. X          0x0002,0x0004,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  595. X          0x0200,0x0400,0x0400,0x0800,0x1000,0x1000,0x1fff},
  596. X  /*[*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0008,0x0008,
  597. X          0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,
  598. X          0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x03f8},
  599. X  /*\*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x1000,
  600. X          0x1000,0x0800,0x0400,0x0200,0x0100,0x0080,0x0040,0x0020,0x0010,
  601. X          0x0008,0x0004,0x0002,0x0001,0x0001,000000,000000},
  602. X  /*]*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0200,0x0200,
  603. X          0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,
  604. X          0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x03f8},
  605. X  /*^*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  606. X          000000,000000,000000,000000,000000,000000,000000,000000,000000,
  607. X          0x1001,0x0802,0x0404,0x0208,0x0110,0x00a0,0x0040},
  608. X  /*_*/  {000000,000000,000000,000000,000000,000000,0x1fff,000000,000000,
  609. X          000000,000000,000000,000000,000000,000000,000000,000000,000000,
  610. X          000000,000000,000000,000000,000000,000000,000000},
  611. X  /*`*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  612. X          000000,000000,000000,000000,000000,0x0400,0x0200,0x0100,0x0080,
  613. X          0x0040,0x0060,0x00f0,0x00f0,0x00f0,0x0060,000000},
  614. X  /*a*/  {000000,000000,000000,000000,000000,000000,0x17f8,0x0804,0x0802,
  615. X          0x0802,0x0802,0x0804,0x0ff8,0x0800,0x0800,0x0800,0x0800,0x0404,
  616. X          0x03f8,000000,000000,000000,000000,000000,000000},
  617. X  /*b*/  {000000,000000,000000,000000,000000,000000,0x03f9,0x0405,0x0803,
  618. X          0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  619. X          0x03f9,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  620. X  /*c*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  621. X          0x1001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,
  622. X          0x03f8,000000,000000,000000,000000,000000,000000},
  623. X  /*d*/  {000000,000000,000000,000000,000000,000000,0x13f8,0x1404,0x1802,
  624. X          0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
  625. X          0x13f8,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000},
  626. X  /*e*/  {000000,000000,000000,000000,000000,000000,0x0ff8,0x0004,0x0002,
  627. X          0x0001,0x0001,0x0001,0x1fff,0x1001,0x1001,0x1001,0x0802,0x0404,
  628. X          0x03f8,000000,000000,000000,000000,000000,000000},
  629. X  /*f*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  630. X          0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x03f8,0x0040,0x0040,
  631. X          0x0040,0x0040,0x0040,0x1040,0x0880,0x0500,0x0200},
  632. X  /*g*/  {0x03f8,0x0404,0x0802,0x1001,0x1000,0x1000,0x13f8,0x1404,0x1802,
  633. X          0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
  634. X          0x13f8,000000,000000,000000,000000,000000,000000},
  635. X  /*h*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  636. X          0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  637. X          0x03f9,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  638. X  /*i*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  639. X          0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0070,
  640. X          000000,000000,000000,0x00e0,0x00e0,0x00e0,000000},
  641. X  /*j*/  {0x00f0,0x0108,0x0204,0x0402,0x0400,0x0400,0x0400,0x0400,0x0400,
  642. X          0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0700,
  643. X          000000,000000,000000,0x0700,0x0700,0x0700,000000},
  644. X  /*k*/  {000000,000000,000000,000000,000000,000000,0x0804,0x0404,0x0204,
  645. X          0x0104,0x0084,0x0044,0x0024,0x0014,0x002c,0x0044,0x0084,0x0104,
  646. X          0x0204,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004},
  647. X  /*l*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  648. X          0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  649. X          0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0070},
  650. X  /*m*/  {000000,000000,000000,000000,000000,000000,0x1041,0x1041,0x1041,
  651. X          0x1041,0x1041,0x1041,0x1041,0x1041,0x1041,0x1041,0x08a3,0x0515,
  652. X          0x0209,000000,000000,000000,000000,000000,000000},
  653. X  /*n*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  654. X          0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  655. X          0x03f9,000000,000000,000000,000000,000000,000000},
  656. X  /*o*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  657. X          0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,
  658. X          0x03f8,000000,000000,000000,000000,000000,000000},
  659. X  /*p*/  {0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x03f9,0x0405,0x0803,
  660. X          0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  661. X          0x03f9,000000,000000,000000,000000,000000,000000},
  662. X  /*q*/  {0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x13f8,0x1404,0x1802,
  663. X          0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
  664. X          0x13f8,000000,000000,000000,000000,000000,000000},
  665. X  /*r*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  666. X          0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1001,0x0803,0x0405,
  667. X          0x03f9,000000,000000,000000,000000,000000,000000},
  668. X  /*s*/  {000000,000000,000000,000000,000000,000000,0x03fc,0x0402,0x0800,
  669. X          0x0800,0x0800,0x0400,0x03f8,0x0004,0x0002,0x0002,0x0002,0x0804,
  670. X          0x07f8,000000,000000,000000,000000,000000,000000},
  671. X  /*t*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0500,0x0880,
  672. X          0x1040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  673. X          0x07fc,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040},
  674. X  /*u*/  {000000,000000,000000,000000,000000,000000,0x13f8,0x1404,0x1802,
  675. X          0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  676. X          0x1001,000000,000000,000000,000000,000000,000000},
  677. X  /*v*/  {000000,000000,000000,000000,000000,000000,0x0040,0x00a0,0x0110,
  678. X          0x0208,0x0404,0x0802,0x0802,0x1001,0x1001,0x1001,0x1001,0x1001,
  679. X          0x1001,000000,000000,000000,000000,000000,000000},
  680. X  /*w*/  {000000,000000,000000,000000,000000,000000,0x0208,0x0514,0x08a2,
  681. X          0x08a2,0x1041,0x1041,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  682. X          0x1001,000000,000000,000000,000000,000000,000000},
  683. X  /*x*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0802,0x0404,
  684. X          0x0208,0x0110,0x00a0,0x0040,0x00a0,0x0110,0x0208,0x0404,0x0802,
  685. X          0x1001,000000,000000,000000,000000,000000,000000},
  686. X  /*y*/  {0x03f8,0x0404,0x0802,0x1001,0x1000,0x1000,0x1000,0x1000,0x1ff8,
  687. X          0x1004,0x1002,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  688. X          0x1001,000000,000000,000000,000000,000000,000000},
  689. X  /*z*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0002,0x0004,
  690. X          0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,
  691. X          0x1fff,000000,000000,000000,000000,000000,000000},
  692. X  /*{*/  {000000,000000,000000,000000,000000,000000,0x0600,0x0100,0x0080,
  693. X          0x0040,0x0040,0x0040,0x0040,0x0040,0x0020,0x0010,0x0020,0x0040,
  694. X          0x0040,0x0040,0x0040,0x0040,0x0080,0x0100,0x0600},
  695. X  /*|*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  696. X          0x0040,0x0040,0x0040,0x0040,000000,000000,000000,000000,000000,
  697. X          0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040},
  698. X  /*}*/  {000000,000000,000000,000000,000000,000000,0x000c,0x0010,0x0020,
  699. X          0x0040,0x0040,0x0040,0x0040,0x0040,0x0080,0x0100,0x0080,0x0040,
  700. X          0x0040,0x0040,0x0040,0x0040,0x0020,0x0010,0x000c},
  701. X  /*~*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  702. X          000000,000000,000000,000000,000000,000000,000000,000000,000000,
  703. X          0x0600,0x0900,0x1080,0x1041,0x0021,0x0012,0x000c},
  704. X  /*DEL*/{000000,000000,000000,000000,000000,000000,0x1249,000000,000000,
  705. X          0x1249,000000,000000,0x1249,000000,000000,0x1249,000000,000000,
  706. X          0x1249,000000,000000,0x1249,000000,000000,0x1249},
  707. X};
  708. X
  709. X/*
  710. X** The plotting area is defined as a huge bitmap.
  711. X** The bitmap is stored in a dynamically allocated pixel array b_p
  712. X**
  713. X** The bitmap is allocated (and initialized to zero) with
  714. X** b_makebitmap(xsize, ysize, planes)
  715. X** and freed with b_freebitmap()
  716. X** xsize and ysize will be rounded up to a multiple of 8.
  717. X**
  718. X** Valid (int) coordinates range from zero to (xsize-1,ysize-1)
  719. X**
  720. X** Plotting is done via b_move(x, y) and b_vector(x, y) functions,
  721. X** where the point (x,y) is the target to go from the current point
  722. X** To set the color use b_setvalue(value) where value is the value 
  723. X** (0 or 1 or a color number) to be stored in every pixel.
  724. X** To get dotted line styles, use b_setlinetype(linetype).
  725. X**
  726. X** Internally all plotting goes through b_setpixel(x, y, value).
  727. X*/
  728. X
  729. X
  730. X/*
  731. X** set pixel (x, y, value) to value value (this can be 1/0 or a color number).
  732. X*/
  733. Xvoid
  734. Xb_setpixel(x, y, value)
  735. Xunsigned int x, y, value;
  736. X{
  737. X  register unsigned int row;
  738. X  register unsigned char mask;
  739. X  int i;
  740. X  if (b_rastermode) {
  741. X    /* interchange so that new (x,y) is old (y,b_ysize-1-x) */
  742. X    row = x;  /* temp storage */
  743. X    x = y;
  744. X    y = b_ysize-1-row;
  745. X  }
  746. X  if (IN(x, b_xsize) && IN(y, b_ysize))
  747. X  {
  748. X    row = y/8;
  749. X    mask = 1<<(y%8);
  750. X
  751. X    for (i=0; i<b_planes; i++) {
  752. X        if (value&1)
  753. X            *((*b_p)[row]+x) |= mask;
  754. X        else
  755. X            *((*b_p)[row]+x) &= ~mask;
  756. X        row += b_psize;
  757. X        value >>= 1;
  758. X    }
  759. X  }
  760. X#ifdef BITMAPDEBUG
  761. X  else
  762. X  {
  763. X    if (b_rastermode)
  764. X      fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n", 
  765. X        b_ysize-1-y, x, value);
  766. X    else
  767. X      fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n",
  768. X        x, y, value);
  769. X  }
  770. X#endif
  771. X}
  772. X
  773. X/*
  774. X** get pixel (x,y) value----unused
  775. X*/
  776. X/****************************
  777. Xunsigned int
  778. Xb_getpixel(x, y)
  779. Xunsigned int x, y;
  780. X{
  781. X  register unsigned int row;
  782. X  register unsigned char mask;
  783. X  register unsigned char value;
  784. X  int i;
  785. X
  786. X  if (b_rastermode) {
  787. X    row = x;
  788. X    x = y;
  789. X    y = b_ysize-1-row;
  790. X  }
  791. X  if (IN(x, b_xsize) && IN(y, b_ysize))
  792. X  {
  793. X    row = y/8 + (b_planes-1)*b_psize;
  794. X    mask = 1<<(y%8);
  795. X
  796. X    for (i=0; i<b_planes; i++) {
  797. X        if ( *((*b_p)[row]+x) & mask )
  798. X            value |= 1;
  799. X        row -= b_psize;
  800. X        value <<= 1;
  801. X    }
  802. X    return(value);
  803. X  }
  804. X  else
  805. X  {
  806. X#ifdef BITMAPDEBUG
  807. X    if (b_rastermode)
  808. X      fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n",
  809. X        b_ysize-1-y, x);
  810. X    else
  811. X      fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n", x, y);
  812. X#endif
  813. X    return(0);
  814. X  }
  815. X}
  816. X********************************/
  817. X
  818. X/*
  819. X** allocate the bitmap
  820. X*/
  821. Xvoid
  822. Xb_makebitmap(x, y, planes)
  823. Xunsigned int x, y, planes;
  824. X{
  825. X  register unsigned j;
  826. X  unsigned rows;
  827. X
  828. X  x = 8 * (unsigned int)(x/8.0+0.9);    /* round up to multiple of 8 */
  829. X  y = 8 * (unsigned int)(y/8.0+0.9);    /* round up to multiple of 8 */
  830. X  b_psize = y/8;                    /* size of each plane */
  831. X  rows = b_psize * planes;            /* total number of rows of 8 pixels high */
  832. X  b_xsize = x; b_ysize = y;
  833. X  b_currx = b_curry = 0;
  834. X  b_planes = planes;
  835. X  b_value = 1;
  836. X  b_angle = 0;
  837. X  b_rastermode = 0;
  838. X  /* allocate row pointers */
  839. X  b_p = (bitmap *)alloc( (unsigned long)rows * sizeof(pixels *), "bitmap row buffer");
  840. X  bzero(b_p, rows * sizeof(pixels *));
  841. X  for (j = 0; j < rows; j++) {
  842. X    /* allocate bitmap buffers */
  843. X    (*b_p)[j] = (pixels *)alloc((unsigned long)x * sizeof(pixels),(char *)NULL);
  844. X    if ((*b_p)[j] == (pixels *)NULL) {
  845. X        b_freebitmap();  /* free what we have already allocated */
  846. X        int_error("out of memory for bitmap buffer", NO_CARET);
  847. X    }
  848. X    bzero((*b_p)[j], x * sizeof(pixels));
  849. X  }
  850. X}
  851. X  
  852. X/*
  853. X** free the allocated bitmap
  854. X*/
  855. Xvoid
  856. Xb_freebitmap()
  857. X{
  858. X  int j;
  859. X  unsigned rows;
  860. X
  861. X  rows = b_psize * b_planes;   /* total number of rows of 8 pixels high */
  862. X  for (j = 0; j < rows; j++)
  863. X  {
  864. X    (void) free((char *)(*b_p)[j]);
  865. X  }
  866. X  (void) free((char *)b_p);
  867. X  b_p = (bitmap *)(NULL);
  868. X}
  869. X
  870. X/*
  871. X** set pixel at (x,y) with color b_value and dotted mask b_linemask.
  872. X*/
  873. Xvoid
  874. Xb_setmaskpixel(x,y,value)
  875. Xunsigned int x,y,value;
  876. X{
  877. X    /* dotted line generator */
  878. X    if ((b_linemask>>b_maskcount)&(unsigned int)(1)) {
  879. X        b_setpixel(x,y,value);
  880. X    }
  881. X    b_maskcount= (b_maskcount+1) % 16;
  882. X    b_lastx= x;  /* last pixel set with mask */
  883. X    b_lasty= y;
  884. X}
  885. X
  886. X/*
  887. X** draw a line from (x1,y1) to (x2,y2)
  888. X** with color b_value and dotted mask b_linemask.
  889. X*/
  890. Xvoid
  891. Xb_line(x1,y1,x2,y2)
  892. Xunsigned int x1,y1,x2,y2;
  893. X{
  894. Xint runcount;
  895. Xint dx,dy;
  896. Xint xinc,yinc;
  897. Xunsigned int xplot,yplot;
  898. X
  899. X    runcount=0;
  900. X    dx = abs((int)(x1)-(int)(x2));
  901. X    if (x2>x1)  xinc=  1;
  902. X    if (x2==x1) xinc=  0;
  903. X    if (x2<x1)  xinc= -1;
  904. X    dy = abs((int)(y1)-(int)(y2));
  905. X    if (y2>y1)  yinc=  1;
  906. X    if (y2==y1) yinc=  0;
  907. X    if (y2<y1)  yinc= -1;
  908. X    xplot=x1;
  909. X    yplot=y1;
  910. X    if (dx>dy) {
  911. X        /* iterate x */
  912. X        if ( (b_linemask==0xffff) ||
  913. X            ((xplot!=b_lastx) && (yplot!=b_lasty)) )
  914. X            b_setmaskpixel(xplot,yplot,b_value);
  915. X        while (xplot!=x2) {
  916. X            xplot+=xinc;
  917. X            runcount+=dy;
  918. X            if (runcount>=(dx-runcount)) {
  919. X                yplot+=yinc;
  920. X                runcount-=dx;
  921. X            }
  922. X            b_setmaskpixel(xplot,yplot,b_value);
  923. X        }
  924. X    } else {
  925. X        /* iterate y */
  926. X        if ( (b_linemask==0xffff) ||
  927. X            ((xplot!=b_lastx) && (yplot!=b_lasty)) )
  928. X            b_setmaskpixel(xplot,yplot,b_value);
  929. X        while (yplot!=y2) {
  930. X            yplot+=yinc;
  931. X            runcount+=dx;
  932. X            if (runcount>=(dy-runcount)) {
  933. X                xplot+=xinc;
  934. X                runcount-=dy;
  935. X            }
  936. X            b_setmaskpixel(xplot,yplot,b_value);
  937. X        }
  938. X    }
  939. X}
  940. X
  941. X/*
  942. X** set character size
  943. X*/
  944. Xvoid
  945. Xb_charsize(size)
  946. Xunsigned int size;
  947. X{
  948. X    int j;
  949. X    switch(size) {
  950. X        case FNT5X9:
  951. X            b_hchar = FNT5X9_HCHAR;
  952. X            b_hbits = FNT5X9_HBITS;
  953. X            b_vchar = FNT5X9_VCHAR;
  954. X            b_vbits = FNT5X9_VBITS;
  955. X            for (j = 0; j < FNT_CHARS; j++ )
  956. X                b_font[j] = &fnt5x9[j][0];
  957. X            break;
  958. X        case FNT9X17:
  959. X            b_hchar = FNT9X17_HCHAR;
  960. X            b_hbits = FNT9X17_HBITS;
  961. X            b_vchar = FNT9X17_VCHAR;
  962. X            b_vbits = FNT9X17_VBITS;
  963. X            for (j = 0; j < FNT_CHARS; j++ )
  964. X                b_font[j] = &fnt9x17[j][0];
  965. X            break;
  966. X        case FNT13X25:
  967. X            b_hchar = FNT13X25_HCHAR;
  968. X            b_hbits = FNT13X25_HBITS;
  969. X            b_vchar = FNT13X25_VCHAR;
  970. X            b_vbits = FNT13X25_VBITS;
  971. X            for (j = 0; j < FNT_CHARS; j++ )
  972. X                b_font[j] = &fnt13x25[j][0];
  973. X            break;
  974. X        default:
  975. X            int_error("Unknown character size",NO_CARET);
  976. X    }
  977. X}
  978. X
  979. X
  980. X/*
  981. X** put characater c at (x,y) rotated by angle with color b_value.
  982. X*/
  983. Xvoid
  984. Xb_putc(x,y,c,angle)
  985. Xunsigned int x,y;
  986. Xchar c;
  987. Xunsigned int angle;
  988. X{
  989. X    unsigned int i, j, k;
  990. X    char_row fc;
  991. X
  992. X    j = c - ' ';
  993. X    for ( i = 0; i < b_vbits; i++ ) {
  994. X        fc = *( b_font[j] + i );
  995. X        if ( c == '_' ) {    /* treat underline specially */
  996. X            if ( fc  ) {    /* this this the underline row ? */
  997. X                /* draw the under line for the full h_char width */
  998. X                for ( k = ( b_hbits - b_hchar )/2;
  999. X                    k < ( b_hbits + b_hchar )/2; k++ ) {
  1000. X                    switch(angle) {
  1001. X                        case 0 : b_setpixel(x+k+1,y+i,b_value);
  1002. X                            break;
  1003. X                        case 1 : b_setpixel(x-i,y+k+1,b_value);
  1004. X                            break;
  1005. X                    }
  1006. X                }
  1007. X            }
  1008. X        }
  1009. X        else {
  1010. X            /* draw character */
  1011. X            for ( k = 0; k < b_hbits; k++ ) {
  1012. X                if ( ( fc >> k ) & 1 ) {
  1013. X                    switch(angle) {
  1014. X                        case 0 : b_setpixel(x+k+1,y+i,b_value);
  1015. X                            break;
  1016. X                        case 1 : b_setpixel(x-i,y+k+1,b_value);
  1017. X                            break;
  1018. X                    }
  1019. X                }
  1020. X            }
  1021. X        }
  1022. X    }
  1023. X}
  1024. X
  1025. X
  1026. X/*
  1027. X** set b_linemask to b_pattern[linetype]
  1028. X*/
  1029. Xint
  1030. Xb_setlinetype(linetype)
  1031. Xint linetype;
  1032. X{
  1033. X    if (linetype>=7)
  1034. X        linetype %= 7;
  1035. X    b_linemask = b_pattern[linetype+2];
  1036. X    b_maskcount=0;
  1037. X}
  1038. X
  1039. X/*
  1040. X** set b_value to value
  1041. X*/
  1042. Xvoid
  1043. Xb_setvalue(value)
  1044. Xunsigned int value;
  1045. X{
  1046. X    b_value = value;
  1047. X}
  1048. X
  1049. X/*
  1050. X** move to (x,y)
  1051. X*/
  1052. Xint
  1053. Xb_move(x, y)
  1054. Xunsigned int x, y;
  1055. X{
  1056. X  b_currx = x;
  1057. X  b_curry = y;
  1058. X}
  1059. X
  1060. X/*
  1061. X** draw to (x,y) with color b_value
  1062. X*/
  1063. Xint
  1064. Xb_vector(x, y)
  1065. Xunsigned int x, y;
  1066. X{
  1067. X  b_line(b_currx, b_curry, x, y);
  1068. X  b_currx = x;
  1069. X  b_curry = y;
  1070. X}
  1071. X
  1072. X
  1073. X/*
  1074. X** put text str at (x,y) with color b_value and rotation b_angle
  1075. X*/
  1076. Xint
  1077. Xb_put_text(x,y,str)
  1078. Xunsigned int x, y;
  1079. Xchar *str;
  1080. X{
  1081. X    if (b_angle == 1)
  1082. X        x += b_vchar/2;
  1083. X    else
  1084. X        y -= b_vchar/2;
  1085. X   switch (b_angle) {
  1086. X      case 0:
  1087. X     for (; *str; ++str, x += b_hchar)
  1088. X        b_putc (x, y, *str, b_angle);
  1089. X                    break;
  1090. X      case 1:
  1091. X     for (; *str; ++str, y += b_hchar)
  1092. X        b_putc (x, y, *str, b_angle);
  1093. X                    break;
  1094. X    }
  1095. X}
  1096. X
  1097. X
  1098. Xint
  1099. Xb_text_angle(ang)
  1100. Xint ang;
  1101. X{
  1102. X    b_angle=(unsigned int)ang;
  1103. X    return TRUE;
  1104. X}
  1105. END_OF_FILE
  1106.   if test 52378 -ne `wc -c <'gnuplot/bitmap.c'`; then
  1107.     echo shar: \"'gnuplot/bitmap.c'\" unpacked with wrong size!
  1108.   fi
  1109.   # end of 'gnuplot/bitmap.c'
  1110. fi
  1111. if test -f 'gnuplot/header.mac' -a "${1}" != "-c" ; then 
  1112.   echo shar: Will not clobber existing file \"'gnuplot/header.mac'\"
  1113. else
  1114.   echo shar: Extracting \"'gnuplot/header.mac'\" \(918 characters\)
  1115.   sed "s/^X//" >'gnuplot/header.mac' <<'END_OF_FILE'
  1116. Xif1
  1117. XLARGE    equ 1            ; define your memory model here
  1118. X
  1119. Xifdef    SMALL
  1120. X    ; default, so do nothing
  1121. X    else
  1122. X
  1123. Xifdef    MEDIUM
  1124. X    LARGE_CODE equ 1
  1125. X    else
  1126. X
  1127. Xifdef    COMPACT
  1128. X    LARGE_DATA equ 1
  1129. X    else
  1130. X
  1131. Xifdef    LARGE
  1132. X    LARGE_DATA equ 1
  1133. X    LARGE_CODE equ 1
  1134. X
  1135. Xelse
  1136. X    %out No memory model defined--assuming SMALL
  1137. X
  1138. Xendif    ; LARGE
  1139. Xendif    ; COMPACT
  1140. Xendif    ; MEDIUM
  1141. Xendif    ; SMALL
  1142. X
  1143. X
  1144. Xbeginproc macro procname
  1145. X
  1146. Xifdef    LARGE_CODE
  1147. X    procname proc far
  1148. Xelse
  1149. X    procname proc near
  1150. Xendif    ; LARGE_CODE
  1151. X
  1152. X    endm    ; beginproc
  1153. X
  1154. X
  1155. Xendif    ; if1
  1156. X
  1157. X
  1158. X_TEXT    SEGMENT    BYTE PUBLIC 'CODE'
  1159. X_TEXT    ENDS
  1160. X_DATA    SEGMENT WORD PUBLIC 'DATA'
  1161. X_DATA    ENDS
  1162. XCONST    SEGMENT WORD PUBLIC 'CONST'
  1163. XCONST    ENDS
  1164. X_BSS    SEGMENT WORD PUBLIC 'BSS'
  1165. X_BSS    ENDS
  1166. X
  1167. XDGROUP    GROUP    CONST, _BSS, _DATA
  1168. X    assume cs:_text, ds:dgroup, ss:dgroup, es:dgroup
  1169. X
  1170. X; define X as the offset of first argument on stack frame
  1171. X
  1172. Xifdef LARGE_CODE
  1173. X    X    equ 6            ; return offset and segment + old BP
  1174. Xelse
  1175. X    X    equ 4            ; return offset + old BP
  1176. Xendif    ; LARGE_CODE
  1177. END_OF_FILE
  1178.   if test 918 -ne `wc -c <'gnuplot/header.mac'`; then
  1179.     echo shar: \"'gnuplot/header.mac'\" unpacked with wrong size!
  1180.   fi
  1181.   # end of 'gnuplot/header.mac'
  1182. fi
  1183. if test -f 'gnuplot/readline.c' -a "${1}" != "-c" ; then 
  1184.   echo shar: Will not clobber existing file \"'gnuplot/readline.c'\"
  1185. else
  1186.   echo shar: Extracting \"'gnuplot/readline.c'\" \(22204 characters\)
  1187.   sed "s/^X//" >'gnuplot/readline.c' <<'END_OF_FILE'
  1188. X#ifndef lint
  1189. Xstatic char *RCSid = "$Id: readline.c%v 3.50.1.9 1993/08/05 05:38:59 woo Exp $";
  1190. X#endif
  1191. X
  1192. X
  1193. X/* GNUPLOT - readline.c */
  1194. X/*
  1195. X * Copyright (C) 1986 - 1993   Thomas Williams, Colin Kelley
  1196. X *
  1197. X * Permission to use, copy, and distribute this software and its
  1198. X * documentation for any purpose with or without fee is hereby granted, 
  1199. X * provided that the above copyright notice appear in all copies and 
  1200. X * that both that copyright notice and this permission notice appear 
  1201. X * in supporting documentation.
  1202. X *
  1203. X * Permission to modify the software is granted, but not the right to
  1204. X * distribute the modified code.  Modifications are to be distributed 
  1205. X * as patches to released version.
  1206. X *  
  1207. X * This software is provided "as is" without express or implied warranty.
  1208. X * 
  1209. X *
  1210. X * AUTHORS
  1211. X *
  1212. X *   Original Software:
  1213. X *     Tom Tkacik
  1214. X *
  1215. X *   Msdos port and some enhancements:
  1216. X *     Gershon Elber and many others.
  1217. X * 
  1218. X * There is a mailing list for gnuplot users. Note, however, that the
  1219. X * newsgroup 
  1220. X *    comp.graphics.gnuplot 
  1221. X * is identical to the mailing list (they
  1222. X * both carry the same set of messages). We prefer that you read the
  1223. X * messages through that newsgroup, to subscribing to the mailing list.
  1224. X * (If you can read that newsgroup, and are already on the mailing list,
  1225. X * please send a message info-gnuplot-request@dartmouth.edu, asking to be
  1226. X * removed from the mailing list.)
  1227. X *
  1228. X * The address for mailing to list members is
  1229. X *       info-gnuplot@dartmouth.edu
  1230. X * and for mailing administrative requests is 
  1231. X *       info-gnuplot-request@dartmouth.edu
  1232. X * The mailing list for bug reports is 
  1233. X *       bug-gnuplot@dartmouth.edu
  1234. X * The list of those interested in beta-test versions is
  1235. X *       info-gnuplot-beta@dartmouth.edu
  1236. X */
  1237. X
  1238. X#ifdef READLINE
  1239. X#ifdef ATARI
  1240. X#include "plot.h"
  1241. X#endif
  1242. X#ifdef _WINDOWS
  1243. X#define _Windows
  1244. X#endif
  1245. X
  1246. X/* a small portable version of GNU's readline */
  1247. X/* this is not the BASH or GNU EMACS version of READLINE due to Copyleft 
  1248. X    restrictions */
  1249. X/* do not need any terminal capabilities except backspace, */
  1250. X/* and space overwrites a character */
  1251. X
  1252. X/* NANO-EMACS line editing facility */
  1253. X/* printable characters print as themselves (insert not overwrite) */
  1254. X/* ^A moves to the beginning of the line */
  1255. X/* ^B moves back a single character */
  1256. X/* ^E moves to the end of the line */
  1257. X/* ^F moves forward a single character */
  1258. X/* ^K kills from current position to the end of line */
  1259. X/* ^P moves back through history */
  1260. X/* ^N moves forward through history */
  1261. X/* ^H and DEL delete the previous character */
  1262. X/* ^D deletes the current character, or EOF if line is empty */
  1263. X/* ^L/^R redraw line in case it gets trashed */
  1264. X/* ^U kills the entire line */
  1265. X/* ^W kills last word */
  1266. X/* LF and CR return the entire line regardless of the cursor postition */
  1267. X/* EOF with an empty line returns (char *)NULL */
  1268. X
  1269. X/* all other characters are ignored */
  1270. X
  1271. X#include <stdio.h>
  1272. X#include <ctype.h>
  1273. X#include <signal.h>
  1274. X
  1275. X#if !defined(MSDOS) && !defined(ATARI) && !defined(_Windows) && !defined(DOS386)
  1276. X
  1277. X/*
  1278. X * Set up structures using the proper include file
  1279. X */
  1280. X#if defined(_IBMR2) || defined(alliant)
  1281. X#define SGTTY
  1282. X#endif
  1283. X
  1284. X/*  submitted by Francois.Dagorn@cicb.fr */
  1285. X#ifdef SGTTY
  1286. X#include <sgtty.h>
  1287. Xstatic struct sgttyb orig_termio, rl_termio;
  1288. X/* define terminal control characters */
  1289. Xstatic struct tchars s_tchars;
  1290. X#define VERASE    0
  1291. X#define VEOF      1
  1292. X#define VKILL     2
  1293. X#ifdef TIOCGLTC         /* available only with the 'new' line discipline */
  1294. Xstatic struct ltchars s_ltchars;
  1295. X#define VWERASE   3
  1296. X#define VREPRINT  4
  1297. X#define VSUSP     5
  1298. X#endif /* TIOCGLTC */
  1299. X#define NCCS      6
  1300. X
  1301. X#else /* SGTTY */
  1302. X
  1303. X/* SIGTSTP defines job control */
  1304. X/* if there is job control then we need termios.h instead of termio.h */
  1305. X/* (Are there any systems with job control that use termio.h?  I hope not.) */
  1306. X#ifdef SIGTSTP
  1307. X#define TERMIOS
  1308. X#include <termios.h>
  1309. X/* Added by Robert Eckardt, RobertE@beta.TP2.Ruhr-Uni-Bochum.de */
  1310. X#ifdef ISC22
  1311. X#ifndef ONOCR            /* taken from sys/termio.h */
  1312. X#define ONOCR 0000020    /* true at least for ISC 2.2 */
  1313. X#endif 
  1314. X#ifndef IUCLC
  1315. X#define IUCLC 0001000
  1316. X#endif
  1317. X#endif /* ISC22 */
  1318. X
  1319. Xstatic struct termios orig_termio, rl_termio;
  1320. X#else
  1321. X#include <termio.h>
  1322. Xstatic struct termio orig_termio, rl_termio;
  1323. X/* termio defines NCC instead of NCCS */
  1324. X#define NCCS    NCC
  1325. X#endif /* SIGTSTP */
  1326. X#endif /* SGTTY */
  1327. X
  1328. X/* ULTRIX defines VRPRNT instead of VREPRINT */
  1329. X#ifdef VRPRNT
  1330. X#define VREPRINT VRPRNT
  1331. X#endif
  1332. X
  1333. X/* define characters to use with our input character handler */
  1334. Xstatic char term_chars[NCCS];
  1335. X
  1336. Xstatic int term_set = 0;    /* =1 if rl_termio set */
  1337. X
  1338. X#define special_getc() ansi_getc()
  1339. Xstatic char ansi_getc();
  1340. X
  1341. X#else /* !MSDOS && !ATARI && !_Windows */
  1342. X
  1343. X#ifdef _Windows
  1344. X#include <windows.h>
  1345. X#include "win/wtext.h"
  1346. X#include "win/wgnuplib.h"
  1347. Xextern TW textwin;
  1348. X#define TEXTUSER 0xf1
  1349. X#define TEXTGNUPLOT 0xf0
  1350. X#define special_getc() msdos_getch()
  1351. Xstatic char msdos_getch();
  1352. X#endif
  1353. X
  1354. X#if defined(MSDOS) || defined(DOS386)
  1355. X/* MSDOS specific stuff */
  1356. X#ifdef DJGPP
  1357. X#include <pc.h>
  1358. X#endif
  1359. X#ifdef __EMX__
  1360. X#include <conio.h>
  1361. X#endif
  1362. X#define special_getc() msdos_getch()
  1363. Xstatic char msdos_getch();
  1364. X#endif /* MSDOS */
  1365. X
  1366. X#ifdef ATARI
  1367. X#include <stdlib.h>
  1368. X#ifdef __PUREC__
  1369. X#include <tos.h>
  1370. X#else
  1371. X#include <osbind.h>
  1372. X#endif
  1373. X#define special_getc() tos_getch()
  1374. Xstatic char tos_getch();
  1375. X#endif
  1376. X
  1377. X#endif /* !MSDOS && !ATARI && !_Windows */
  1378. X
  1379. X#if !defined(ATARI)
  1380. X/* is it <string.h> or <strings.h>?   just declare what we need */
  1381. Xextern int      strlen();
  1382. Xextern char *strcpy();
  1383. X#endif
  1384. Xextern char *alloc();    /* we'll use the safe malloc from misc.c */
  1385. X
  1386. X#define MAXBUF    1024
  1387. X#define BACKSPACE 0x08    /* ^H */
  1388. X#define SPACE    ' '
  1389. X
  1390. Xstruct hist {
  1391. X    char *line;
  1392. X    struct hist *prev;
  1393. X    struct hist *next;
  1394. X};
  1395. X
  1396. Xstatic struct hist *history = NULL;  /* no history yet */
  1397. Xstatic struct hist *cur_entry = NULL;
  1398. X
  1399. Xstatic char cur_line[MAXBUF];  /* current contents of the line */
  1400. Xstatic int cur_pos = 0;    /* current position of the cursor */
  1401. Xstatic int max_pos = 0;    /* maximum character position */
  1402. X
  1403. X
  1404. Xvoid add_history();
  1405. Xstatic void fix_line();
  1406. Xstatic void redraw_line();
  1407. Xstatic void clear_line();
  1408. Xstatic void clear_eoline();
  1409. Xstatic void copy_line();
  1410. Xstatic void set_termio();
  1411. Xstatic void reset_termio();
  1412. X
  1413. X/* user_putc and user_puts should be used in the place of
  1414. X * fputc(ch,stderr) and fputs(str,stderr) for all output
  1415. X * of user typed characters.  This allows MS-Windows to 
  1416. X * display user input in a different color. */
  1417. Xint
  1418. Xuser_putc(ch)
  1419. Xint ch;
  1420. X{
  1421. X    int rv;
  1422. X#ifdef _Windows
  1423. X    TextAttr(&textwin,TEXTUSER);
  1424. X#endif
  1425. X    rv = fputc(ch, stderr);
  1426. X#ifdef _Windows
  1427. X    TextAttr(&textwin,TEXTGNUPLOT);
  1428. X#endif
  1429. X    return rv;
  1430. X}
  1431. X
  1432. Xint
  1433. Xuser_puts(str)
  1434. Xchar *str;
  1435. X{
  1436. X    int rv;
  1437. X#ifdef _Windows
  1438. X    TextAttr(&textwin,TEXTUSER);
  1439. X#endif
  1440. X    rv = fputs(str, stderr);
  1441. X#ifdef _Windows
  1442. X    TextAttr(&textwin,TEXTGNUPLOT);
  1443. X#endif
  1444. X    return rv;
  1445. X}
  1446. X
  1447. X/* This function provides a centralized non-destructive backspace capability */
  1448. X/* M. Castro */
  1449. X
  1450. Xbackspace()
  1451. X{
  1452. X    user_putc(BACKSPACE);
  1453. X}
  1454. X    
  1455. Xchar *
  1456. Xreadline(prompt)
  1457. Xchar *prompt;
  1458. X{
  1459. X
  1460. X    unsigned char cur_char;
  1461. X    char *new_line;
  1462. X    /* unsigned char *new_line; */
  1463. X
  1464. X    /* set the termio so we can do our own input processing */
  1465. X    set_termio();
  1466. X
  1467. X    /* print the prompt */
  1468. X    fputs(prompt, stderr);
  1469. X    cur_line[0] = '\0';
  1470. X    cur_pos = 0;
  1471. X    max_pos = 0;
  1472. X    cur_entry = NULL;
  1473. X
  1474. X    /* get characters */
  1475. X    for(;;) {
  1476. X        cur_char = special_getc();
  1477. X#ifdef OS2
  1478. X /* for emx: remap scan codes for cursor keys */
  1479. X                if( cur_char == 0 ) {
  1480. X                    cur_char = getc(stdin);
  1481. X                    switch( cur_char){
  1482. X                        case 75:  /* left, map to ^B */
  1483. X                            cur_char=2;
  1484. X                            break ;
  1485. X                        case 77:  /* right, map to ^F */
  1486. X                            cur_char=6;
  1487. X                            break ;
  1488. X                        case 115: /* ctrl left */
  1489. X                        case 71:  /* home, map to ^A */
  1490. X                            cur_char=1;
  1491. X                            break ;
  1492. X                        case 116: /* ctrl right */
  1493. X                        case 79:  /* end, map to ^E */
  1494. X                            cur_char=5;
  1495. X                            break ;
  1496. X                        case 72:  /* up, map to ^P */
  1497. X                            cur_char=16;
  1498. X                            break ;
  1499. X                        case 80:  /* down, map to ^N */
  1500. X                            cur_char=14;
  1501. X                            break ;
  1502. X                        case 83:  /* delete, map to ^D */
  1503. X                            cur_char=4;
  1504. X                            break ;
  1505. X                        default:  /* ignore */
  1506. X                            cur_char=0;
  1507. X                            continue ;
  1508. X                            }
  1509. X                        }
  1510. X#endif  /*OS2*/
  1511. X        if((isprint(cur_char) 
  1512. X#if defined(ATARI) || defined(_Windows) || defined(MSDOS) || defined(DOS386)
  1513. X   /* this should be used for all 8bit ASCII machines, I guess */
  1514. X                    || ((unsigned char)cur_char > 0x7f)
  1515. X#endif
  1516. X                               )&& max_pos<MAXBUF-1) {
  1517. X            int i;
  1518. X            for(i=max_pos; i>cur_pos; i--) {
  1519. X                cur_line[i] = cur_line[i-1];
  1520. X            }
  1521. X            user_putc(cur_char);
  1522. X            cur_line[cur_pos] = cur_char;
  1523. X            cur_pos += 1;
  1524. X            max_pos += 1;
  1525. X            if (cur_pos < max_pos)
  1526. X                fix_line();
  1527. X            cur_line[max_pos] = '\0';
  1528. X
  1529. X        /* else interpret unix terminal driver characters */
  1530. X#ifdef VERASE
  1531. X        } else if(cur_char == term_chars[VERASE] ){  /* DEL? */
  1532. X            if(cur_pos > 0) {
  1533. X                int i;
  1534. X                cur_pos -= 1;
  1535. X                backspace();
  1536. X                for(i=cur_pos; i<max_pos; i++)
  1537. X                    cur_line[i] = cur_line[i+1];
  1538. X                max_pos -= 1;
  1539. X                fix_line();
  1540. X            }
  1541. X#endif /* VERASE */
  1542. X#ifdef VEOF
  1543. X        } else if(cur_char == term_chars[VEOF] ){   /* ^D? */
  1544. X            if(max_pos == 0) {
  1545. X                reset_termio();
  1546. X                return((char *)NULL);
  1547. X            }
  1548. X            if((cur_pos < max_pos)&&(cur_char == 004)) { /* ^D */
  1549. X                int i;
  1550. X                for(i=cur_pos; i<max_pos; i++)
  1551. X                    cur_line[i] = cur_line[i+1];
  1552. X                max_pos -= 1;
  1553. X                fix_line();
  1554. X            }
  1555. X#endif /* VEOF */
  1556. X#ifdef VKILL
  1557. X        } else if(cur_char == term_chars[VKILL] ){  /* ^U? */
  1558. X            clear_line(prompt);
  1559. X#endif /* VKILL */
  1560. X#ifdef VWERASE
  1561. X        } else if(cur_char == term_chars[VWERASE] ){  /* ^W? */
  1562. X            while((cur_pos > 0) &&
  1563. X                  (cur_line[cur_pos-1] == SPACE)) {
  1564. X                cur_pos -= 1;
  1565. X                backspace();
  1566. X            }
  1567. X            while((cur_pos > 0) &&
  1568. X                  (cur_line[cur_pos-1] != SPACE)) {
  1569. X                cur_pos -= 1;
  1570. X                backspace();
  1571. X            }
  1572. X            clear_eoline();
  1573. X            max_pos = cur_pos;
  1574. X#endif /* VWERASE */
  1575. X#ifdef VREPRINT
  1576. X        } else if(cur_char == term_chars[VREPRINT] ){  /* ^R? */
  1577. X            putc('\n',stderr); /* go to a fresh line */
  1578. X            redraw_line(prompt);
  1579. X#endif /* VREPRINT */
  1580. X#ifdef VSUSP
  1581. X        } else if(cur_char == term_chars[VSUSP]) {
  1582. X            reset_termio();
  1583. X            kill(0, SIGTSTP);
  1584. X
  1585. X            /* process stops here */
  1586. X
  1587. X            set_termio();
  1588. X            /* print the prompt */
  1589. X            redraw_line(prompt);
  1590. X#endif /* VSUSP */
  1591. X        } else {
  1592. X            /* do normal editing commands */
  1593. X            /* some of these are also done above */
  1594. X            int i;
  1595. X            switch(cur_char) {
  1596. X                case EOF:
  1597. X                reset_termio();
  1598. X                return((char *)NULL);
  1599. X                case 001: /* ^A */
  1600. X                while(cur_pos > 0) {
  1601. X                    cur_pos -= 1;
  1602. X                    backspace();
  1603. X                }
  1604. X                break;
  1605. X                case 002: /* ^B */
  1606. X                if(cur_pos > 0) {
  1607. X                    cur_pos -= 1;
  1608. X                    backspace();
  1609. X                }
  1610. X                break;
  1611. X                case 005: /* ^E */
  1612. X                while(cur_pos < max_pos) {
  1613. X                    user_putc(cur_line[cur_pos]);
  1614. X                    cur_pos += 1;
  1615. X                }
  1616. X                break;
  1617. X                case 006: /* ^F */
  1618. X                if(cur_pos < max_pos) {
  1619. X                    user_putc(cur_line[cur_pos]);
  1620. X                    cur_pos += 1;
  1621. X                }
  1622. X                break;
  1623. X                case 013: /* ^K */
  1624. X                clear_eoline();
  1625. X                max_pos = cur_pos;
  1626. X                break;
  1627. X                case 020: /* ^P */
  1628. X                if(history != NULL) {
  1629. X                    if(cur_entry == NULL) {
  1630. X                        cur_entry = history;
  1631. X                        clear_line(prompt);
  1632. X                        copy_line(cur_entry->line);
  1633. X                    } else if(cur_entry->prev != NULL) {
  1634. X                        cur_entry = cur_entry->prev;
  1635. X                        clear_line(prompt);
  1636. X                        copy_line(cur_entry->line);
  1637. X                    }
  1638. X                }
  1639. X                break;
  1640. X                case 016: /* ^N */
  1641. X                if(cur_entry != NULL) {
  1642. X                    cur_entry = cur_entry->next;
  1643. X                    clear_line(prompt);
  1644. X                    if(cur_entry != NULL) 
  1645. X                        copy_line(cur_entry->line);
  1646. X                    else
  1647. X                        cur_pos = max_pos = 0;
  1648. X                }
  1649. X                break;
  1650. X                case 014: /* ^L */
  1651. X                case 022: /* ^R */
  1652. X                putc('\n',stderr); /* go to a fresh line */
  1653. X                redraw_line(prompt);
  1654. X                break;
  1655. X                case 0177: /* DEL */
  1656. X                case 010: /* ^H */
  1657. X                if(cur_pos > 0) {
  1658. X                    cur_pos -= 1;
  1659. X                    backspace();
  1660. X                    for(i=cur_pos; i<max_pos; i++)
  1661. X                        cur_line[i] = cur_line[i+1];
  1662. X                    max_pos -= 1;
  1663. X                    fix_line();
  1664. X                }
  1665. X                break;
  1666. X                case 004: /* ^D */
  1667. X                if(max_pos == 0) {
  1668. X                    reset_termio();
  1669. X                    return((char *)NULL);
  1670. X                }
  1671. X                if(cur_pos < max_pos) {
  1672. X                    for(i=cur_pos; i<max_pos; i++)
  1673. X                        cur_line[i] = cur_line[i+1];
  1674. X                    max_pos -= 1;
  1675. X                    fix_line();
  1676. X                }
  1677. X                break;
  1678. X                case 025:  /* ^U */
  1679. X                clear_line(prompt);
  1680. X                break;
  1681. X                case 027:  /* ^W */
  1682. X                while((cur_pos > 0) &&
  1683. X                      (cur_line[cur_pos-1] == SPACE)) {
  1684. X                    cur_pos -= 1;
  1685. X                    backspace();
  1686. X                }
  1687. X                while((cur_pos > 0) &&
  1688. X                      (cur_line[cur_pos-1] != SPACE)) {
  1689. X                    cur_pos -= 1;
  1690. X                    backspace();
  1691. X                }
  1692. X                clear_eoline();
  1693. X                max_pos = cur_pos;
  1694. X                break;
  1695. X                case '\n': /* ^J */
  1696. X                case '\r': /* ^M */
  1697. X                cur_line[max_pos+1] = '\0';
  1698. X                putc('\n', stderr);
  1699. X                new_line = (char *)alloc((unsigned long) (strlen(cur_line)+1), "history");
  1700. X                strcpy(new_line,cur_line);
  1701. X                reset_termio();
  1702. X                return(new_line);
  1703. X                default:
  1704. X                break;
  1705. X            }
  1706. X        }
  1707. X    }
  1708. X}
  1709. X
  1710. X/* fix up the line from cur_pos to max_pos */
  1711. X/* do not need any terminal capabilities except backspace, */
  1712. X/* and space overwrites a character */
  1713. Xstatic void
  1714. Xfix_line()
  1715. X{
  1716. X    int i;
  1717. X
  1718. X    /* write tail of string */
  1719. X    for(i=cur_pos; i<max_pos; i++)
  1720. X        user_putc(cur_line[i]);
  1721. X
  1722. X    /* write a space at the end of the line in case we deleted one */
  1723. X    user_putc(SPACE);
  1724. X
  1725. X    /* backup to original position */
  1726. X    for(i=max_pos+1; i>cur_pos; i--)
  1727. X        backspace();
  1728. X
  1729. X}
  1730. X
  1731. X/* redraw the entire line, putting the cursor where it belongs */
  1732. Xstatic void
  1733. Xredraw_line(prompt)
  1734. Xchar *prompt;
  1735. X{
  1736. X    int i;
  1737. X
  1738. X    fputs(prompt, stderr);
  1739. X    user_puts(cur_line);
  1740. X
  1741. X    /* put the cursor where it belongs */
  1742. X    for(i=max_pos; i>cur_pos; i--)
  1743. X        backspace();
  1744. X}
  1745. X
  1746. X/* clear cur_line and the screen line */
  1747. Xstatic void
  1748. Xclear_line(prompt)
  1749. Xchar *prompt;
  1750. X{
  1751. X    int i;
  1752. X    for(i=0; i<max_pos; i++)
  1753. X        cur_line[i] = '\0';
  1754. X
  1755. X    for(i=cur_pos; i>0; i--)
  1756. X        backspace();
  1757. X
  1758. X    for(i=0; i<max_pos; i++)
  1759. X        putc(SPACE, stderr);
  1760. X
  1761. X    putc('\r', stderr);
  1762. X    fputs(prompt, stderr);
  1763. X
  1764. X    cur_pos = 0;
  1765. X    max_pos = 0;
  1766. X}
  1767. X
  1768. X/* clear to end of line and the screen end of line */
  1769. Xstatic void
  1770. Xclear_eoline(prompt)
  1771. Xchar *prompt;
  1772. X{
  1773. X    int i;
  1774. X    for(i=cur_pos; i<max_pos; i++)
  1775. X        cur_line[i] = '\0';
  1776. X
  1777. X    for(i=cur_pos; i<max_pos; i++)
  1778. X        putc(SPACE, stderr);
  1779. X    for(i=cur_pos; i<max_pos; i++)
  1780. X        backspace();
  1781. X}
  1782. X
  1783. X/* copy line to cur_line, draw it and set cur_pos and max_pos */
  1784. Xstatic void
  1785. Xcopy_line(line)
  1786. Xchar *line;
  1787. X{
  1788. X    strcpy(cur_line, line);
  1789. X    user_puts(cur_line);
  1790. X    cur_pos = max_pos = strlen(cur_line);
  1791. X}
  1792. X
  1793. X/* add line to the history */
  1794. Xvoid
  1795. Xadd_history(line)
  1796. Xchar *line;
  1797. X{
  1798. X    struct hist *entry;
  1799. X    entry = (struct hist *)alloc((unsigned long)sizeof(struct hist),"history");
  1800. X    entry->line = alloc((unsigned long)(strlen(line)+1),"history");
  1801. X    strcpy(entry->line, line);
  1802. X
  1803. X    entry->prev = history;
  1804. X    entry->next = NULL;
  1805. X    if(history != NULL) {
  1806. X        history->next = entry;
  1807. X    }
  1808. X    history = entry;
  1809. X}
  1810. X
  1811. X
  1812. X/* Convert ANSI arrow keys to control characters */
  1813. Xstatic char
  1814. Xansi_getc()
  1815. X{
  1816. X  char c = getc(stdin);
  1817. X  if (c == 033) {
  1818. X    c = getc(stdin); /* check for CSI */
  1819. X    if (c == '[') {
  1820. X      c = getc(stdin); /* get command character */
  1821. X      switch (c) {
  1822. X      case 'D': /* left arrow key */
  1823. X    c = 002;
  1824. X    break;
  1825. X      case 'C': /* right arrow key */
  1826. X    c = 006;
  1827. X    break;
  1828. X      case 'A': /* up arrow key */
  1829. X    c = 020;
  1830. X    break;
  1831. X      case 'B': /* down arrow key */
  1832. X    c = 016;
  1833. X    break;
  1834. X      }
  1835. X    }
  1836. X  }
  1837. X  return c;
  1838. X}
  1839. X
  1840. X#if defined(MSDOS) || defined(_Windows) || defined(DOS386)
  1841. X
  1842. X/* Convert Arrow keystrokes to Control characters: */
  1843. Xstatic  char
  1844. Xmsdos_getch()
  1845. X{
  1846. X#ifdef DJGPP
  1847. X    char c;
  1848. X    int ch = getkey();
  1849. X    c = (ch & 0xff00) ? 0 : ch & 0xff;
  1850. X#else
  1851. X    char c = getch();
  1852. X#endif
  1853. X
  1854. X    if (c == 0) {
  1855. X#ifdef DJGPP
  1856. X    c = ch & 0xff;
  1857. X#else
  1858. X    c = getch(); /* Get the extended code. */
  1859. X#endif
  1860. X    switch (c) {
  1861. X        case 75: /* Left Arrow. */
  1862. X        c = 002;
  1863. X        break;
  1864. X        case 77: /* Right Arrow. */
  1865. X        c = 006;
  1866. X        break;
  1867. X        case 72: /* Up Arrow. */
  1868. X        c = 020;
  1869. X        break;
  1870. X        case 80: /* Down Arrow. */
  1871. X        c = 016;
  1872. X        break;
  1873. X        case 115: /* Ctl Left Arrow. */
  1874. X        case 71: /* Home */
  1875. X        c = 001;
  1876. X        break;
  1877. X        case 116: /* Ctl Right Arrow. */
  1878. X        case 79: /* End */
  1879. X        c = 005;
  1880. X        break;
  1881. X        case 83: /* Delete */
  1882. X        c = 004;
  1883. X        break;
  1884. X        default:
  1885. X        c = 0;
  1886. X        break;
  1887. X    }
  1888. X    }
  1889. X    else if (c == 033) { /* ESC */
  1890. X    c = 025;
  1891. X    }
  1892. X
  1893. X
  1894. X    return c;
  1895. X}
  1896. X
  1897. X#endif /* MSDOS */
  1898. X
  1899. X#ifdef ATARI
  1900. X
  1901. X/* Convert Arrow keystrokes to Control characters: TOS version */
  1902. X
  1903. X/* the volatile could be necessary to keep gcc from reordering 
  1904. X   the two Super calls
  1905. X*/
  1906. X#define CONTERM ((/*volatile*/ char *)0x484L)
  1907. X
  1908. Xstatic void 
  1909. Xremove_conterm()
  1910. X{
  1911. X  void *ssp=(void*)Super(0L);
  1912. X  *CONTERM &= ~0x8;
  1913. X  Super(ssp);
  1914. X}
  1915. X
  1916. Xstatic    char
  1917. Xtos_getch()
  1918. X{
  1919. X    long rawkey;
  1920. X    char c;
  1921. X    int scan_code;
  1922. X    void *ssp;
  1923. X    static  int init = 1;
  1924. X    static  int in_help = 0;
  1925. X
  1926. X    if (in_help) {
  1927. X    switch(in_help) {
  1928. X        case 1:
  1929. X        case 5: in_help++; return 'e';
  1930. X        case 2:
  1931. X        case 6: in_help++; return 'l';
  1932. X        case 3:
  1933. X        case 7: in_help++; return 'p';
  1934. X        case 4: in_help = 0; return 0x0d;
  1935. X        case 8: in_help = 0; return ' ';
  1936. X    }
  1937. X    }
  1938. X
  1939. X    if (init) {
  1940. X    ssp = (void*)Super(0L);
  1941. X    if( !(*CONTERM & 0x8) ) {
  1942. X        *CONTERM |= 0x8;
  1943. X    } else {
  1944. X        init=0;
  1945. X    }
  1946. X    (void)Super(ssp);
  1947. X    if( init ) {
  1948. X        atexit(remove_conterm);
  1949. X        init = 0;
  1950. X    }
  1951. X    }
  1952. X
  1953. X   (void)Cursconf(1, 0); /* cursor on */
  1954. X    rawkey = Cnecin();
  1955. X    c = (char)rawkey;
  1956. X    scan_code= ((int)(rawkey>>16)) & 0xff;    /* get the scancode */
  1957. X    if( rawkey&0x07000000 ) scan_code |= 0x80;     /* shift or control */
  1958. X
  1959. X    switch (scan_code) {
  1960. X    case 0x62:                /* HELP        */
  1961. X        if (max_pos==0) {
  1962. X        in_help = 1;
  1963. X        return 'h';
  1964. X        } else {
  1965. X        return 0;
  1966. X        }
  1967. X    case 0xe2:                /* shift HELP    */
  1968. X        if (max_pos==0) {
  1969. X        in_help = 5;
  1970. X        return 'h';
  1971. X        } else {
  1972. X        return 0;
  1973. X        }
  1974. X    case 0x48: /* Up Arrow */
  1975. X        return 0x10; /* ^P */
  1976. X    case 0x50: /* Down Arrow */
  1977. X        return 0x0e; /* ^N */
  1978. X    case 0x4b: /* Left Arrow */
  1979. X        return 0x02; /* ^B */
  1980. X    case 0x4d: /* Right Arrow */
  1981. X        return 0x06; /* ^F */
  1982. X    case 0xcb: /* Shift Left Arrow */
  1983. X    case 0xf3: /* Ctrl Left Arrow (TOS-bug ?) */
  1984. X    case 0x47: /* Home */
  1985. X        return 0x01; /* ^A */
  1986. X    case 0xcd: /* Shift Right Arrow */
  1987. X    case 0xf4: /* Ctrl Right Arrow (TOS-bug ?) */
  1988. X    case 0xc7: /* Shift Home */
  1989. X    case 0xf7: /* Crtl Home */
  1990. X        return 0x05; /* ^E */
  1991. X    case 0x61: /* Undo - redraw line */
  1992. X        return 0x0c; /* ^L */
  1993. X    default:
  1994. X        if (c == 0x1b) return 0x15; /* ESC becomes ^U */
  1995. X        if (c == 0x7f) return 0x04; /* Del becomes ^D */
  1996. X        break;
  1997. X    }
  1998. X
  1999. X    return c;
  2000. X}
  2001. X
  2002. X#endif /* ATARI */
  2003. X
  2004. X  /* set termio so we can do our own input processing */
  2005. Xstatic void
  2006. Xset_termio()
  2007. X{
  2008. X#if !defined(MSDOS) && !defined(ATARI) && !defined(_Windows) && !defined(DOS386)
  2009. X/* set termio so we can do our own input processing */
  2010. X/* and save the old terminal modes so we can reset them later */
  2011. X    if(term_set == 0) {
  2012. X        /*
  2013. X         * Get terminal modes.
  2014. X         */
  2015. X#ifdef SGTTY
  2016. X        ioctl(0, TIOCGETP, &orig_termio);
  2017. X#else  /* SGTTY */
  2018. X#ifdef TERMIOS
  2019. X#ifdef TCGETS
  2020. X        ioctl(0, TCGETS, &orig_termio);
  2021. X#else
  2022. X        tcgetattr(0, &orig_termio);
  2023. X#endif /* TCGETS */
  2024. X#else
  2025. X        ioctl(0, TCGETA, &orig_termio);
  2026. X#endif /* TERMIOS */
  2027. X#endif /* SGTTY */
  2028. X
  2029. X        /*
  2030. X         * Save terminal modes
  2031. X         */
  2032. X        rl_termio = orig_termio;
  2033. X
  2034. X        /*
  2035. X         * Set the modes to the way we want them
  2036. X         *  and save our input special characters
  2037. X         */
  2038. X#ifdef SGTTY
  2039. X        rl_termio.sg_flags |= CBREAK;
  2040. X        rl_termio.sg_flags &= ~(ECHO|XTABS);
  2041. X        ioctl(0, TIOCSETN, &rl_termio);
  2042. X
  2043. X        ioctl(0, TIOCGETC, &s_tchars);
  2044. X        term_chars[VERASE]   = orig_termio.sg_erase;
  2045. X        term_chars[VEOF]     = s_tchars.t_eofc;
  2046. X        term_chars[VKILL]    = orig_termio.sg_kill;
  2047. X#ifdef TIOCGLTC
  2048. X        ioctl(0, TIOCGLTC, &s_ltchars);
  2049. X        term_chars[VWERASE]  = s_ltchars.t_werasc;
  2050. X        term_chars[VREPRINT] = s_ltchars.t_rprntc;
  2051. X        term_chars[VSUSP]    = s_ltchars.t_suspc;
  2052. X
  2053. X        /* disable suspending process on ^Z */
  2054. X        s_ltchars.t_suspc = 0;
  2055. X        ioctl(0, TIOCSLTC, &s_ltchars);
  2056. X#endif /* TIOCGLTC */
  2057. X#else  /* SGTTY */
  2058. X        rl_termio.c_iflag &= ~(BRKINT|PARMRK|INPCK|IUCLC|IXON|IXOFF);
  2059. X        rl_termio.c_iflag |=  (IGNBRK|IGNPAR);
  2060. X
  2061. X        /* rl_termio.c_oflag &= ~(ONOCR); Costas Sphocleous Irvine,CA */
  2062. X
  2063. X        rl_termio.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL|NOFLSH);
  2064. X#ifdef OS2
  2065. X /* for emx: remove default terminal processing */
  2066. X                rl_termio.c_lflag &= ~(IDEFAULT);
  2067. X#endif /* OS2 */
  2068. X        rl_termio.c_lflag |=  (ISIG);
  2069. X        rl_termio.c_cc[VMIN] = 1;
  2070. X        rl_termio.c_cc[VTIME] = 0;
  2071. X
  2072. X#ifndef VWERASE
  2073. X#define VWERASE 3
  2074. X#endif
  2075. X        term_chars[VERASE]   = orig_termio.c_cc[VERASE];
  2076. X        term_chars[VEOF]     = orig_termio.c_cc[VEOF];
  2077. X        term_chars[VKILL]    = orig_termio.c_cc[VKILL];
  2078. X#ifdef TERMIOS
  2079. X        term_chars[VWERASE]  = orig_termio.c_cc[VWERASE];
  2080. X#ifdef VREPRINT
  2081. X        term_chars[VREPRINT] = orig_termio.c_cc[VREPRINT];
  2082. X#else
  2083. X#ifdef VRPRNT
  2084. X        term_chars[VRPRNT] = orig_termio.c_cc[VRPRNT];
  2085. X#endif
  2086. X#endif
  2087. X        term_chars[VSUSP]    = orig_termio.c_cc[VSUSP];
  2088. X
  2089. X        /* disable suspending process on ^Z */
  2090. X        rl_termio.c_cc[VSUSP] = 0;
  2091. X#endif /* TERMIOS */
  2092. X#endif /* SGTTY */
  2093. X
  2094. X        /*
  2095. X         * Set the new terminal modes.
  2096. X         */
  2097. X#ifdef SGTTY
  2098. X        ioctl(0, TIOCSLTC, &s_ltchars);
  2099. X#else
  2100. X#ifdef TERMIOS
  2101. X#ifdef TCSETSW
  2102. X        ioctl(0, TCSETSW, &rl_termio);
  2103. X#else
  2104. X        tcsetattr(0, TCSADRAIN, &rl_termio);
  2105. X#endif /* TCSETSW */
  2106. X#else
  2107. X        ioctl(0, TCSETAW, &rl_termio);
  2108. X#endif /* TERMIOS */
  2109. X#endif /* SGTTY */
  2110. X        term_set = 1;
  2111. X    }
  2112. X#endif /* !MSDOS && !ATARI && !defined(_Windows) */
  2113. X}
  2114. X  
  2115. Xstatic void
  2116. Xreset_termio()
  2117. X{
  2118. X#if !defined(MSDOS) && !defined(ATARI) && !defined(_Windows) && !defined(DOS386)
  2119. X/* reset saved terminal modes */
  2120. X    if(term_set == 1) {
  2121. X#ifdef SGTTY
  2122. X        ioctl(0, TIOCSETN, &orig_termio);
  2123. X#ifdef TIOCGLTC
  2124. X        /* enable suspending process on ^Z */
  2125. X        s_ltchars.t_suspc = term_chars[VSUSP];
  2126. X        ioctl(0, TIOCSLTC, &s_ltchars);
  2127. X#endif /* TIOCGLTC */
  2128. X#else  /* SGTTY */
  2129. X#ifdef TERMIOS
  2130. X#ifdef TCSETSW
  2131. X        ioctl(0, TCSETSW, &orig_termio);
  2132. X#else
  2133. X        tcsetattr(0, TCSADRAIN, &orig_termio);
  2134. X#endif /* TCSETSW */
  2135. X#else
  2136. X        ioctl(0, TCSETAW, &orig_termio);
  2137. X#endif /* TERMIOS */
  2138. X#endif /* SGTTY */
  2139. X        term_set = 0;
  2140. X    }
  2141. X#endif /* !MSDOS && !ATARI && !_Windows */
  2142. X}
  2143. X#endif /* READLINE */
  2144. END_OF_FILE
  2145.   if test 22204 -ne `wc -c <'gnuplot/readline.c'`; then
  2146.     echo shar: \"'gnuplot/readline.c'\" unpacked with wrong size!
  2147.   fi
  2148.   # end of 'gnuplot/readline.c'
  2149. fi
  2150. echo shar: End of archive 8 \(of 33\).
  2151. cp /dev/null ark8isdone
  2152. MISSING=""
  2153. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ; do
  2154.     if test ! -f ark${I}isdone ; then
  2155.     MISSING="${MISSING} ${I}"
  2156.     fi
  2157. done
  2158. if test "${MISSING}" = "" ; then
  2159.     echo You have unpacked all 33 archives.
  2160.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2161. else
  2162.     echo You still must unpack the following archives:
  2163.     echo "        " ${MISSING}
  2164. fi
  2165. exit 0
  2166. exit 0 # Just in case...
  2167.