|
|
1.1 root 1: /*
2: * $Source: /u1/X/xterm/RCS/tabs.c,v $
3: * $Header: tabs.c,v 10.100 86/12/01 14:45:38 jg Rel $
4: */
5:
6: #ifndef lint
7: static char *rcsid_tabs_c = "$Header: tabs.c,v 10.100 86/12/01 14:45:38 jg Rel $";
8: #endif lint
9:
10: #include <X/mit-copyright.h>
11:
12: /* Copyright Massachusetts Institute of Technology 1984 */
13:
14: /* tabs.c */
15:
16: #ifndef lint
17: /* @(#)tabs.c X10/6.6B 12/26/86 */
18: #endif lint
19:
20: #include <X/Xlib.h>
21: #include "scrollbar.h"
22: #include "ptyx.h"
23: /*
24: * This file presumes 32bits/word. This is somewhat of a crock, and should
25: * be fixed sometime.
26: */
27:
28: /*
29: * places tabstops at only every 8 columns
30: */
31: TabReset(tabs)
32: Tabs tabs;
33: {
34: register int i;
35:
36: for (i=0; i<TAB_ARRAY_SIZE; ++i)
37: tabs[i] = 0;
38:
39: for (i=0; i<MAX_TABS; i+=8)
40: TabSet(tabs, i);
41: }
42:
43:
44: /*
45: * places a tabstop at col
46: */
47: TabSet(tabs, col)
48: Tabs tabs;
49: {
50: tabs[col >> 5] |= (1 << (col & 31));
51: }
52:
53: /*
54: * clears a tabstop at col
55: */
56: TabClear(tabs, col)
57: Tabs tabs;
58: {
59: tabs[col >> 5] &= ~(1 << (col & 31));
60: }
61:
62: /*
63: * returns the column of the next tabstop
64: * (or MAX_TABS - 1 if there are no more).
65: * A tabstop at col is ignored.
66: */
67: TabNext (tabs, col)
68: Tabs tabs;
69: {
70: extern Terminal term;
71: register Screen *screen = &term.screen;
72:
73: if(screen->curses && screen->do_wrap && (term.flags & WRAPAROUND)) {
74: Index(screen, 1);
75: col = screen->cur_col = screen->do_wrap = 0;
76: }
77: for (++col; col<MAX_TABS; ++col)
78: if (tabs[col >> 5] & (1 << (col & 31)))
79: return (col);
80:
81: return (MAX_TABS - 1);
82: }
83:
84: /*
85: * clears all tabs
86: */
87: TabZonk (tabs)
88: Tabs tabs;
89: {
90: register int i;
91:
92: for (i=0; i<TAB_ARRAY_SIZE; ++i)
93: tabs[i] = 0;
94: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.