1 /* Cursor motion calculation definitions for XEmacs
2 Copyright (C) 1985, 1989, 1992, 1993 Free Software Foundation, Inc.
4 This file is part of SXEmacs
6 SXEmacs is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 SXEmacs 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.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* Synched up with: FSF 19.30. */
22 /* #### Chuck -- This file should be deleted. I'm not deleting it yet
23 because there might be something you want out of it. */
25 #ifndef INCLUDED_cm_h_
26 #define INCLUDED_cm_h_
28 /* Holds the minimum and maximum costs for the parametrized capabilities. */
33 /* This structure holds everything needed to do cursor motion except the pad
34 character (PC) and the output speed of the terminal (ospeed), which
35 termcap wants in global variables. */
39 /* Cursor position. -1 in *both* variables means the cursor
40 position is unknown, in order to force absolute cursor motion. */
42 int cm_curY; /* Current row */
43 int cm_curX; /* Current column */
45 /* Capabilities from termcap */
46 const char *cm_up; /* up (up) */
47 const char *cm_down; /* down (do) */
48 const char *cm_left; /* left (le) */
49 const char *cm_right; /* right (nd) */
50 const char *cm_home; /* home (ho) */
51 const char *cm_cr; /* carriage return (cr) */
52 const char *cm_ll; /* last line (ll) */
54 const char *cm_tab; /* tab (ta) */
55 const char *cm_backtab; /* backtab (bt) */
57 const char *cm_abs; /* absolute (cm) */
58 const char *cm_habs; /* horizontal absolute (ch) */
59 const char *cm_vabs; /* vertical absolute (cv) */
60 const char *cm_ds; /* "don't send" string (ds) */
61 const char *cm_multiup; /* multiple up (UP) */
62 const char *cm_multidown; /* multiple down (DO) */
63 const char *cm_multileft; /* multiple left (LE) */
64 const char *cm_multiright; /* multiple right (RI) */
65 int cm_cols; /* number of cols on frame (co) */
66 int cm_rows; /* number of rows on frame (li) */
67 int cm_tabwidth; /* tab width (it) */
68 unsigned int cm_autowrap:1; /* autowrap flag (am) */
69 unsigned int cm_magicwrap:1; /* VT-100: cursor stays in last col but
70 will cm_wrap if next char is
72 unsigned int cm_usetabs:1; /* if set, use tabs */
73 unsigned int cm_losewrap:1; /* if reach right margin, forget cursor
75 unsigned int cm_autolf:1; /* \r performs a \r\n (rn) */
78 /* Parametrized capabilities. This needs to be a struct since
79 the costs are accessed through pointers. */
82 struct parmcap cc_abs; /* absolute (cm) */
83 struct parmcap cc_habs; /* horizontal absolute (ch) */
84 struct parmcap cc_vabs; /* vertical absolute (cv) */
85 struct parmcap cc_multiup; /* multiple up (UP) */
86 struct parmcap cc_multidown; /* multiple down (DO) */
87 struct parmcap cc_multileft; /* multiple left (LE) */
88 struct parmcap cc_multiright; /* multiple right (RI) */
92 /* Costs for the non-parametrized capabilities */
93 int cc_up; /* cost for up */
94 int cc_down; /* etc. */
102 /* These are temporary, until the code is installed to use the
103 struct parmcap fields above. */
111 extern struct cm Wcm; /* Terminal capabilities */
112 extern char PC; /* Pad character */
115 #ifndef NoCMShortHand
116 #define curY Wcm.cm_curY
117 #define curX Wcm.cm_curX
119 #define Down Wcm.cm_down
120 #define Left Wcm.cm_left
121 #define Right Wcm.cm_right
122 #define Tab Wcm.cm_tab
123 #define BackTab Wcm.cm_backtab
124 #define TabWidth Wcm.cm_tabwidth
126 #define Home Wcm.cm_home
127 #define LastLine Wcm.cm_ll
128 #define AbsPosition Wcm.cm_abs
129 #define ColPosition Wcm.cm_habs
130 #define RowPosition Wcm.cm_vabs
131 #define MultiUp Wcm.cm_multiup
132 #define MultiDown Wcm.cm_multidown
133 #define MultiLeft Wcm.cm_multileft
134 #define MultiRight Wcm.cm_multiright
135 #define AutoWrap Wcm.cm_autowrap
136 #define MagicWrap Wcm.cm_magicwrap
137 #define UseTabs Wcm.cm_usetabs
138 #define FrameRows Wcm.cm_rows
139 #define FrameCols Wcm.cm_cols
141 #define UpCost Wcm.cc_up
142 #define DownCost Wcm.cc_down
143 #define LeftCost Wcm.cc_left
144 #define RightCost Wcm.cc_right
145 #define HomeCost Wcm.cc_home
146 #define CRCost Wcm.cc_cr
147 #define LastLineCost Wcm.cc_ll
148 #define TabCost Wcm.cc_tab
149 #define BackTabCost Wcm.cc_backtab
150 #define AbsPositionCost Wcm.cc_abs
151 #define ColPositionCost Wcm.cc_habs
152 #define RowPositionCost Wcm.cc_vabs
153 #define MultiUpCost Wcm.cc_multiup
154 #define MultiDownCost Wcm.cc_multidown
155 #define MultiLeftCost Wcm.cc_multileft
156 #define MultiRightCost Wcm.cc_multiright
160 #define cmat(row,col) (curY = (row), curX = (col))
163 if ((curX += (n)) >= FrameCols && !MagicWrap) \
165 if (Wcm.cm_losewrap) losecursor (); \
166 else if (AutoWrap) curX = 0, curY++; \
171 #define losecursor() (curX = -1, curY = -1)
175 void cmcheckmagic(void);
176 void cm_cost_init(struct console *c);
177 void cmgoto(int, int);
178 void Wcm_clear(void);
181 #endif /* INCLUDED_cm_h_ */