|
|
1.1 root 1: /* Cursor motion calculation definitions for GNU Emacs
2: Copyright (C) 1985 Free Software Foundation, Inc.
3:
4: This file is part of GNU Emacs.
5:
6: GNU Emacs is distributed in the hope that it will be useful,
7: but WITHOUT ANY WARRANTY. No author or distributor
8: accepts responsibility to anyone for the consequences of using it
9: or for whether it serves any particular purpose or works at all,
10: unless he says so in writing. Refer to the GNU Emacs General Public
11: License for full details.
12:
13: Everyone is granted permission to copy, modify and redistribute
14: GNU Emacs, but only under the conditions described in the
15: GNU Emacs General Public License. A copy of this license is
16: supposed to have been given to you along with GNU Emacs so you
17: can know your rights and responsibilities. It should be in a
18: file named COPYING. Among other things, the copyright notice
19: and this notice must be preserved on all copies. */
20:
21:
22: /* This structure holds everything needed to do cursor motion except the pad
23: character (PC) and the output speed of the terminal (ospeed), which
24: termcap wants in global variables. */
25:
26: extern struct cm {
27: /* Cursor position */
28: int cm_curY, /* current row */
29: cm_curX; /* current column */
30: /* -1 in either one means position unknown */
31: /* Capabilities from termcap(5) (including extensions) */
32: char *cm_up, /* up (up) */
33: *cm_down, /* down (do) */
34: *cm_left, /* left (bs) */
35: *cm_right, /* right (nd) */
36: *cm_home, /* home (ho) */
37: *cm_cr, /* carriage return (cr) */
38: *cm_ll, /* last line (ll) */
39: *cm_abs, /* absolute (cm) */
40: *cm_habs, /* horizontal absolute (ch) */
41: *cm_vabs, /* vertical absolute (cv) */
42: *cm_ds, /* "don't send" string (ds) */
43: *cm_tab; /* tab (ta) */
44: int cm_tabwidth, /* tab width (tw) */
45: cm_cols, /* Number of cols on screen (co) */
46: cm_rows; /* Number of rows on screen (li) */
47: unsigned int
48: cm_autowrap:1, /* autowrap flag (am) */
49: cm_magicwrap:1, /* vt100s: cursor stays in last col but
50: will wrap if next char is printing (xn) */
51: cm_usetabs:1, /* if set, use tabs */
52: cm_autolf:1, /* \r performs a \r\n (rn) */
53: cm_losewrap:1; /* if reach right margin, forget cursor location */
54: /* Costs */
55: int cc_up, /* cost for up */
56: cc_down, /* etc */
57: cc_left,
58: cc_right,
59: cc_home,
60: cc_cr,
61: cc_ll,
62: cc_abs, /* abs costs are actually min costs */
63: cc_habs,
64: cc_vabs,
65: cc_tab;
66: } Wcm;
67:
68: extern char PC; /* Pad character */
69: extern short ospeed; /* Output speed (from sg_ospeed) */
70:
71: /* Shorthand */
72: #ifndef NoCMShortHand
73: #define curY Wcm.cm_curY
74: #define curX Wcm.cm_curX
75: #define Up Wcm.cm_up
76: #define Down Wcm.cm_down
77: #define Left Wcm.cm_left
78: #define Right Wcm.cm_right
79: #define Home Wcm.cm_home
80: #define CR Wcm.cm_cr
81: #define LastLine Wcm.cm_ll
82: #define TabWidth Wcm.cm_tabwidth
83: #define DontSend Wcm.cm_ds
84: #define AbsPosition Wcm.cm_abs
85: #define ColPosition Wcm.cm_habs
86: #define RowPosition Wcm.cm_vabs
87: #define AutoWrap Wcm.cm_autowrap
88: #define MagicWrap Wcm.cm_magicwrap
89: #define UseTabs Wcm.cm_usetabs
90: #define AutoLF Wcm.cm_autolf
91: #define ScreenRows Wcm.cm_rows
92: #define ScreenCols Wcm.cm_cols
93:
94: #define cmat(row,col) (curY = (row), curX = (col))
95: #define cmplus(n) {if ((curX += (n)) >= ScreenCols && !MagicWrap)\
96: {if (Wcm.cm_losewrap) curY = -1; \
97: else if (AutoWrap) curX = 0, curY++; else curX--;}}
98:
99: extern void cmputc ();
100:
101: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.