(Vafter_change_functions, Vbefore_change_functions): Declared.
[bpt/emacs.git] / src / cm.h
CommitLineData
9889c728
JB
1/* Cursor motion calculation definitions for GNU Emacs
2 Copyright (C) 1985, 1989 Free Software Foundation, Inc.
3
4This file is part of GNU Emacs.
5
6GNU Emacs is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 1, or (at your option)
9any later version.
10
11GNU Emacs is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Emacs; see the file COPYING. If not, write to
18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20/* Holds the minimum and maximum costs for the parametrized capabilities. */
21struct parmcap
22 {
23 int mincost, maxcost;
24 };
25
26/* This structure holds everything needed to do cursor motion except the pad
27 character (PC) and the output speed of the terminal (ospeed), which
28 termcap wants in global variables. */
29
30struct cm
31 {
32 /* Cursor position. -1 in *both* variables means the cursor
33 position is unknown, in order to force absolute cursor motion. */
34
35 int cm_curY; /* Current row */
36 int cm_curX; /* Current column */
37
38 /* Capabilities from termcap */
39 char *cm_up; /* up (up) */
40 char *cm_down; /* down (do) */
41 char *cm_left; /* left (le) */
42 char *cm_right; /* right (nd) */
43 char *cm_home; /* home (ho) */
44 char *cm_cr; /* carriage return (cr) */
45 char *cm_ll; /* last line (ll) */
46 char *cm_tab; /* tab (ta) */
47 char *cm_backtab; /* backtab (bt) */
48 char *cm_abs; /* absolute (cm) */
49 char *cm_habs; /* horizontal absolute (ch) */
50 char *cm_vabs; /* vertical absolute (cv) */
51#if 0
52 char *cm_ds; /* "don't send" string (ds) */
53#endif
54 char *cm_multiup; /* multiple up (UP) */
55 char *cm_multidown; /* multiple down (DO) */
56 char *cm_multileft; /* multiple left (LE) */
57 char *cm_multiright; /* multiple right (RI) */
58 int cm_cols; /* number of cols on screen (co) */
59 int cm_rows; /* number of rows on screen (li) */
60 int cm_tabwidth; /* tab width (it) */
61 unsigned int cm_autowrap:1; /* autowrap flag (am) */
62 unsigned int cm_magicwrap:1; /* VT-100: cursor stays in last col but
63 will cm_wrap if next char is
64 printing (xn) */
65 unsigned int cm_usetabs:1; /* if set, use tabs */
66 unsigned int cm_losewrap:1; /* if reach right margin, forget cursor
67 location */
68 unsigned int cm_autolf:1; /* \r performs a \r\n (rn) */
69
70 /* Parametrized capabilities. This needs to be a struct since
71 the costs are accessed through pointers. */
72
73#if 0
74 struct parmcap cc_abs; /* absolute (cm) */
75 struct parmcap cc_habs; /* horizontal absolute (ch) */
76 struct parmcap cc_vabs; /* vertical absolute (cv) */
77 struct parmcap cc_multiup; /* multiple up (UP) */
78 struct parmcap cc_multidown; /* multiple down (DO) */
79 struct parmcap cc_multileft; /* multiple left (LE) */
80 struct parmcap cc_multiright; /* multiple right (RI) */
81#endif
82
83 /* Costs for the non-parametrized capabilities */
84 int cc_up; /* cost for up */
85 int cc_down; /* etc. */
86 int cc_left;
87 int cc_right;
88 int cc_home;
89 int cc_cr;
90 int cc_ll;
91 int cc_tab;
92 int cc_backtab;
93 /* These are temporary, until the code is installed to use the
94 struct parmcap fields above. */
95 int cc_abs;
96 int cc_habs;
97 int cc_vabs;
98 };
99
100extern struct cm Wcm; /* Terminal capabilities */
101extern char PC; /* Pad character */
102extern short ospeed; /* Output speed (from sg_ospeed) */
103
104/* Shorthand */
105#ifndef NoCMShortHand
106#define curY Wcm.cm_curY
107#define curX Wcm.cm_curX
108#define Up Wcm.cm_up
109#define Down Wcm.cm_down
110#define Left Wcm.cm_left
111#define Right Wcm.cm_right
112#define Tab Wcm.cm_tab
113#define BackTab Wcm.cm_backtab
114#define TabWidth Wcm.cm_tabwidth
115#define CR Wcm.cm_cr
116#define Home Wcm.cm_home
117#define LastLine Wcm.cm_ll
118#define AbsPosition Wcm.cm_abs
119#define ColPosition Wcm.cm_habs
120#define RowPosition Wcm.cm_vabs
121#define MultiUp Wcm.cm_multiup
122#define MultiDown Wcm.cm_multidown
123#define MultiLeft Wcm.cm_multileft
124#define MultiRight Wcm.cm_multiright
125#define AutoWrap Wcm.cm_autowrap
126#define MagicWrap Wcm.cm_magicwrap
127#define UseTabs Wcm.cm_usetabs
e6dd9901
JB
128#define FrameRows Wcm.cm_rows
129#define FrameCols Wcm.cm_cols
9889c728
JB
130
131#define UpCost Wcm.cc_up
132#define DownCost Wcm.cc_down
133#define LeftCost Wcm.cc_left
134#define RightCost Wcm.cc_right
135#define HomeCost Wcm.cc_home
136#define CRCost Wcm.cc_cr
137#define LastLineCost Wcm.cc_ll
138#define TabCost Wcm.cc_tab
139#define BackTabCost Wcm.cc_backtab
140#define AbsPositionCost Wcm.cc_abs
141#define ColPositionCost Wcm.cc_habs
142#define RowPositionCost Wcm.cc_vabs
143#define MultiUpCost Wcm.cc_multiup
144#define MultiDownCost Wcm.cc_multidown
145#define MultiLeftCost Wcm.cc_multileft
146#define MultiRightCost Wcm.cc_multiright
147#endif
148
149#define cmat(row,col) (curY = (row), curX = (col))
150#define cmplus(n) \
151 { \
e6dd9901 152 if ((curX += (n)) >= FrameCols && !MagicWrap) \
9889c728
JB
153 { \
154 if (Wcm.cm_losewrap) losecursor (); \
155 else if (AutoWrap) curX = 0, curY++; \
156 else curX--; \
157 } \
158 }
159
160#define losecursor() (curX = -1, curY = -1)
161
162extern int cost;
163extern int evalcost ();
164
165extern void cmputc ();
166extern int cmcostinit ();
167extern int cmgoto ();
168extern int Wcm_clear ();
169extern int Wcm_init ();