Mercurial > hg > early-roguelike
annotate srogue/newterm.c @ 299:74351bf23e5e
Fix another pointer bug related to object stacks.
author | John "Elwin" Edwards |
---|---|
date | Sun, 11 Feb 2018 15:37:33 -0500 |
parents | 2128c7dc8a40 |
children |
rev | line source |
---|---|
36
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
1 /* |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
2 * Super-Rogue |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
3 * Copyright (C) 1984 Robert D. Kindelberger |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
4 * All rights reserved. |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
5 * |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
6 * See the file LICENSE.TXT for full copyright and licensing information. |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
7 */ |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
8 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
9 #include "rogue.h" |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
10 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
11 extern SGTTY _tty, _res_flg; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
12 extern bool NONL; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
13 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
14 raw() |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
15 { |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
16 /* |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
17 VERSION 5.0 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
18 _tty.c_lflag &= ~ICANON; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
19 _tty.c_cc[VMIN] = 1; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
20 _tty.c_cc[VTIME] = 255; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
21 _tty.c_oflag &= ~OPOST; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
22 */ |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
23 _rawmode = TRUE; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
24 _tty.sg_flags |= CBREAK; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
25 ioctl(_tty_ch, TIOCSETP, &_tty); |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
26 } |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
27 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
28 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
29 noraw() |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
30 { |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
31 /* |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
32 VERSION 5.0 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
33 _tty.c_lflag |= ICANON; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
34 _tty.c_cc[VMIN] = _res_flg.c_cc[VMIN]; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
35 _tty.c_cc[VTIME] = _res_flg.c_cc[VTIME]; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
36 _tty.c_oflag |= OPOST; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
37 */ |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
38 _rawmode = FALSE; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
39 _tty.sg_flags &= ~CBREAK; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
40 ioctl(_tty_ch, TIOCSETP, &_tty); |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
41 } |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
42 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
43 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
44 crmode() |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
45 { |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
46 /* |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
47 VERSION 5.0 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
48 _tty.c_lflag &= ~ICANON; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
49 _tty.c_oflag |= ONLCR; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
50 _tty.c_cc[VMIN] = 1; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
51 _tty.c_cc[VTIME]=255; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
52 */ |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
53 _rawmode = TRUE; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
54 _tty.sg_flags |= (CBREAK | CRMOD); |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
55 ioctl(_tty_ch, TIOCSETP, &_tty); |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
56 } |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
57 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
58 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
59 nocrmode() |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
60 { |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
61 /* |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
62 _tty.c_lflag |= ICANON; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
63 _tty.c_cc[VMIN]=_res_flg.c_cc[VMIN]; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
64 _tty.c_cc[VTIME]=_res_flg.c_cc[VTIME]; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
65 */ |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
66 _rawmode = FALSE; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
67 _tty.sg_flags &= ~CBREAK; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
68 ioctl(_tty_ch, TIOCSETP, &_tty); |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
69 } |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
70 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
71 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
72 echo() |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
73 { |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
74 _tty.sg_flags |= ECHO; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
75 _echoit=TRUE; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
76 ioctl(_tty_ch, TIOCSETP, &_tty); |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
77 } |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
78 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
79 noecho() |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
80 { |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
81 _tty.sg_flags &= ~ECHO; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
82 _echoit = FALSE; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
83 ioctl(_tty_ch, TIOCSETP, &_tty); |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
84 } |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
85 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
86 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
87 nl() |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
88 { |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
89 /* |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
90 VERSION 5.0 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
91 _tty.c_iflag |= ICRNL; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
92 _tty.c_oflag |= ONLCR; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
93 */ |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
94 _tty.sg_flags |= CRMOD; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
95 NONL = TRUE; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
96 ioctl(_tty_ch, TIOCSETP, &_tty); |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
97 } |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
98 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
99 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
100 nonl() |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
101 { |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
102 /* |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
103 VERSION 5.0 |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
104 _tty.c_iflag &= ~ICRNL; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
105 _tty.c_oflag &= ~ONLCR; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
106 */ |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
107 _tty.sg_flags &= ~CRMOD; |
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
elwin
parents:
diff
changeset
|
108 NONL = FALSE; |