File: stgio.c

package info (click to toggle)
iraf 2.18.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 86,000 kB
  • sloc: ansic: 115,890; fortran: 74,576; lisp: 18,888; yacc: 5,642; sh: 961; lex: 596; makefile: 509; asm: 159; csh: 54; xml: 33; sed: 4
file content (60 lines) | stat: -rw-r--r-- 1,380 bytes parent folder | download | duplicates (4)
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
/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
*/

#define	import_spp
#define	import_libc
#define	import_xnames
#include <iraf.h>


/* STGIO.C -- STDGRAPH graphics terminal i/o interface.  This is a C binding
** for the VOS STDGRAPH graphics kernel text i/o routines.  These are used to
** do direct i/o to the graphics terminal, whether or not the terminal is in
** graphics mode.  When the terminal is not in graphics mode, i.e., when the
** "workstation is deactivated", these routines are equivalent to the FIO
** putline and getline procedures.
**
**	nchars|EOF = c_stggetline (STDIN, buf)
**		     c_stgputline (STDOUT, buf)
*/


/* C_STGGETLINE -- Get a line of text from the graphics terminal.
*/
int
c_stggetline (
  XINT	fd,			/* input stream		*/
  char	*buf,			/* user string buffer	*/
  int   maxch			/* max bufer size	*/
)
{
	XCHAR	xbuf[maxch+1];
	XINT    x_fd = fd;
	int	status;

	iferr (status = STG_GETLINE (&x_fd, xbuf))
	    return (EOF);
	else {
	    c_strpak (xbuf, buf, maxch);
	    return (status);
	}
}


/* C_STGPUTLINE -- Put a line of text to the graphics terminal.
*/
int
c_stgputline (
  XINT	fd,			/* input stream		*/
  char	*buf			/* user string buffer	*/
)
{
	XCHAR	xbuf[SZ_LINE+1];
	XINT    x_fd = fd;

	c_strupk (buf, xbuf, SZ_LINE);
	iferr (STG_PUTLINE (&x_fd, xbuf))
	    return (ERR);
	else
	    return (OK);
}