home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 334_02 / regis.trm < prev    next >
Text File  |  1991-02-05  |  3KB  |  142 lines

  1. /* GNUPLOT - regis.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.  *  REGIS devices
  21.  *
  22.  * AUTHORS
  23.  *  Colin Kelley, Thomas Williams
  24.  * 
  25.  * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  26.  * 
  27.  */
  28.  
  29. #define REGISXMAX 800             
  30. #define REGISYMAX 440
  31.  
  32. #define REGISXLAST (REGISXMAX - 1)
  33. #define REGISYLAST (REGISYMAX - 1)
  34.  
  35. #define REGISVCHAR        20      
  36. #define REGISHCHAR        9
  37. #define REGISVTIC        8
  38. #define REGISHTIC        6
  39.  
  40. int REGISang = 0;
  41.  
  42. REGISinit()
  43. {
  44.     fprintf(outfile,"\033[r\033[24;1H");
  45. /*                   1     2
  46.     1. reset scrolling region
  47.     2. locate cursor on bottom line
  48. */
  49. }
  50.  
  51.  
  52. /* thanks to calmasd!dko (Dan O'Neill) for adding S(E) for vt125s */
  53. REGISgraphics()
  54. {
  55.     fprintf(outfile,"\033[2J\033P1pS(C0)S(E)");
  56. /*                   1      2      3    4   5
  57.     1. clear screen
  58.     2. enter ReGIS graphics
  59.     3. turn off graphics diamond cursor
  60.     4. clear graphics screen
  61. */
  62.     (void) REGIStext_angle(0); /* select text size and angle */ 
  63. }
  64.  
  65.  
  66. REGIStext()
  67. {
  68.     fprintf(outfile,"\033\\\033[24;1H");
  69. /*                       1    2
  70.     1. Leave ReGIS graphics mode
  71.      2. locate cursor on last line of screen
  72. */
  73. }
  74.  
  75.  
  76. REGISlinetype(linetype)
  77. int     linetype;
  78. {
  79.       /* This will change color in order G,R,B,G-dot,R-dot,B-dot */
  80. static int in_map[9 + 2] = {2, 2, 3, 2, 1, 3, 2, 1, 3, 2, 1};
  81. static int lt_map[9 + 2] = {1, 4, 1, 1, 1, 4, 4, 4, 6, 6, 6};
  82.  
  83.     if (linetype >= 9)
  84.         linetype %= 9;
  85.     fprintf(outfile, "W(I%d)", in_map[linetype + 2]);
  86.     fprintf(outfile, "W(P%d)", lt_map[linetype + 2]);
  87. }
  88.  
  89.  
  90. REGISmove(x,y)
  91. int x,y;
  92. {
  93.     fprintf(outfile,"P[%d,%d]",x,REGISYLAST-y,x,REGISYLAST-y);
  94. }
  95.  
  96.  
  97. REGISvector(x,y)
  98. int x,y;
  99. {
  100.     fprintf(outfile,"v[]v[%d,%d]",x,REGISYLAST - y);
  101. /* the initial v[] is needed to get the first pixel plotted */
  102. }
  103.  
  104.  
  105. /* put_text and text_angle by rjl */
  106. REGISput_text(x,y,str)
  107. int x, y;
  108. char *str;
  109. {
  110.     if (REGISang==1)
  111.         REGISmove(x-REGISVCHAR/2-1,y);
  112.     else
  113.         REGISmove(x,y+REGISVCHAR/2-1);
  114.     (void) putc('T',outfile); (void) putc('\'',outfile);
  115.     while (*str) {
  116.         (void) putc(*str,outfile);
  117.         if (*str == '\'')
  118.             (void) putc('\'',outfile);    /* send out another one */
  119.         str++;
  120.     }
  121.     (void) putc('\'',outfile);
  122. }
  123.  
  124.  
  125. int REGIStext_angle(ang)
  126. int ang;
  127. {
  128.     REGISang = ang;
  129.     if (ang == 1)
  130.         fputs("T(D90,S1)",outfile);
  131.     else
  132.         fputs("T(D0,S1)",outfile);
  133.     return TRUE;
  134. }
  135.  
  136.  
  137. REGISreset()
  138. {
  139.     fprintf(outfile,"\033[2J\033[24;1H");
  140. }
  141.  
  142.