/* $Copyright:	$
 * Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990 
 * Sequent Computer Systems, Inc.   All rights reserved.
 *  
 * This software is furnished under a license and may be used
 * only in accordance with the terms of that license and with the
 * inclusion of the above copyright notice.   This software may not
 * be provided or otherwise made available to, or used by, any
 * other person.  No title to or ownership of the software is
 * hereby transferred.
*/

/*	Copyright (c) 1984 AT&T	*/
/*	  All Rights Reserved  	*/

/*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
/*	The copyright notice above does not evidence any   	*/
/*	actual or intended publication of such source code.	*/

#ident	"$Header: nomacros.c 1.1 89/10/23 $@(#)curses:screen/nomacros.c	1.3"
#define	NOMACROS

#include	"curses_inc.h"

extern	void	w32attroff(), w32attron(), w32attrset(),
		wstandend(), wstandout(), wtimeout();

/* Functions for stdscr. */

addch(ch)
chtype	ch;
{
    return (waddch (stdscr, ch));
}

addnstr(s,n)
char	*s;
int	n;
{
    return (waddnstr(stdscr,s,n));
}

addstr(str)
char	*str;
{
    return (waddstr(stdscr, str));
}

void
attroff(at)
chtype	at;
{
    wattroff(stdscr,at);
}

void
attron(at)
chtype	at;
{
    wattron(stdscr,at);
}

void
attrset(at)
chtype	at;
{
    wattrset(stdscr,at);
}

bkgd(c)
chtype	c;
{
    return (wbkgd(stdscr,c));
}

border(lc,rc,tc,bc)
chtype	lc, rc, tc, bc;
{
    return (wborder(stdscr,lc,rc,tc,bc));
}

clear()
{
    return (wclear(stdscr));
}

clrtobot()
{
    return (wclrtobot(stdscr));
}

clrtoeol()
{
    return (wclrtoeol(stdscr));
}

delch()
{
    return (wdelch(stdscr));
}

deleteln()
{
    return (winsdelln(stdscr,-1));
}

echochar(ch)
chtype	ch;
{
    return (wechochar(stdscr, ch));
}

erase()	
{
    return (werase(stdscr));
}

getch()
{
    return (wgetch(stdscr));
}

getstr(str)
char	*str;
{
    return (wgetstr(stdscr, str));
}

chtype
inch()
{
    return (winch(stdscr));
}

insch(c)
chtype	c;
{
    return (winsch(stdscr,c));
}

insdelln(id)
int	id;
{
    return (winsdelln(stdscr,id));
}

insertln()
{
    return (winsdelln(stdscr,1));
}

insnstr(s,n)
char	*s;
int	n;
{
    return (winsnstr(stdscr,s,n));
}

insstr(s)
char	*s;
{
    return (winsstr(stdscr,s));
}

move(y, x)
int	y, x;
{
    return (wmove(stdscr, y, x));
}

refresh()
{
    return (wrefresh(stdscr));
}

scrl(n)
int	n;
{
    return (wscrl(stdscr,n));
}

setscrreg(t,b)
int	t, b;
{
    return (wsetscrreg(stdscr, t, b));
}

void
standend()
{
    wstandend(stdscr);
}

void
standout()
{
    wstandout(stdscr);
}

void
timeout(tm)
int	tm;
{
    wtimeout(stdscr,tm);
}

mvaddch(y,x,ch)
int	y,x;
chtype	ch;
{
    return(wmove(stdscr,y,x)==ERR?ERR:waddch(stdscr,ch));
}

mvaddnstr(y,x,s,n)
int	y,x;
char	*s;
int	n;
{
    return(wmove(stdscr,y,x)==ERR?ERR:waddnstr(stdscr,s,n));
}

mvaddstr(y,x,str)
int	y,x;
char	*str;
{
    return(wmove(stdscr,y,x)==ERR?ERR:waddstr(stdscr,str));
}

mvdelch(y,x)
int	y,x;
{
    return(wmove(stdscr,y,x)==ERR?ERR:wdelch(stdscr));
}

mvgetch(y,x)
int	y,x;
{
    return(wmove(stdscr,y,x)==ERR?ERR:wgetch(stdscr));
}

mvgetstr(y,x,str)
int	y,x;
char	*str;
{
    return(wmove(stdscr,y,x)==ERR?ERR:wgetstr(stdscr,str));
}

chtype
mvinch(y,x)
int	y,x;
{
    return(wmove(stdscr,y,x)==ERR?(chtype) ERR:winch(stdscr));
}

mvinsch(y,x,c)
int	y,x;
chtype	c;
{
    return(wmove(stdscr,y,x)==ERR?ERR:winsch(stdscr,c));
}

mvwinchstr(win,y,x,str)
WINDOW *win;
int	y,x;
chtype	*str;
{
	wmove(win,y,x)==ERR?ERR:winchstr(win,str);
}

mvinsnstr(y,x,s,n)
int	y,x;
char	*s;
int	n;
{
    return(wmove(stdscr,y,x)==ERR?ERR:winsnstr(stdscr,s,n));
}

mvinsstr(y,x,s)
int	y,x;
char	*s;
{
    return(wmove(stdscr,y,x)==ERR?ERR:winsstr(stdscr,s));
}

/* End of stdscr functions. */

void
wstandend(win)
WINDOW	*win;
{
    wattrset(win,A_NORMAL);
}

void
wstandout(win)
WINDOW	*win;
{
    wattron(win,A_STANDOUT);
}

mvwaddch(win,y,x,ch)
WINDOW	*win;
int	y,x;
chtype	ch;
{
    return (wmove(win,y,x)==ERR?ERR:waddch(win,ch));
}

mvwaddchstr(win,y,x,ch)
WINDOW	*win;
int	y,x;
chtype	*ch;
{
    return (wmove(win,y,x)==ERR?ERR:waddchstr(win,ch));
}

mvwaddchnstr(win,y,x,ch,n)
WINDOW	*win;
int	y,x,n;
chtype	*ch;
{
    return (wmove(win,y,x)==ERR?ERR:waddchnstr(win,ch,n));
}

mvwhline(win,y,x,c,n)
WINDOW	*win;
int	y,x,n;
chtype	c;
{
    return (wmove(win,y,x)==ERR?ERR:whline(win,c,n));
}

mvwvline(win,y,x,c,n)
WINDOW	*win;
int	y,x,n;
chtype	c;
{
    return (wmove(win,y,x)==ERR?ERR:wvline(win,c,n));
}

mvwaddnstr(win,y,x,s,n)
WINDOW	*win;
int	y,x;
char	*s;
int	n;
{
    return (wmove(win,y,x)==ERR?ERR:waddnstr(win,s,n));
}

mvwaddstr(win,y,x,str)
WINDOW	*win;
int	y,x;
char	*str;
{
    return (wmove(win,y,x)==ERR?ERR:waddstr(win,str));
}

mvwdelch(win,y,x)
WINDOW	*win;
int	y,x;
{
    return (wmove(win,y,x)==ERR?ERR:wdelch(win));
}

mvwgetch(win,y,x)
WINDOW	*win;
int	y,x;
{
    return (wmove(win,y,x)==ERR?ERR:wgetch(win));
}

mvwgetstr(win,y,x,str)
WINDOW	*win;
int	y,x;
char	*str;
{
    return (wmove(win,y,x)==ERR?ERR:wgetstr(win,str));
}

chtype
mvwinch(win,y,x)
WINDOW	*win;
int	y,x;
{
    return (wmove(win, y, x) == ERR ? (chtype) ERR : winch(win));
}

mvwinsch(win,y,x,c)
WINDOW	*win;
int	y,x;
chtype	c;
{
    return (wmove(win,y,x)==ERR?ERR:winsch(win,c));
}

mvwinsnstr(win,y,x,s,n)
WINDOW	*win;
int	y,x;
char	*s;
int	n;
{
    return (wmove(win,y,x)==ERR?ERR:winsnstr(win,s,n));
}

mvaddchstr(y,x,s)
int	y,x;
chtype	*s;
{
	return(wmove(stdscr,y,x)==ERR?ERR:waddchstr(stdscr,s));
}

mvaddchnstr(y,x,s,n)
int	y,x,n;
chtype	*s;
{
	return(wmove(stdscr,y,x)==ERR?ERR:waddchnstr(stdscr,s,n));
}

mvinstr(y,x,s)
int	y,x;
char	*s;
{
	return(wmove(stdscr,y,x)==ERR?ERR:winstr(stdscr,s));
}

mvwinstr(win,y,x,s)
WINDOW *win;
int	y,x;
char	*s;
{
	return(mvwinstr(win,y,x,s));
}

mvinnstr(y,x,s,n)
int	y,x;
char	*s;
{
	return(wmove(stdscr,y,x)==ERR?ERR:winnstr(stdscr,s,n));
}

mvwinnstr(win,y,x,s,n)
WINDOW *win;
int	y,x;
char	*s;
{
	return(wmove(win,y,x)==ERR?ERR:winnstr(win,s,n));
}

mvinchstr(y,x,s)
int	y,x;
chtype	*s;
{
	return(wmove(stdscr,y,x)==ERR?ERR:winchstr(stdscr,s));
}

mvwinchnstr(win,y,x,s,n)
WINDOW  *win;
int	y,x,n;
chtype	*s;
{
	return(wmove(win,y,x)==ERR?ERR:winchnstr(win,s,n));
}

mvwinsstr(win,y,x,s)
WINDOW	*win;
int	y,x;
char	*s;
{
    return (wmove(win,y,x)==ERR?ERR:winsstr(win,s));
}

overlay(src,dst)
WINDOW	*src, *dst;
{
    return (_overlap(src,dst,TRUE));
}

overwrite(src,dst)
WINDOW	*src, *dst;
{
    return (_overlap(src,dst,FALSE));
}

wdeleteln(win)
WINDOW	*win;
{
    return (winsdelln(win,-1));
}

winsertln(win)
WINDOW	*win;
{
    return (winsdelln(win,1));
}

void
flash()
{
    ring(FALSE);
}

void
beep()
{
    ring(TRUE);
}

box(win,v,h)
WINDOW	*win;
chtype	v,h;
{
    return (wborder(win,v,v,h,h));
}

WINDOW	*
newpad(l,nc)
int	l,nc;
{
    return (newwin(l,nc,0,0));
}

SCREEN	*
newterm(type,fout,fin)
char	*type;
FILE	*fout, *fin;
{
    return (newscreen(type,0,0,0,fout,fin));
}

SCREEN	*
set_term(screen)
SCREEN	*screen;
{
    return (setcurscreen(screen));
}

scroll(win)
WINDOW	*win;
{
    return (wscrl(win,1));
}

slk_init(f)
int	f;
{
    return (slk_start((f == 0) ? 3 : 2,NULL));
}

WINDOW	*
subpad(win,l,nc,by,bx)
WINDOW	*win;
int	l,nc,by,bx;
{
    return (derwin(win,l,nc,by,bx));
}

WINDOW	*
subwin(win,l,nc,by,bx)
WINDOW	*win;
int	l,nc,by,bx;
{
    return (derwin(win,l,nc,by - win->_begy,bx - win->_begx));
}

touchline(win,y,n)
WINDOW	*win;
int	y,n;
{
    return (wtouchln(win,y,n,TRUE));
}

touchwin(win)
WINDOW	*win;
{
    return (wtouchln(win,0,win->_maxy,TRUE));
}

void
vidputs(a,b)
chtype	a;
int	(*b)();
{
    vidupdate(a,cur_term->sgr_mode,b);
}

waddstr(win,str)
WINDOW	*win;
char	*str;
{
    return (waddnstr(win,str,-1));
}

werase(win)
WINDOW	*win;
{
    wmove(win,0,0);
    return (wclrtobot(win));
}

wclear(win)
WINDOW	*win;
{
    win->_clear = TRUE;
    return (werase(win));
}

intrflush(win,flag)
WINDOW	*win;
int	flag;
{
    _setqiflush(flag);
}

void
ungetch(c)
int	c;
{
    _ungetch(-c - 0100,TRUE);
}

halfdelay(tens)
int	tens;
{
    return (ttimeout(tens * 100));
}

winchstr(win,str)
WINDOW	*win;
chtype	*str;
{
    return (winchnstr(win,str,win->_maxx - win->_curx));
}

winstr(win,str)
WINDOW	*win;
char	*str;
{
    return (winnstr(win,str,win->_maxx - win->_curx));
}

waddchstr(win,str)
WINDOW	*win;
char	*str;
{
    return (waddchnstr(win,str,-1));
}

winsstr(win,str)
WINDOW	*win;
char	*str;
{
    return (winsnstr(win,str,-1));
}

untouchwin(win)
WINDOW	*win;
{
    return (wtouchln(win,0,win->_maxy,FALSE));
}

void
qiflush()
{
    _setqiflush(TRUE);
}

void
noqiflush()
{
    _setqiflush(FALSE);
}

void
nl()
{
    _setnonl(FALSE);
}

void
nonl()
{
    _setnonl(TRUE);
}

void
echo()
{
    _setecho(TRUE);
}

void
noecho()
{
    _setecho(FALSE);
}

#undef del_curterm
void
del_curterm(terminal)
TERMINAL *terminal;
{
	delterm(terminal);
}

#undef resetterm
void
resetterm()
{
	reset_shell_mode();
}

#undef fixterm
void
fixterm()
{
	reset_prog_mode();
}

#undef saveterm
void
saveterm()
{
	def_prog_mode();
}
