home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / GNU / GNUPLOTsrc.lha / term / unixplot.trm < prev    next >
Encoding:
Text File  |  1996-01-22  |  3.5 KB  |  164 lines

  1. /*
  2.  * $Id: unixplot.trm,v 1.6 1995/12/20 21:48:19 drd Exp $
  3.  *
  4.  */
  5.  
  6. /* GNUPLOT -- unixplot.trm */
  7. /*
  8.  * Copyright (C) 1990 - 1993   
  9.  *
  10.  * Permission to use, copy, and distribute this software and its
  11.  * documentation for any purpose with or without fee is hereby granted, 
  12.  * provided that the above copyright notice appear in all copies and 
  13.  * that both that copyright notice and this permission notice appear 
  14.  * in supporting documentation.
  15.  *
  16.  * Permission to modify the software is granted, but not the right to
  17.  * distribute the modified code.  Modifications are to be distributed 
  18.  * as patches to released version.
  19.  *  
  20.  * This software  is provided "as is" without express or implied warranty.
  21.  * 
  22.  * This file is included by ../term.c.
  23.  *
  24.  * This terminal driver supports:
  25.  *  Unix plot(5) graphics language
  26.  *
  27.  * AUTHORS
  28.  *  Colin Kelley, Thomas Williams, Russell Lang
  29.  * 
  30.  * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  31.  * 
  32.  */
  33.  
  34. /*
  35. Unixplot library writes to stdout.  A fix was put in place by
  36. ..!arizona!naucse!jdc to let set term and set output redirect
  37. stdout.  All other terminals write to outfile.
  38. */
  39.  
  40. /*
  41.  * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
  42.  */
  43.  
  44. #ifndef GOT_DRIVER_H
  45. #include "driver.h"
  46. #endif
  47.  
  48. #ifdef TERM_REGISTER
  49. register_term(unixplot)
  50. #endif
  51.  
  52. #ifdef TERM_PROTO
  53. TERM_PUBLIC void UP_init __P((void));
  54. TERM_PUBLIC void UP_graphics __P((void));
  55. TERM_PUBLIC void UP_text __P((void));
  56. TERM_PUBLIC void UP_linetype __P((int linetype));
  57. TERM_PUBLIC void UP_move __P((unsigned int x, unsigned int y));
  58. TERM_PUBLIC void UP_vector __P((unsigned int x, unsigned int y));
  59. TERM_PUBLIC void UP_put_text __P((unsigned int x, unsigned int y, char str[]));
  60. TERM_PUBLIC void UP_reset __P((void));
  61.  
  62. #define UP_XMAX 4096
  63. #define UP_YMAX 4096
  64.  
  65. #define UP_XLAST (UP_XMAX - 1)
  66. #define UP_YLAST (UP_YMAX - 1)
  67.  
  68. #define UP_VCHAR (UP_YMAX/30)    /* just a guess--no way to know this! */
  69. #define UP_HCHAR (UP_XMAX/60)    /* just a guess--no way to know this! */
  70. #define UP_VTIC (UP_YMAX/80)
  71. #define UP_HTIC (UP_XMAX/80)
  72. #endif /* TERM_PROTO */
  73.  
  74. #ifndef TERM_PROTO_ONLY
  75. #ifdef TERM_BODY
  76.  
  77. TERM_PUBLIC void UP_init()
  78. {
  79.     openpl();
  80.     space(0, 0, UP_XMAX, UP_YMAX);
  81. }
  82.  
  83.  
  84. TERM_PUBLIC void UP_graphics()
  85. {
  86.     erase();
  87. }
  88.  
  89.  
  90. TERM_PUBLIC void UP_text()
  91. {
  92. }
  93.  
  94.  
  95. TERM_PUBLIC void UP_linetype(linetype)
  96. int linetype;
  97. {
  98. static char *lt[2+5] = {"solid", "longdashed", "solid", "dotted","shortdashed",
  99.     "dotdashed", "longdashed"};
  100.  
  101.     if (linetype >= 5)
  102.         linetype %= 5;
  103.     linemod(lt[linetype+2]);
  104. }
  105.  
  106.  
  107. TERM_PUBLIC void UP_move(x,y)
  108. unsigned int x,y;
  109. {
  110.     move(x,y);
  111. }
  112.  
  113.  
  114. TERM_PUBLIC void UP_vector(x,y)
  115. unsigned int x,y;
  116. {
  117.     cont(x,y);
  118. }
  119.  
  120.  
  121. TERM_PUBLIC void UP_put_text(x,y,str)
  122. unsigned int x,y;
  123. char str[];
  124. {
  125.     UP_move(x+UP_HCHAR/2,y+UP_VCHAR/5);
  126.     label(str);
  127. }
  128.  
  129. TERM_PUBLIC void UP_reset()
  130. {
  131.     closepl();
  132. }
  133.  
  134. #endif /* TERM_BODY */
  135.  
  136. #ifdef TERM_TABLE
  137.  
  138. TERM_TABLE_START(unixplot_driver)
  139.     "unixplot", "Unix plotting standard (see plot(1))",
  140.        UP_XMAX, UP_YMAX, UP_VCHAR, UP_HCHAR, 
  141.        UP_VTIC, UP_HTIC, options_null, UP_init, UP_reset, 
  142.        UP_text, null_scale, UP_graphics, UP_move, UP_vector, 
  143.        UP_linetype, UP_put_text, null_text_angle, 
  144.        null_justify_text, line_and_point, do_arrow, set_font_null
  145. TERM_TABLE_END(unixplot_driver)
  146.  
  147. #undef LAST_TERM
  148. #define LAST_TERM unixplot_driver
  149.  
  150. #endif /* TERM_TABLE */
  151. #endif /* TERM_PROTO_ONLY */
  152.  
  153. /*
  154.  * NAME: unixplot
  155.  *
  156.  * OPTIONS: none
  157.  *
  158.  * SUPPORTS: Unix plot graphics language
  159.  *
  160.  * Further Info: There is a terminal (gnugraph) for the GNU version of
  161.  *         plot, but that can only be compiled if this one is
  162.  *         left out.
  163.  *
  164.  */