|
|
1.1 root 1: /*
2: * $Source: /u1/X11/clients/xterm/RCS/tabs.c,v $
3: * $Header: tabs.c,v 1.5 87/09/11 08:17:35 toddb Exp $
4: */
5:
6: #ifndef lint
7: static char *rcsid_tabs_c = "$Header: tabs.c,v 1.5 87/09/11 08:17:35 toddb Exp $";
8: #endif lint
9:
10: #include <X11/copyright.h>
11:
12: /*
13: * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
14: *
15: * All Rights Reserved
16: *
17: * Permission to use, copy, modify, and distribute this software and its
18: * documentation for any purpose and without fee is hereby granted,
19: * provided that the above copyright notice appear in all copies and that
20: * both that copyright notice and this permission notice appear in
21: * supporting documentation, and that the name of Digital Equipment
22: * Corporation not be used in advertising or publicity pertaining to
23: * distribution of the software without specific, written prior permission.
24: *
25: *
26: * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
27: * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
28: * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
29: * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30: * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
31: * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
32: * SOFTWARE.
33: */
34:
35: /* tabs.c */
36:
37: #ifndef lint
38: static char rcs_id[] = "$Header: tabs.c,v 1.5 87/09/11 08:17:35 toddb Exp $";
39: #endif lint
40:
41: #include <X11/Xlib.h>
42: #include "ptyx.h"
43: /*
44: * This file presumes 32bits/word. This is somewhat of a crock, and should
45: * be fixed sometime.
46: */
47:
48: /*
49: * places tabstops at only every 8 columns
50: */
51: TabReset(tabs)
52: Tabs tabs;
53: {
54: register int i;
55:
56: for (i=0; i<TAB_ARRAY_SIZE; ++i)
57: tabs[i] = 0;
58:
59: for (i=0; i<MAX_TABS; i+=8)
60: TabSet(tabs, i);
61: }
62:
63:
64: /*
65: * places a tabstop at col
66: */
67: TabSet(tabs, col)
68: Tabs tabs;
69: {
70: tabs[col >> 5] |= (1 << (col & 31));
71: }
72:
73: /*
74: * clears a tabstop at col
75: */
76: TabClear(tabs, col)
77: Tabs tabs;
78: {
79: tabs[col >> 5] &= ~(1 << (col & 31));
80: }
81:
82: /*
83: * returns the column of the next tabstop
84: * (or MAX_TABS - 1 if there are no more).
85: * A tabstop at col is ignored.
86: */
87: TabNext (tabs, col)
88: Tabs tabs;
89: {
90: extern Terminal term;
91: register TScreen *screen = &term.screen;
92:
93: if(screen->curses && screen->do_wrap && (term.flags & WRAPAROUND)) {
94: Index(screen, 1);
95: col = screen->cur_col = screen->do_wrap = 0;
96: }
97: for (++col; col<MAX_TABS; ++col)
98: if (tabs[col >> 5] & (1 << (col & 31)))
99: return (col);
100:
101: return (MAX_TABS - 1);
102: }
103:
104: /*
105: * clears all tabs
106: */
107: TabZonk (tabs)
108: Tabs tabs;
109: {
110: register int i;
111:
112: for (i=0; i<TAB_ARRAY_SIZE; ++i)
113: tabs[i] = 0;
114: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.