home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / MISC / NETWORK / TEL23SRC.ZIP / RG / RGHP.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-25  |  2.9 KB  |  183 lines

  1. /*
  2. *
  3. *  rghp.c by Aaron Contorer for NCSA
  4. *
  5. *  Routines for HP-GL plotter output.  Only 1 window output at a time.
  6. *
  7. */
  8.  
  9. #include <stdio.h>
  10. #ifdef MEMORY_DEBUG
  11. #include "memdebug.h"
  12. #endif
  13. #include "externs.h"
  14.  
  15. #define TRUE 1
  16. #define FALSE 0
  17.  
  18. static char *HPname = "Hewlett-Packard HP-GL plotter";
  19. static char busy; /* is device already in use */
  20. static int winbot,winleft,wintall,winwide;    /* position and size of window into virtual space */
  21. static void (*outfunc)(char *s);    /* the function to call with pointer to strings */
  22. static char HPtext[100];    /* the string containing the HP-GL output text */
  23. static int HPpenx,HPpeny;
  24. static int HPblank;
  25. static int HPcolor;
  26.  
  27. static void HPbegin(void );
  28. static void signore(char *s);
  29.  
  30. static void signore(s)
  31. char *s;            /* Ignore the string pointer passed here. */
  32. {
  33.     s=s;
  34. }
  35.  
  36. void RGHPoutfunc(f)
  37. void (*f)(char *);
  38. /*
  39.     Specify the function that is to be called with pointers to all
  40.     the HP-GL strings.
  41. */
  42. {
  43.     outfunc=f;
  44. }
  45.  
  46. static void HPbegin()
  47. /* set up environment for whole new printout */
  48. {
  49.     (*outfunc)("IN;SP1;SC-50,4370,-100,4120;PU0,0;");
  50.     HPpenx=HPpeny=0;
  51. }
  52.  
  53. int RGHPnewwin()
  54. {
  55.     if(busy) 
  56.         return(-1);
  57.     HPtext[0]='\0';
  58.     HPpenx=HPpeny=0;
  59.     HPblank=TRUE;
  60.     HPcolor=100;
  61.     return(0);
  62. }
  63.  
  64. void RGHPclrscr(int w)
  65. {
  66.     RGHPpagedone(w);
  67. }
  68.  
  69. void RGHPclose(int w) 
  70. {
  71.     RGHPclrscr(w);
  72.     busy=FALSE;
  73. }
  74.  
  75. void RGHPpoint(int w,int x,int y) 
  76. {
  77.     (*outfunc)("PD;PU;");
  78.     w=w;
  79.     x=x;
  80.     y=y;
  81.  
  82. void RGHPdrawline(w,x0,y0,x1,y1)
  83. int w,x0,y0,x1,y1;
  84. {
  85.     w=w;
  86.     if(HPblank) {
  87.         HPbegin();
  88.         HPblank=FALSE;
  89.       }
  90.     if(x0!=HPpenx||y0!=HPpeny) {        /* only move pen if not already there */
  91.         sprintf(HPtext,"PU%d,%d;",x0, y0);
  92.         (*outfunc)(HPtext);
  93.       }
  94.     sprintf(HPtext,"PD%d,%d;",x1, y1);
  95.     (*outfunc)(HPtext);
  96.     HPpenx=x1;
  97.     HPpeny=y1;
  98. }
  99.  
  100. void RGHPpagedone(int w) 
  101. {
  102.     (*outfunc)("PG;");
  103.     HPblank=TRUE;
  104.     w=w;
  105. }
  106.  
  107. void RGHPdataline(int w,char *data,int count) {
  108.     
  109. /* Needed for possible future functionality */
  110.  
  111.     w=w;
  112.     data=data;
  113.     count=count;
  114.  
  115.     }
  116.  
  117.  
  118. void RGHPpencolor(int w,int color) 
  119. {
  120.     color&=7;
  121.     if(color) {
  122.         sprintf(HPtext,"SP%d;",color);
  123.         (*outfunc)(HPtext);
  124.       }
  125.     w=w;
  126. }
  127.  
  128. void RGHPcharmode(int w,int rotation,int size) {
  129.     
  130. /* Needed for possible future functionality */
  131.  
  132.     w=w;
  133.     rotation=rotation;
  134.     size=size;
  135.  
  136.     }
  137.  
  138.  
  139. void RGHPshowcur() {}
  140. void RGHPlockcur() {}
  141. void RGHPhidecur() {}
  142. void RGHPbell(int w) {
  143.     
  144. /* Needed for possible future functionality */
  145.     w=w;
  146.  
  147.     }
  148.  
  149. void RGHPuncover(int w) {
  150.     
  151. /* Needed for possible future functionality */
  152.     w=w;
  153.  
  154.     }
  155.  
  156.  
  157. char *RGHPdevname() 
  158. {
  159.     return(HPname);
  160. }
  161.  
  162. void RGHPinit() 
  163. {
  164.     busy=FALSE;
  165.     outfunc=signore;
  166. }
  167.  
  168. void RGHPinfo(int w,int a,int b,int c,int d,int v) {
  169. /* Needed for possible future functionality */
  170.     w=w;
  171.     a=a;
  172.     b=b;
  173.     c=c;
  174.     d=d;
  175.     v=v;
  176.  
  177.     }
  178.  
  179.  
  180. void RGHPgmode() {}
  181. void RGHPtmode() {}
  182.