Annotation of 43BSD/contrib/X/xterm/tabs.c, revision 1.1.1.1

1.1       root        1: #include <X/mit-copyright.h>
                      2: 
                      3: /* Copyright    Massachusetts Institute of Technology    1984  */
                      4: 
                      5: /* tabs.c */
                      6: 
                      7: #ifndef lint
                      8: static char *rcsid_tabs_c = "$Header: tabs.c,v 10.7 86/02/01 16:07:10 tony Rel $";
                      9: #endif lint
                     10: 
                     11: #include <X/Xlib.h>
                     12: #include "ptyx.h"
                     13: /*
                     14:  * This file presumes 32bits/word.  This is somewhat of a crock, and should
                     15:  * be fixed sometime.
                     16:  */
                     17: 
                     18: /*
                     19:  * places tabstops at only every 8 columns
                     20:  */
                     21: TabReset(tabs)
                     22: Tabs   tabs;
                     23: {
                     24:        register int i;
                     25: 
                     26:        for (i=0; i<TAB_ARRAY_SIZE; ++i)
                     27:                tabs[i] = 0;
                     28: 
                     29:        for (i=0; i<MAX_TABS; i+=8)
                     30:                TabSet(tabs, i);
                     31: }      
                     32: 
                     33: 
                     34: /*
                     35:  * places a tabstop at col
                     36:  */
                     37: TabSet(tabs, col)
                     38: Tabs   tabs;
                     39: {
                     40:        tabs[col >> 5] |= (1 << (col & 31));
                     41: }
                     42: 
                     43: /*
                     44:  * clears a tabstop at col
                     45:  */
                     46: TabClear(tabs, col)
                     47: Tabs   tabs;
                     48: {
                     49:        tabs[col >> 5] &= ~(1 << (col & 31));
                     50: }
                     51: 
                     52: /*
                     53:  * returns the column of the next tabstop
                     54:  * (or MAX_TABS - 1 if there are no more).
                     55:  * A tabstop at col is ignored.
                     56:  */
                     57: TabNext (tabs, col)
                     58: Tabs   tabs;
                     59: {
                     60:        for (++col; col<MAX_TABS; ++col)
                     61:                if (tabs[col >> 5] & (1 << (col & 31)))
                     62:                        return (col);
                     63: 
                     64:        return (MAX_TABS - 1);
                     65: }
                     66: 
                     67: /*
                     68:  * clears all tabs
                     69:  */
                     70: TabZonk (tabs)
                     71: Tabs   tabs;
                     72: {
                     73:        register int i;
                     74: 
                     75:        for (i=0; i<TAB_ARRAY_SIZE; ++i)
                     76:                tabs[i] = 0;
                     77: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.