home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 500-599 / ff552.lzh / GNUPlot / gnuplot3.lzh / gnuplot / term / hpgl.trm < prev    next >
Text File  |  1991-08-25  |  3KB  |  156 lines

  1. /* GNUPLOT - hpgl.trm */
  2. /*
  3.  * Copyright (C) 1990   
  4.  *
  5.  * Permission to use, copy, and distribute this software and its
  6.  * documentation for any purpose with or without fee is hereby granted, 
  7.  * provided that the above copyright notice appear in all copies and 
  8.  * that both that copyright notice and this permission notice appear 
  9.  * in supporting documentation.
  10.  *
  11.  * Permission to modify the software is granted, but not the right to
  12.  * distribute the modified code.  Modifications are to be distributed 
  13.  * as patches to released version.
  14.  *  
  15.  * This software  is provided "as is" without express or implied warranty.
  16.  * 
  17.  * This file is included by ../term.c.
  18.  *
  19.  * This terminal driver supports:
  20.  *  hpgl, hp7580b, HP Laserjet III
  21.  *
  22.  * AUTHORS
  23.  *  Colin Kelley, Thomas Williams, Russell Lang
  24.  * 
  25.  * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  26.  * 
  27.  */
  28.  
  29. #define HPGL_XMAX 15200
  30. #define HPGL_YMAX 10000
  31.  
  32. #define HPGL_XLAST (HPGL_XMAX - 1)
  33. #define HPGL_YLAST (HPGL_XMAX - 1)
  34.  
  35. /* HPGL_VCHAR, HPGL_HCHAR  are not used */
  36. #define HPGL_VCHAR    (HPGL_YMAX/100*32/10) /* 3.2% */
  37. #define HPGL_HCHAR    (HPGL_XMAX/100*12/10) /* 1.2% */
  38. #define HPGL_VTIC    (HPGL_YMAX/70)        
  39. #define HPGL_HTIC    (HPGL_YMAX/70)        
  40.  
  41. int HPGL_ang = 0;
  42.  
  43. HPGL_init()
  44. {
  45.     fputs("\033.Y\n",outfile);
  46. /*           1
  47.     1. enable eavesdropping
  48. */
  49. }
  50.  
  51. HPLJIII_PORT_init()
  52. {
  53.       fputs("\033E\033&l1X\033&l0O\033%0B;PW0.15\n",outfile);
  54. }
  55.  
  56. HPLJIII_LAND_init()
  57. {
  58.     fputs("\033E\033&l1X\033&l1O\033%0B;PW0.15\n",outfile);
  59. }
  60.  
  61.  
  62. HPGL_graphics()
  63. {
  64.     fprintf(outfile,
  65.     "IN;\nSC0,%d,0,%d;\nSR%f,%f;\n",
  66.         HPGL_XMAX,HPGL_YMAX,
  67.         ((double)(HPGL_HCHAR)*200/3/HPGL_XMAX),
  68.         ((double)(HPGL_VCHAR)*100/2/HPGL_YMAX) );
  69. /*     1    2             3 
  70.     1. reset to power-up defaults
  71.     2. set SCaling
  72.     3. set character size
  73. */
  74.     HPGL_ang = 0;
  75. }
  76.  
  77.  
  78. HPGL_text()
  79. {
  80.     fputs("PU;\nSP0;\n\033.Z\0",outfile);
  81. /*           1    2     3
  82.     1. pen up
  83.     2. park pen
  84.     3. disable eavesdropping
  85. */
  86. }
  87.  
  88.  
  89. HPGL_linetype(linetype)
  90. int linetype;
  91. {
  92. /* allow for 6 pens */
  93.     fprintf(outfile,"PU;\nSP%d;\n",(linetype+2)%6+1); 
  94. }
  95.  
  96.  
  97. HP75_linetype(linetype)
  98. int linetype;
  99. {
  100. /* allow for 4 pens */
  101.     fprintf(outfile,"PU;\nSP%d;\n",(linetype+2)%4+1); 
  102. }
  103.  
  104.  
  105. /* some early HPGL plotters (e.g. HP7220C) require the
  106.  * Pen Up/Down and Pen (move) Absolute commands to be separate
  107.  */
  108. HPGL_move(x,y)
  109. int x,y;
  110. {
  111.     fprintf(outfile,"PU;PA%d,%d;\n",x,y);
  112. }
  113.  
  114.  
  115. HPGL_vector(x,y)
  116. int x,y;
  117. {
  118.     fprintf(outfile,"PD;PA%d,%d;\n",x,y);
  119. }
  120.  
  121.  
  122. HPGL_put_text(x,y,str)
  123. int x, y;
  124. char *str;
  125. {
  126.     if (HPGL_ang == 1)
  127.         HPGL_move(x + HPGL_VCHAR/4,y);
  128.     else
  129.         HPGL_move(x,y - HPGL_VCHAR/4);
  130.     fprintf(outfile,"LB%s\003\n",str);
  131. }
  132.  
  133.  
  134. int HPGL_text_angle(ang)
  135. int ang;
  136. {
  137.     HPGL_ang = ang;
  138.     if (ang == 1)
  139.         /* vertical */
  140.         fprintf(outfile,"DI0,1;\n");
  141.     else
  142.         /* horizontal */
  143.         fprintf(outfile,"DI1,0;\n");
  144.     return TRUE;
  145. }
  146.  
  147.  
  148. HPGL_reset()
  149. {
  150. }
  151.  
  152. HPLJIII_reset()
  153. {
  154.     fputs("\033E\n",outfile);
  155. }
  156.