# 2.11BSD#431 - /usr/src/new/rn/term.h

##### Variables

    BC                X
    CD                X
    CE                X
    CL                X
    CM                X
    COLS              X
    CR                X
    HO                X
    LINES             X
    PC                X
    SE                X
    SG                X
    SO                X
    UC                X
    UE                X
    UG                X
    UP                X
    US                X
    VB                X
    _oldtty           X
    _res_flg          X
    _tty              X
    _tty_ch           X
    circlebuf         X
    devtty            X
    iocount           X
    just_a_sec        X
    lflusho           X
    nextin            X
    nextout           X
    ospeed            X
    page_line         X
    pending_ch        X

##### Macros

    backspace         X
    carriage_return   X
    clear             X
    clear_rest        X
    crmode            X
    dingaling         X
    echo              X
    erase_eol         X
    forceme           X
    input_pending     X
    maybe_eol         X
    nl                X
    nocrmode          X
    noecho            X
    nonl              X
    noraw             X
    raw               X
    read_tty          X
    resetty           X
    savetty           X
    standout          X
    un_standout       X
    un_underline      X
    underchar         X
    underline         X
    unflush_output    X
    up_line           X

       1: /* $Header: term.h,v 4.3.1.2 85/05/13 15:52:05 lwall Exp $
       2:  *
       3:  * $Log:	term.h,v $
       4:  * Revision 4.3.1.2  85/05/13  15:52:05  lwall
       5:  * Declared devtty on TERMIO system.
       6:  *
       7:  * Revision 4.3.1.1  85/05/10  11:41:24  lwall
       8:  * Branch for patches.
       9:  *
      10:  * Revision 4.3  85/05/01  11:51:36  lwall
      11:  * Baseline for release with 4.3bsd.
      12:  *
      13:  */
      14:
      15: #ifdef PUSHBACK
      16: EXT char circlebuf[PUSHSIZE];
      17: EXT int nextin INIT(0);
      18: EXT int nextout INIT(0);
      19: #ifdef PENDING
      20: #ifdef FIONREAD
      21: EXT long iocount INIT(0);
      22: #ifndef lint
      23: #define input_pending() (nextin!=nextout || (ioctl(0, FIONREAD, &iocount),(int)iocount))
      24: #else
      25: #define input_pending() bizarre
      26: #endif lint
      27: #else FIONREAD
      28: int circfill();
      29: EXT int devtty INIT(0);
      30: #ifndef lint
      31: #define input_pending() (nextin!=nextout || circfill())
      32: #else
      33: #define input_pending() bizarre
      34: #endif lint
      35: #endif FIONREAD
      36: #else PENDING
      37: #ifndef lint
      38: #define input_pending() (nextin!=nextout)
      39: #else
      40: #define input_pending() bizarre
      41: #endif lint
      42: #endif PENDING
      43: #else PUSHBACK
      44: #ifdef PENDING
      45: #ifdef FIONREAD /* must have FIONREAD or O_NDELAY for input_pending() */
      46: #define read_tty(addr,size) read(0,addr,size)
      47: #ifndef lint
      48: #define input_pending() (ioctl(0, FIONREAD, &iocount),(int)iocount)
      49: #else
      50: #define input_pending() bizarre
      51: #endif lint
      52: EXT long iocount INIT(0);
      53:
      54: #else FIONREAD
      55:
      56: EXT int devtty INIT(0);
      57: EXT bool is_input INIT(FALSE);
      58: EXT char pending_ch INIT(0);
      59: #ifndef lint
      60: #define input_pending() (is_input || (is_input=read(devtty,&pending_ch,1)))
      61: #else
      62: #define input_pending() bizarre
      63: #endif lint
      64: #endif FIONREAD
      65: #else PENDING
      66: #define read_tty(addr,size) read(0,addr,size)
      67: #define input_pending() (FALSE)
      68: #endif PENDING
      69: #endif PUSHBACK
      70:
      71: /* stuff wanted by terminal mode diddling routines */
      72:
      73: #ifdef TERMIO
      74: EXT struct termio _tty, _oldtty;
      75: #else
      76: EXT struct sgttyb _tty;
      77: EXT int _res_flg INIT(0);
      78: #endif
      79:
      80: EXT int _tty_ch INIT(2);
      81: EXT bool bizarre INIT(FALSE);           /* do we need to restore terminal? */
      82:
      83: /* terminal mode diddling routines */
      84:
      85: #ifdef TERMIO
      86:
      87: #define crmode() ((bizarre=1),_tty.c_lflag &=~ICANON,_tty.c_cc[VMIN] = 1,ioctl(_tty_ch,TCSETAF,&_tty))
      88: #define nocrmode() ((bizarre=1),_tty.c_lflag |= ICANON,_tty.c_cc[VEOF] = CEOF,stty(_tty_ch,&_tty))
      89: #define echo()   ((bizarre=1),_tty.c_lflag |= ECHO, ioctl(_tty_ch, TCSETA, &_tty))
      90: #define noecho() ((bizarre=1),_tty.c_lflag &=~ECHO, ioctl(_tty_ch, TCSETA, &_tty))
      91: #define nl()     ((bizarre=1),_tty.c_iflag |= ICRNL,_tty.c_oflag |= ONLCR,ioctl(_tty_ch, TCSETAW, &_tty))
      92: #define nonl()   ((bizarre=1),_tty.c_iflag &=~ICRNL,_tty.c_oflag &=~ONLCR,ioctl(_tty_ch, TCSETAW, &_tty))
      93: #define savetty() (ioctl(_tty_ch, TCGETA, &_oldtty),ioctl(_tty_ch, TCGETA, &_tty))
      94: #define resetty() ((bizarre=0),ioctl(_tty_ch, TCSETAF, &_oldtty))
      95: #define unflush_output()
      96:
      97: #else
      98:
      99: #define raw()    ((bizarre=1),_tty.sg_flags|=RAW, stty(_tty_ch,&_tty))
     100: #define noraw()  ((bizarre=1),_tty.sg_flags&=~RAW,stty(_tty_ch,&_tty))
     101: #define crmode() ((bizarre=1),_tty.sg_flags |= CBREAK, stty(_tty_ch,&_tty))
     102: #define nocrmode() ((bizarre=1),_tty.sg_flags &= ~CBREAK,stty(_tty_ch,&_tty))
     103: #define echo()   ((bizarre=1),_tty.sg_flags |= ECHO, stty(_tty_ch, &_tty))
     104: #define noecho() ((bizarre=1),_tty.sg_flags &= ~ECHO, stty(_tty_ch, &_tty))
     105: #define nl()     ((bizarre=1),_tty.sg_flags |= CRMOD,stty(_tty_ch, &_tty))
     106: #define nonl()   ((bizarre=1),_tty.sg_flags &= ~CRMOD, stty(_tty_ch, &_tty))
     107: #define savetty() (gtty(_tty_ch, &_tty), _res_flg = _tty.sg_flags)
     108: #define resetty() ((bizarre=0),_tty.sg_flags = _res_flg, stty(_tty_ch, &_tty))
     109: #ifdef LFLUSHO
     110: #ifndef lint
     111: EXT int lflusho INIT(LFLUSHO);
     112: #else
     113: EXT long lflusho INIT(LFLUSHO);
     114: #endif lint
     115: #define unflush_output() (ioctl(_tty_ch,TIOCLBIC,&lflusho))
     116: #else
     117: #define unflush_output()
     118: #endif LFLUSHO
     119: #endif TERMIO
     120:
     121: #ifdef TIOCSTI
     122: #ifdef lint
     123: #define forceme(c) ioctl(_tty_ch,TIOCSTI,Null(long*))   /* ghad! */
     124: #else
     125: #define forceme(c) ioctl(_tty_ch,TIOCSTI,c) /* pass character in " " */
     126: #endif lint
     127: #else
     128: #define forceme(c)
     129: #endif
     130:
     131: /* termcap stuff */
     132:
     133: /*
     134:  * NOTE: if you don't have termlib you'll either have to define these strings
     135:  *    and the tputs routine, or you'll have to redefine the macros below
     136:  */
     137:
     138: #ifdef HAVETERMLIB
     139: EXT char *BC INIT(Nullch);      /* backspace character */
     140: EXT char *UP INIT(Nullch);      /* move cursor up one line */
     141: EXT char *CR INIT(Nullch);      /* get to left margin, somehow */
     142: EXT char *VB INIT(Nullch);      /* visible bell */
     143: EXT char *CL INIT(Nullch);      /* home and clear screen */
     144: EXT char *CE INIT(Nullch);      /* clear to end of line */
     145: #ifdef CLEAREOL
     146: EXT char *CM INIT(Nullch);      /* cursor motion -- PWP */
     147: EXT char *HO INIT(Nullch);      /* home cursor -- PWP */
     148: EXT char *CD INIT(Nullch);      /* clear to end of display -- PWP */
     149: #endif CLEAREOL
     150: EXT char *SO INIT(Nullch);      /* begin standout mode */
     151: EXT char *SE INIT(Nullch);      /* end standout mode */
     152: EXT int SG INIT(0);     /* blanks left by SO and SE */
     153: EXT char *US INIT(Nullch);      /* start underline mode */
     154: EXT char *UE INIT(Nullch);      /* end underline mode */
     155: EXT char *UC INIT(Nullch);      /* underline a character, if that's how it's done */
     156: EXT int UG INIT(0);     /* blanks left by US and UE */
     157: EXT bool AM INIT(FALSE);        /* does terminal have automatic margins? */
     158: EXT bool XN INIT(FALSE);        /* does it eat 1st newline after automatic wrap? */
     159: EXT char PC INIT(0);        /* pad character for use by tputs() */
     160: EXT short ospeed INIT(0);   /* terminal output speed, for use by tputs() */
     161: EXT int LINES INIT(0), COLS INIT(0);    /* size of screen */
     162: EXT int just_a_sec INIT(960);           /* 1 sec at current baud rate */
     163:                     /* (number of nulls) */
     164:
     165: /* define a few handy macros */
     166:
     167: #define backspace() tputs(BC,0,putchr) FLUSH
     168: #define clear() tputs(CL,LINES,putchr) FLUSH
     169: #define erase_eol() tputs(CE,1,putchr) FLUSH
     170: #ifdef CLEAREOL
     171: #define clear_rest() tputs(CD,LINES,putchr) FLUSH   /* PWP */
     172: #define maybe_eol() if(erase_screen&&can_home_clear)tputs(CE,1,putchr) FLUSH
     173: #endif CLEAREOL
     174: #define underline() tputs(US,1,putchr) FLUSH
     175: #define un_underline() tputs(UE,1,putchr) FLUSH
     176: #define underchar() tputs(UC,0,putchr) FLUSH
     177: #define standout() tputs(SO,1,putchr) FLUSH
     178: #define un_standout() tputs(SE,1,putchr) FLUSH
     179: #define up_line() tputs(UP,1,putchr) FLUSH
     180: #define carriage_return() tputs(CR,1,putchr) FLUSH
     181: #define dingaling() tputs(VB,1,putchr) FLUSH
     182: #else
     183:   ????????      /* up to you */
     184: #endif
     185:
     186: EXT int page_line INIT(1);  /* line number for paging in print_line (origin 1) */
     187:
     188: void    term_init();
     189: void    term_set();
     190: #ifdef PUSHBACK
     191: void    pushchar();
     192: void    mac_init();
     193: void    mac_line();
     194: void    show_macros();
     195: #endif
     196: char    putchr();   /* routine for tputs to call */
     197: bool    finish_command();
     198: void    eat_typeahead();
     199: void    settle_down();
     200: #ifndef read_tty
     201:     int     read_tty();
     202: #endif
     203: void    underprint();
     204: #ifdef NOFIREWORKS
     205:     void    no_sofire();
     206:     void    no_ulfire();
     207: #endif
     208: void    getcmd();
     209: int get_anything();
     210: void    in_char();
     211: int print_lines();
     212: void    page_init();
     213: void    pad();
     214: void    printcmd();
     215: void    rubout();
     216: void    reprint();
     217: #ifdef CLEAREOL
     218: void    home_cursor();
     219: #endif CLEAREOL

#### Defined variables

BC defined in line 139; used 5 times

- in line 167
- in /usr/src/new/rn/term.c line 154-158(4)

CD defined in line 148; used 3 times

- in line 171
- in /usr/src/new/rn/term.c line 170-171(2)

CE defined in line 144; used 4 times

- in line 169-172(2)
- in /usr/src/new/rn/term.c line 166-171(2)

CL defined in line 143; used 4 times

- in line 168
- in /usr/src/new/rn/term.c line 163-165(2), 231

CM defined in line 146; used 4 times

- in /usr/src/new/rn/term.c line 168-171(2), 1026-1030(2)

COLS defined in line 161; used 10 times

- in /usr/src/new/rn/art.c line 248-250(2), 305, 378
- in /usr/src/new/rn/term.c line 192, 198, 235-236(2), 917, 941

CR defined in line 141; used 6 times

- in line 180
- in /usr/src/new/rn/term.c line 208-215(5)

HO defined in line 147; used 4 times

- in /usr/src/new/rn/term.c line 169-171(2), 1025, 1034

LINES defined in line 161; used 20 times

- in line 168-171(2)
- in /usr/src/new/rn/art.c line 178, 473-475(2), 529, 541, 588, 633-634(2), 743
- in /usr/src/new/rn/ng.c line 469, 948
- in /usr/src/new/rn/term.c line 191, 197, 220-223(2), 230, 848, 896

PC defined in line 159; used 3 times

- in /usr/src/new/rn/ng.c line 350
- in /usr/src/new/rn/term.c line 152, 967

SE defined in line 151; used 4 times

- in line 178
- in /usr/src/new/rn/term.c line 175, 188, 692

SG defined in line 152; used 3 times

- in /usr/src/new/rn/term.c line 176-177(2), 189

SO defined in line 150; used 3 times

- in line 177
- in /usr/src/new/rn/term.c line 174, 187

UC defined in line 155; used 8 times

- in line 176
- in /usr/src/new/rn/art.c line 357, 416
- in /usr/src/new/rn/term.c line 183-186(3), 652-653(2)

UE defined in line 154; used 3 times

- in line 175
- in /usr/src/new/rn/term.c line 179, 188

UG defined in line 156; used 7 times

- in /usr/src/new/rn/art.c line 248, 260, 317, 333
- in /usr/src/new/rn/term.c line 180-181(2), 189

UP defined in line 140; used 8 times

- in line 179
- in /usr/src/new/rn/term.c line 159-160(2), 210-212(3), 692, 703

US defined in line 153; used 6 times

- in line 174
- in /usr/src/new/rn/term.c line 178-187(4), 703

VB defined in line 142; used 4 times

- in line 181
- in /usr/src/new/rn/term.c line 205-207(3)

_oldtty defined in line 74; used 2 times

- in line 93-94(2)

_res_flg defined in line 77; used 2 times

- in line 107-108(2)

_tty defined in line 76; used 44 times

- in line 87-93(17), 99-108(20)
- in /usr/src/new/rn/term.c line 74-80(6), 550

_tty_ch defined in line 80; used 23 times

- in line 87-108(19), 115, 123-125(2)
- in /usr/src/new/rn/term.c line 550

circlebuf defined in line 16; used 3 times

- in /usr/src/new/rn/term.c line 576, 594, 616

devtty defined in line 56; used 5 times

- in line 60
- in /usr/src/new/rn/term.c line 129-134(3), 594

iocount defined in line 52; used 4 times

- in line 23(2), 48(2)

just_a_sec defined in line 162; used 24 times

- in /usr/src/new/rn/ng.c line 349, 652, 691, 701
- in /usr/src/new/rn/ngstuff.c line 163, 181
- in /usr/src/new/rn/sw.c line 164-165(2)
- in /usr/src/new/rn/term.c line 88-108(16)

lflusho defined in line 113; used 1 times

- in line 115

nextin defined in line 17; used 11 times

- in line 23, 31, 38
- in /usr/src/new/rn/term.c line 541, 562, 575, 594-598(3), 612, 727

nextout defined in line 18; used 14 times

- in line 23, 31, 38
- in /usr/src/new/rn/term.c line 541, 562, 575-577(3), 609-616(5), 727

ospeed defined in line 160; used 5 times

- in /usr/src/new/rn/term.c line 74-78(2), 86, 222-224(2)

page_line defined in line 186; used 7 times

- in /usr/src/new/rn/term.c line 848-853(2), 893-902(4), 953

pending_ch defined in line 58; used 2 times

- in line 60
- in /usr/src/new/rn/term.c line 629

#### Defined macros

backspace defined in line 167; used 13 times

- in /usr/src/new/rn/art.c line 321, 362, 417-420(2)
- in /usr/src/new/rn/term.c line 520, 657-665(3), 981-986(3), 996-998(2)

carriage_return defined in line 180; used 7 times

- in /usr/src/new/rn/art.c line 547, 625
- in /usr/src/new/rn/term.c line 696, 707, 843, 849, 857

clear defined in line 168; used 13 times

- in /usr/src/new/rn/art.c line 719, 734-739(2), 830-835(2)
- in /usr/src/new/rn/kfile.c line 157
- in /usr/src/new/rn/ng.c line 288, 340, 412, 934, 946
- in /usr/src/new/rn/term.c line 855, 955

clear_rest defined in line 171; used 2 times

- in /usr/src/new/rn/art.c line 552
- in /usr/src/new/rn/ng.c line 451

crmode defined in line 101; used 9 times

- in /usr/src/new/rn/final.c line 221
- in /usr/src/new/rn/intrp.c line 496
- in /usr/src/new/rn/kfile.c line 223
- in /usr/src/new/rn/ngstuff.c line 65
- in /usr/src/new/rn/respond.c line 95, 237, 415
- in /usr/src/new/rn/rn.c line 452
- in /usr/src/new/rn/term.c line 238

dingaling defined in line 181; used 3 times

- in /usr/src/new/rn/rcstuff.c line 267, 293
- in /usr/src/new/rn/term.c line 558

echo defined in line 103; never used
erase_eol defined in line 169; used 6 times

- in /usr/src/new/rn/art.c line 549-554(2), 626
- in /usr/src/new/rn/term.c line 844, 850, 858

forceme defined in line 128; used 1 times

- in /usr/src/new/rn/final.c line 222

input_pending defined in line 67; used 4 times

- in /usr/src/new/rn/cheat.c line 97, 128
- in /usr/src/new/rn/ng.c line 463
- in /usr/src/new/rn/term.c line 547

maybe_eol defined in line 172; used 4 times

- in /usr/src/new/rn/art.c line 137, 147, 256, 298

nl defined in line 105; never used
nocrmode defined in line 102; never used
noecho defined in line 104; used 9 times

- in /usr/src/new/rn/final.c line 220
- in /usr/src/new/rn/intrp.c line 495
- in /usr/src/new/rn/kfile.c line 222
- in /usr/src/new/rn/ngstuff.c line 64
- in /usr/src/new/rn/respond.c line 94, 236, 414
- in /usr/src/new/rn/rn.c line 451
- in /usr/src/new/rn/term.c line 237

nonl defined in line 106; never used
noraw defined in line 100; never used
raw defined in line 99; never used
read_tty defined in line 66; used 7 times

- in line 200-201(2)
- in /usr/src/new/rn/term.c line 443, 548, 620, 732, 746

resetty defined in line 108; used 9 times

- in /usr/src/new/rn/final.c line 61, 190
- in /usr/src/new/rn/intrp.c line 493
- in /usr/src/new/rn/kfile.c line 220
- in /usr/src/new/rn/ngstuff.c line 62
- in /usr/src/new/rn/respond.c line 88, 226, 412
- in /usr/src/new/rn/rn.c line 440

savetty defined in line 107; used 2 times

- in /usr/src/new/rn/final.c line 210
- in /usr/src/new/rn/term.c line 71

standout defined in line 177; used 8 times

- in /usr/src/new/rn/art.c line 278, 379, 516, 810
- in /usr/src/new/rn/kfile.c line 62
- in /usr/src/new/rn/ng.c line 454
- in /usr/src/new/rn/term.c line 809, 908

un_standout defined in line 178; used 9 times

- in /usr/src/new/rn/art.c line 381, 467, 518, 813
- in /usr/src/new/rn/kfile.c line 64
- in /usr/src/new/rn/ng.c line 456
- in /usr/src/new/rn/term.c line 694, 818, 938

un_underline defined in line 175; used 6 times

- in /usr/src/new/rn/art.c line 332, 374, 469
- in /usr/src/new/rn/term.c line 682, 705, 940

underchar defined in line 176; used 6 times

- in /usr/src/new/rn/art.c line 363, 418-421(2)
- in /usr/src/new/rn/term.c line 658-666(3)

underline defined in line 174; used 4 times

- in /usr/src/new/rn/art.c line 285, 324
- in /usr/src/new/rn/term.c line 672, 915

unflush_output defined in line 117; used 6 times

- in /usr/src/new/rn/art.c line 515
- in /usr/src/new/rn/ng.c line 453
- in /usr/src/new/rn/rcstuff.c line 516
- in /usr/src/new/rn/rn.c line 199
- in /usr/src/new/rn/term.c line 808, 872

up_line defined in line 179; used 4 times

- in /usr/src/new/rn/art.c line 595, 861
- in /usr/src/new/rn/term.c line 695, 706

#### Usage of this include

term.h used 16 times

- in /usr/src/new/rn/art.c line 38
- in /usr/src/new/rn/artsrch.c line 12
- in /usr/src/new/rn/cheat.c line 16
- in /usr/src/new/rn/final.c line 12
- in /usr/src/new/rn/help.c line 18
- in /usr/src/new/rn/init.c line 25
- in /usr/src/new/rn/intrp.c line 37
- in /usr/src/new/rn/kfile.c line 20
- in /usr/src/new/rn/ng.c line 30
- in /usr/src/new/rn/ngsrch.c line 16
- in /usr/src/new/rn/ngstuff.c line 17
- in /usr/src/new/rn/rcstuff.c line 28
- in /usr/src/new/rn/respond.c line 28
- in /usr/src/new/rn/rn.c line 36
- in /usr/src/new/rn/sw.c line 20
- in /usr/src/new/rn/term.c line 27

Last modified: 1987-03-16 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1227 |