File: g_write.c

package info (click to toggle)
plotutils 2.4.1-15
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 11,072 kB
  • ctags: 6,952
  • sloc: ansic: 76,305; cpp: 12,402; sh: 8,475; yacc: 2,604; makefile: 894; lex: 144
file content (62 lines) | stat: -rw-r--r-- 1,193 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* These are the lowest-level output routines in libplot/libplotter.
   Plotters that write to output streams use these. */

#include "sys-defines.h"
#include "extern.h"

void
#ifdef _HAVE_PROTOS
_write_byte (const plPlotterData *data, unsigned char c)
#else
_write_byte (data, c)
     const plPlotterData *data;
     unsigned char c;
#endif
{
  if (data->outfp)
    putc ((int)c, data->outfp);
#ifdef LIBPLOTTER
  else if (data->outstream)
    data->outstream->put (c);
#endif
}

void
#ifdef _HAVE_PROTOS
_write_bytes (const plPlotterData *data, int n, const unsigned char *c)
#else
_write_bytes (data, n, c)
     const plPlotterData *data;
     int n;
     const unsigned char *c;
#endif
{
  int i;

  if (data->outfp)
    {
      for (i = 0; i < n; i++)
	putc ((int)(c[i]), data->outfp);
    }
#ifdef LIBPLOTTER
  else if (data->outstream)
    data->outstream->write(c, n);
#endif
}

void
#ifdef _HAVE_PROTOS
_write_string (const plPlotterData *data, const char *s)
#else
_write_string (data, s)
     const plPlotterData *data;
     const char *s;
#endif
{
  if (data->outfp)
    fputs (s, data->outfp);
#ifdef LIBPLOTTER
  else if (data->outstream)
    (*(data->outstream)) << s;
#endif
}