File: input.h

package info (click to toggle)
lookup 1.08b-5
  • links: PTS
  • area: contrib
  • in suites: woody
  • size: 1,108 kB
  • ctags: 1,305
  • sloc: ansic: 12,634; makefile: 236; perl: 174; sh: 53
file content (65 lines) | stat: -rw-r--r-- 1,352 bytes parent folder | download | duplicates (9)
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
63
64
65
#ifndef __INPUT_H__ /* file wrapper */
#define __INPUT_H__
/*
 * Jeffrey Friedl
 * Omron Corporation			ʳ
 * Nagaokakyoshi, Japan			617Ĺ
 *
 * jfriedl@nff.ncl.omron.co.jp
 *
 * This work is placed under the terms of the GNU General Purpose License
 * (the "GNU Copyleft").
 */
#if USE_LOCAL_INPUT

#  define INPUT_BUF_SIZE 100
#  define STDIN 0

    extern int __input_pending__(void);
    extern unsigned char next_raw_input_byte(void);
    extern unsigned char next_cooked_input_byte(void);
    extern int flush_pending_input(void);
    extern void (*input_inactivity_function)();
    extern void ensure_blocking_input(void);

#   define input_pending() (preread_input_pending || __input_pending__())

#else /* don't USE_LOCAL_INPUT */

    static __inline__ input_pending(void)
    {
	return 0;
    }

    static __inline__ unsigned char
    next_raw_input_byte(void)
    {
	unsigned char c;
	read(0, &c, 1);
	return c;
    }

    static __inline__ unsigned char
    next_cooked_input_byte(void)
    {
	unsigned char c;
	set_tty_state_to_cbreak();
	c = next_raw_input_byte();
	reset_tty_state();
	return c;
    }

    static __inline__ int
    flush_pending_input(void)
    {
	return 0;
    }

    static __inline__ void
    ensure_blocking_input(void)
    {
    }


#endif /* USE_LOCAL_INPUT */
#endif /* file wrapper */