|
|
1.1 ! root 1: /* Cursor motion calculation definitions for GNU Emacs ! 2: Copyright (C) 1985 Richard M. Stallman. ! 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: cm_autowrap:1, /* autowrap flag (am) */ ! 48: cm_magicwrap:1, /* vt100s: cursor stays in last col but ! 49: will wrap if next char is printing (xn) */ ! 50: cm_usetabs:1, /* if set, use tabs */ ! 51: cm_autolf:1, /* \r performs a \r\n (rn) */ ! 52: cm_losewrap:1; /* if reach right margin, forget cursor location */ ! 53: /* Costs */ ! 54: int cc_up, /* cost for up */ ! 55: cc_down, /* etc */ ! 56: cc_left, ! 57: cc_right, ! 58: cc_home, ! 59: cc_cr, ! 60: cc_ll, ! 61: cc_abs, /* abs costs are actually min costs */ ! 62: cc_habs, ! 63: cc_vabs, ! 64: cc_tab; ! 65: } Wcm; ! 66: ! 67: extern char PC; /* Pad character */ ! 68: extern short ospeed; /* Output speed (from sg_ospeed) */ ! 69: ! 70: /* Shorthand */ ! 71: #ifndef NoCMShortHand ! 72: #define curY Wcm.cm_curY ! 73: #define curX Wcm.cm_curX ! 74: #define Up Wcm.cm_up ! 75: #define Down Wcm.cm_down ! 76: #define Left Wcm.cm_left ! 77: #define Right Wcm.cm_right ! 78: #define Home Wcm.cm_home ! 79: #define CR Wcm.cm_cr ! 80: #define LastLine Wcm.cm_ll ! 81: #define Tab Wcm.cm_tab ! 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.