home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume1 / 8710 / 14 / pl.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-07-13  |  993 b   |  79 lines

  1. /*
  2.  * low-level i/o routines for the ccps plotting package
  3.  *
  4.  *  Rex Sanders, USGS, 2/87
  5.  *
  6.  */
  7.  
  8. #include <stdio.h>
  9.  
  10. static FILE *fp;
  11.  
  12. void
  13. plbegn_()
  14. {
  15.  
  16.     char *fname = "ps_plot";
  17.     long t;
  18.  
  19.     if ((fp = fopen(fname, "w")) == NULL)
  20.     {
  21.         fprintf(stderr, "plbegn: can't open %s\n", fname);
  22.         exit(1);
  23.     }
  24.  
  25.     fputs ("%!\n", fp);
  26.     fputs ("% Postscript output from ccps library\n", fp);
  27.     t = time(0);
  28.     fprintf (fp, "%% Created: %s", ctime(&t));
  29.  
  30. }
  31.  
  32. void
  33. pldone_()
  34. {
  35.     fputs ("% end of ccps output\n", fp);
  36.     fclose(fp);
  37. }
  38.  
  39. void
  40. plcout_(c)
  41. char *c;
  42. {
  43. /*
  44.  * send one char to plot file
  45.  */
  46.     putc(*c, fp);
  47. }
  48.  
  49. void
  50. pliout_(i)
  51. int *i;
  52. {
  53. /*
  54.  * send one integer value to plot file
  55.  */
  56.     fprintf(fp, "%d", *i);
  57. }
  58.  
  59. void
  60. plfout_(f)
  61. float *f;
  62. {
  63. /*
  64.  * send one float value to plot file
  65.  */
  66.     fprintf(fp, "%.3f", *f);
  67. }
  68. void
  69. plsout_(s, l)
  70. char *s;
  71. long int l;
  72. {
  73. /*
  74.  * send a string to plot file
  75.  */
  76. char *string;
  77.     for(string = s; l > 0; l--, string++) putc(*string, fp);
  78. }
  79.