home *** CD-ROM | disk | FTP | other *** search
/ CICA 1995 May / cica_0595_4.zip / cica_0595_4 / UTIL / GPT34SRC / TERM / REGIS.TRM < prev    next >
Text File  |  1993-05-11  |  4KB  |  176 lines

  1. /*
  2.  * $Id: regis.trm%v 3.38.2.122 1993/04/30 00:31:45 woo Exp woo $
  3.  *
  4.  */
  5.  
  6. /* GNUPLOT - regis.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.  *  REGIS devices
  26.  *
  27.  * AUTHORS
  28.  *  Colin Kelley, Thomas Williams
  29.  * 
  30.  * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  31.  * 
  32.  */
  33.  
  34. #define REGISXMAX 800             
  35. #define REGISYMAX 440
  36.  
  37. #define REGISXLAST (REGISXMAX - 1)
  38. #define REGISYLAST (REGISYMAX - 1)
  39.  
  40. #define REGISVCHAR        20      
  41. #define REGISHCHAR        9
  42. #define REGISVTIC        8
  43. #define REGISHTIC        6
  44.  
  45. #define TRUE 1
  46. #define FALSE 0
  47. static int REGIS16color=FALSE;
  48.  
  49. int REGISang = 0;
  50.  
  51. REGISinit()
  52. {
  53.     fprintf(outfile,"\033[r\033[24;1H");
  54. /*                   1     2
  55.     1. reset scrolling region
  56.     2. locate cursor on bottom line
  57. */
  58. }
  59.  
  60.  
  61. /* thanks to calmasd!dko (Dan O'Neill) for adding S(E) for vt125s */
  62. REGISgraphics()
  63. {
  64.     fprintf(outfile,"\033[2J\033P1pS(C0)S(E)");
  65. /*                   1      2      3    4   5
  66.     1. clear screen
  67.     2. enter ReGIS graphics
  68.     3. turn off graphics diamond cursor
  69.     4. clear graphics screen
  70. */
  71.     (void) REGIStext_angle(0); /* select text size and angle */ 
  72. }
  73.  
  74.  
  75. REGIStext()
  76. {
  77.     fprintf(outfile,"\033\\\033[24;1H");
  78. /*                       1    2
  79.     1. Leave ReGIS graphics mode
  80.      2. locate cursor on last line of screen
  81. */
  82. }
  83.  
  84.  
  85. REGISlinetype(linetype)
  86. int     linetype;
  87. {
  88.       /* This will change color in order G,R,B,G-dot,R-dot,B-dot */
  89.  
  90. static int in_16_map[15+2] = {7,7,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
  91. static int lt_16_map[15+2] = {1,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
  92. static int in_map[9 + 2] = {2, 2, 3, 2, 1, 3, 2, 1, 3, 2, 1};
  93. static int lt_map[9 + 2] = {1, 4, 1, 1, 1, 4, 4, 4, 6, 6, 6};
  94.    
  95.        if(!REGIS16color)
  96.        {    if (linetype >= 9)
  97.                linetype %= 9;
  98.            fprintf(outfile, "W(I%d)", in_map[linetype + 2]);
  99.            fprintf(outfile, "W(P%d)", lt_map[linetype + 2]);
  100.        }
  101.        else
  102.        {    if(linetype >=15)
  103.                linetype %= 15;
  104.            fprintf(outfile, "W(I%d)", in_16_map[linetype + 2]);
  105.            fprintf(outfile, "W(P%d)", lt_16_map[linetype + 2]);
  106.        }
  107. }
  108.  
  109.  
  110.  
  111.  
  112. REGISmove(x,y)
  113. int x,y;
  114. {
  115.     fprintf(outfile,"P[%d,%d]",x,REGISYLAST-y,x,REGISYLAST-y);
  116. }
  117.  
  118.  
  119. REGISvector(x,y)
  120. int x,y;
  121. {
  122.     fprintf(outfile,"v[]v[%d,%d]",x,REGISYLAST - y);
  123. /* the initial v[] is needed to get the first pixel plotted */
  124. }
  125.  
  126.  
  127. /* put_text and text_angle by rjl */
  128. REGISput_text(x,y,str)
  129. int x, y;
  130. char *str;
  131. {
  132.     if (REGISang==1)
  133.         REGISmove(x-REGISVCHAR/2-1,y);
  134.     else
  135.         REGISmove(x,y+REGISVCHAR/2-1);
  136.     (void) putc('T',outfile); (void) putc('\'',outfile);
  137.     while (*str) {
  138.         (void) putc(*str,outfile);
  139.         if (*str == '\'')
  140.             (void) putc('\'',outfile);    /* send out another one */
  141.         str++;
  142.     }
  143.     (void) putc('\'',outfile);
  144. }
  145.  
  146.  
  147. int REGIStext_angle(ang)
  148. int ang;
  149. {
  150.     REGISang = ang;
  151.     if (ang == 1)
  152.         fputs("T(D90,S1)",outfile);
  153.     else
  154.         fputs("T(D0,S1)",outfile);
  155.     return TRUE;
  156. }
  157.  
  158.  
  159. REGISreset()
  160. {
  161.     fprintf(outfile,"\033[2J\033[24;1H");
  162. }
  163.  
  164. REGISoptions()
  165. {    int i=0;
  166.        struct value a;
  167.        extern struct value *const_express();
  168.        extern double real();
  169.    
  170.        if(!END_OF_COMMAND)
  171.        {    i=(int)real(const_express(&a));
  172.        }
  173.        REGIS16color= (i==16);
  174.        sprintf(term_options,"%s",REGIS16color?"16":"4");
  175. }
  176.