More warning suppressions
[sxemacs] / src / ui / TTY / cm.h
1 /* Cursor motion calculation definitions for XEmacs
2    Copyright (C) 1985, 1989, 1992, 1993 Free Software Foundation, Inc.
3
4 This file is part of SXEmacs
5
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.
10
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.
15
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/>. */
18
19
20 /* Synched up with: FSF 19.30. */
21
22 /* #### Chuck -- This file should be deleted.  I'm not deleting it yet
23    because there might be something you want out of it. */
24
25 #ifndef INCLUDED_cm_h_
26 #define INCLUDED_cm_h_
27
28 /* Holds the minimum and maximum costs for the parametrized capabilities.  */
29 struct parmcap {
30         int mincost, maxcost;
31 };
32
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.  */
36
37 struct cm {
38 #if 0
39         /* Cursor position.  -1 in *both* variables means the cursor
40            position is unknown, in order to force absolute cursor motion. */
41
42         int cm_curY;            /* Current row */
43         int cm_curX;            /* Current column */
44
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) */
53 #endif                          /* 0 */
54         const char *cm_tab;     /* tab (ta) */
55         const char *cm_backtab; /* backtab (bt) */
56 #if 0
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
71                                            printing (xn) */
72         unsigned int cm_usetabs:1;      /* if set, use tabs */
73         unsigned int cm_losewrap:1;     /* if reach right margin, forget cursor
74                                            location */
75         unsigned int cm_autolf:1;       /* \r performs a \r\n (rn) */
76 #endif
77
78         /* Parametrized capabilities.  This needs to be a struct since
79            the costs are accessed through pointers.  */
80
81 #if 0
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) */
89 #endif
90
91 #if 0
92         /* Costs for the non-parametrized capabilities */
93         int cc_up;              /* cost for up */
94         int cc_down;            /* etc. */
95         int cc_left;
96         int cc_right;
97         int cc_home;
98         int cc_cr;
99         int cc_ll;
100         int cc_tab;
101         int cc_backtab;
102         /* These are temporary, until the code is installed to use the
103            struct parmcap fields above.  */
104         int cc_abs;
105         int cc_habs;
106         int cc_vabs;
107 #endif
108 };
109
110 #if 0
111 extern struct cm Wcm;           /* Terminal capabilities */
112 extern char PC;                 /* Pad character */
113
114 /* Shorthand */
115 #ifndef NoCMShortHand
116 #define curY            Wcm.cm_curY
117 #define curX            Wcm.cm_curX
118 #define Up              Wcm.cm_up
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
125 #define CR              Wcm.cm_cr
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
140
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
157 #endif
158 #endif                          /* 0 */
159
160 #define cmat(row,col)   (curY = (row), curX = (col))
161 #define cmplus(n)                                       \
162   {                                                     \
163     if ((curX += (n)) >= FrameCols && !MagicWrap)       \
164       {                                                 \
165         if (Wcm.cm_losewrap) losecursor ();             \
166         else if (AutoWrap) curX = 0, curY++;            \
167         else curX--;                                    \
168       }                                                 \
169   }
170
171 #define losecursor()    (curX = -1, curY = -1)
172
173 extern int cost;
174 void cmputc(int c);
175 void cmcheckmagic(void);
176 void cm_cost_init(struct console *c);
177 void cmgoto(int, int);
178 void Wcm_clear(void);
179 int Wcm_init(void);
180
181 #endif                          /* INCLUDED_cm_h_ */