Mercurial > emacs
annotate src/cm.h @ 83337:588dc71e812f
Merged from miles@gnu.org--gnu-2005 (patch 474)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-474
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-377
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Sun, 10 Jul 2005 19:26:29 +0000 |
parents | 6c13700d1c13 |
children | 532e0a9335a9 |
rev | line source |
---|---|
486 | 1 /* Cursor motion calculation definitions for GNU Emacs |
2 Copyright (C) 1985, 1989 Free Software Foundation, Inc. | |
3 | |
4 This file is part of GNU Emacs. | |
5 | |
6 GNU Emacs is free software; you can redistribute it and/or modify | |
7 it under the terms of the GNU General Public License as published by | |
12244 | 8 the Free Software Foundation; either version 2, or (at your option) |
486 | 9 any later version. |
10 | |
11 GNU Emacs is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with GNU Emacs; see the file COPYING. If not, write to | |
64084 | 18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 Boston, MA 02110-1301, USA. */ | |
486 | 20 |
21 /* Holds the minimum and maximum costs for the parametrized capabilities. */ | |
22 struct parmcap | |
23 { | |
24 int mincost, maxcost; | |
25 }; | |
26 | |
27 /* This structure holds everything needed to do cursor motion except the pad | |
28 character (PC) and the output speed of the terminal (ospeed), which | |
29 termcap wants in global variables. */ | |
30 | |
31 struct cm | |
32 { | |
33 /* Cursor position. -1 in *both* variables means the cursor | |
34 position is unknown, in order to force absolute cursor motion. */ | |
35 | |
36 int cm_curY; /* Current row */ | |
37 int cm_curX; /* Current column */ | |
38 | |
39 /* Capabilities from termcap */ | |
40 char *cm_up; /* up (up) */ | |
41 char *cm_down; /* down (do) */ | |
42 char *cm_left; /* left (le) */ | |
43 char *cm_right; /* right (nd) */ | |
44 char *cm_home; /* home (ho) */ | |
45 char *cm_cr; /* carriage return (cr) */ | |
46 char *cm_ll; /* last line (ll) */ | |
47 char *cm_tab; /* tab (ta) */ | |
48 char *cm_backtab; /* backtab (bt) */ | |
49 char *cm_abs; /* absolute (cm) */ | |
50 char *cm_habs; /* horizontal absolute (ch) */ | |
51 char *cm_vabs; /* vertical absolute (cv) */ | |
52 #if 0 | |
53 char *cm_ds; /* "don't send" string (ds) */ | |
54 #endif | |
55 char *cm_multiup; /* multiple up (UP) */ | |
56 char *cm_multidown; /* multiple down (DO) */ | |
57 char *cm_multileft; /* multiple left (LE) */ | |
58 char *cm_multiright; /* multiple right (RI) */ | |
59 int cm_cols; /* number of cols on screen (co) */ | |
60 int cm_rows; /* number of rows on screen (li) */ | |
61 int cm_tabwidth; /* tab width (it) */ | |
62 unsigned int cm_autowrap:1; /* autowrap flag (am) */ | |
63 unsigned int cm_magicwrap:1; /* VT-100: cursor stays in last col but | |
64 will cm_wrap if next char is | |
65 printing (xn) */ | |
66 unsigned int cm_usetabs:1; /* if set, use tabs */ | |
67 unsigned int cm_losewrap:1; /* if reach right margin, forget cursor | |
68 location */ | |
69 unsigned int cm_autolf:1; /* \r performs a \r\n (rn) */ | |
70 | |
71 /* Parametrized capabilities. This needs to be a struct since | |
72 the costs are accessed through pointers. */ | |
73 | |
74 #if 0 | |
75 struct parmcap cc_abs; /* absolute (cm) */ | |
76 struct parmcap cc_habs; /* horizontal absolute (ch) */ | |
77 struct parmcap cc_vabs; /* vertical absolute (cv) */ | |
78 struct parmcap cc_multiup; /* multiple up (UP) */ | |
79 struct parmcap cc_multidown; /* multiple down (DO) */ | |
80 struct parmcap cc_multileft; /* multiple left (LE) */ | |
81 struct parmcap cc_multiright; /* multiple right (RI) */ | |
82 #endif | |
83 | |
84 /* Costs for the non-parametrized capabilities */ | |
85 int cc_up; /* cost for up */ | |
86 int cc_down; /* etc. */ | |
87 int cc_left; | |
88 int cc_right; | |
89 int cc_home; | |
90 int cc_cr; | |
91 int cc_ll; | |
92 int cc_tab; | |
93 int cc_backtab; | |
94 /* These are temporary, until the code is installed to use the | |
95 struct parmcap fields above. */ | |
96 int cc_abs; | |
97 int cc_habs; | |
98 int cc_vabs; | |
99 }; | |
100 | |
101 extern char PC; /* Pad character */ | |
18659
b6ced5dad84b
(ospeed): Declare as short unless HAVE_TERMIOS_H and LINUX.
Richard M. Stallman <rms@gnu.org>
parents:
18473
diff
changeset
|
102 |
486 | 103 /* Shorthand */ |
104 #ifndef NoCMShortHand | |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
105 #define curY(tty) (tty)->Wcm->cm_curY |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
106 #define curX(tty) (tty)->Wcm->cm_curX |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
107 #define Up(tty) (tty)->Wcm->cm_up |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
108 #define Down(tty) (tty)->Wcm->cm_down |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
109 #define Left(tty) (tty)->Wcm->cm_left |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
110 #define Right(tty) (tty)->Wcm->cm_right |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
111 #define Tab(tty) (tty)->Wcm->cm_tab |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
112 #define BackTab(tty) (tty)->Wcm->cm_backtab |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
113 #define TabWidth(tty) (tty)->Wcm->cm_tabwidth |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
114 #define CR(tty) (tty)->Wcm->cm_cr |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
115 #define Home(tty) (tty)->Wcm->cm_home |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
116 #define LastLine(tty) (tty)->Wcm->cm_ll |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
117 #define AbsPosition(tty) (tty)->Wcm->cm_abs |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
118 #define ColPosition(tty) (tty)->Wcm->cm_habs |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
119 #define RowPosition(tty) (tty)->Wcm->cm_vabs |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
120 #define MultiUp(tty) (tty)->Wcm->cm_multiup |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
121 #define MultiDown(tty) (tty)->Wcm->cm_multidown |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
122 #define MultiLeft(tty) (tty)->Wcm->cm_multileft |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
123 #define MultiRight(tty) (tty)->Wcm->cm_multiright |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
124 #define AutoWrap(tty) (tty)->Wcm->cm_autowrap |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
125 #define MagicWrap(tty) (tty)->Wcm->cm_magicwrap |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
126 #define UseTabs(tty) (tty)->Wcm->cm_usetabs |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
127 #define FrameRows(tty) (tty)->Wcm->cm_rows |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
128 #define FrameCols(tty) (tty)->Wcm->cm_cols |
486 | 129 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
130 #define UpCost(tty) (tty)->Wcm->cc_up |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
131 #define DownCost(tty) (tty)->Wcm->cc_down |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
132 #define LeftCost(tty) (tty)->Wcm->cc_left |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
133 #define RightCost(tty) (tty)->Wcm->cc_right |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
134 #define HomeCost(tty) (tty)->Wcm->cc_home |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
135 #define CRCost(tty) (tty)->Wcm->cc_cr |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
136 #define LastLineCost(tty) (tty)->Wcm->cc_ll |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
137 #define TabCost(tty) (tty)->Wcm->cc_tab |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
138 #define BackTabCost(tty) (tty)->Wcm->cc_backtab |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
139 #define AbsPositionCost(tty) (tty)->Wcm->cc_abs |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
140 #define ColPositionCost(tty) (tty)->Wcm->cc_habs |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
141 #define RowPositionCost(tty) (tty)->Wcm->cc_vabs |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
142 #define MultiUpCost(tty) (tty)->Wcm->cc_multiup |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
143 #define MultiDownCost(tty) (tty)->Wcm->cc_multidown |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
144 #define MultiLeftCost(tty) (tty)->Wcm->cc_multileft |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
145 #define MultiRightCost(tty) (tty)->Wcm->cc_multiright |
486 | 146 #endif |
147 | |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
148 #define cmat(tty,row,col) (curY(tty) = (row), curX(tty) = (col)) |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
149 #define cmplus(tty,n) \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
150 { \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
151 if ((curX (tty) += (n)) >= FrameCols (tty) && !MagicWrap (tty)) \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
152 { \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
153 if ((tty)->Wcm->cm_losewrap) losecursor (tty); \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
154 else if (AutoWrap (tty)) curX (tty) = 0, curY (tty)++; \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
155 else curX (tty)--; \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
156 } \ |
486 | 157 } |
158 | |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
159 #define losecursor(tty) (curX(tty) = -1, curY(tty) = -1) |
486 | 160 |
161 extern int cost; | |
162 extern int evalcost (); | |
163 | |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
52401
diff
changeset
|
164 #define emacs_tputs(tty, str, affcnt, putc) (current_tty = (tty), tputs (str, affcnt, putc)) |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
52401
diff
changeset
|
165 |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
53340
diff
changeset
|
166 extern struct tty_display_info *current_tty; |
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
53340
diff
changeset
|
167 extern void cmcheckmagic P_ ((struct tty_display_info *)); |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
52401
diff
changeset
|
168 extern int cmputc P_ ((int)); |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
53340
diff
changeset
|
169 extern void cmcostinit P_ ((struct tty_display_info *)); |
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
53340
diff
changeset
|
170 extern void cmgoto P_ ((struct tty_display_info *, int, int)); |
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
53340
diff
changeset
|
171 extern void Wcm_clear P_ ((struct tty_display_info *)); |
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
53340
diff
changeset
|
172 extern int Wcm_init P_ ((struct tty_display_info *)); |
52401 | 173 |
174 /* arch-tag: acc1535a-7136-49d6-b22d-9bc85702251b | |
175 (do not change this comment) */ |