blob: 1e445612f65a057ed589de922b2a1086c7cf6ef3 (
plain)
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
|
/* $OpenBSD: fifo_defs.h,v 1.1 1997/12/03 05:21:08 millert Exp $ */
/***************************************************************************
* COPYRIGHT NOTICE *
****************************************************************************
* ncurses is copyright (C) 1992-1995 *
* Zeyd M. Ben-Halim *
* zmbenhal@netcom.com *
* Eric S. Raymond *
* esr@snark.thyrsus.com *
* *
* Permission is hereby granted to reproduce and distribute ncurses *
* by any means and for any fee, whether alone or as part of a *
* larger distribution, in source or in binary form, PROVIDED *
* this notice is included with any such distribution, and is not *
* removed from any of its header files. Mention of ncurses in any *
* applications linked with it is highly appreciated. *
* *
* ncurses comes AS IS with no warranty, implied or expressed. *
* *
***************************************************************************/
/*
* Common macros for lib_getch.c, lib_ungetch.c
*
* Id: fifo_defs.h,v 1.1 1997/10/19 02:31:46 tom Exp $
*/
#ifndef FIFO_DEFS_H
#define FIFO_DEFS_H 1
#define head SP->_fifohead
#define tail SP->_fifotail
/* peek points to next uninterpreted character */
#define peek SP->_fifopeek
#define h_inc() { head == FIFO_SIZE-1 ? head = 0 : head++; if (head == tail) head = -1, tail = 0;}
#define h_dec() { head == 0 ? head = FIFO_SIZE-1 : head--; if (head == tail) tail = -1;}
#define t_inc() { tail == FIFO_SIZE-1 ? tail = 0 : tail++; if (tail == head) tail = -1;}
#define t_dec() { tail == 0 ? tail = FIFO_SIZE-1 : tail--; if (head == tail) fifo_clear();}
#define p_inc() { peek == FIFO_SIZE-1 ? peek = 0 : peek++;}
#define cooked_key_in_fifo() (head!=-1 && peek!=head)
#define raw_key_in_fifo() (head!=-1 && peek!=tail)
#undef HIDE_EINTR
#endif /* FIFO_DEFS_H */
|