home *** CD-ROM | disk | FTP | other *** search
/ GRIPS 2: Government Rast…rocessing Software & Data / GRIPS_2.cdr / dos / ncsa_tel / contribu / byu_tel2.hqx / tek / rghp.c < prev    next >
Text File  |  1989-05-17  |  2KB  |  133 lines

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