maketerm.ed revision 2
2N/AH
2N/A!rm -f bool num str boolnames numnames strnames boolvals numvals strvals tnames.c tinames.c tifnames.c term.h ./tmp/term.h.new ./tmp/tmp.awk ./tmp/term.h
2N/Ae caps
2N/Ag/^#/d
2N/A/--- begin bool/+1,/--- end bool/-1 w bool
2N/A/--- begin num/+1,/--- end num/-1 w num
2N/A/--- begin str/+1,/--- end str/-1 w str
2N/AE bool
2N/A1,$s/" .*/", /
2N/A1,$s/.* "/"/
2N/A1,$-10g/^/.,+9j
2N/A+,$j
2N/A1i
2N/Achar *boolnames[] =
2N/A {
2N/A.
2N/A$a
2N/A0
2N/A };
2N/A
2N/A.
2N/Aw tinames.c
2N/Ae bool
2N/A1,$s/^[^"]*"[^"]*".//
2N/A1,$s/" .*/", /
2N/A1,$-10g/^/.,+9j
2N/A+,$j
2N/A1i
2N/Achar *boolcodes[] =
2N/A {
2N/A.
2N/A$a
2N/A0
2N/A };
2N/A
2N/A.
2N/Aw tnames.c
2N/Ae bool
2N/A1,$s/^\([a-z][0-9a-z_]*\),.*/"\1", /
2N/A1,$-4g/^/.,+3j
2N/A+,$j
2N/A1i
2N/Achar *boolfnames[] =
2N/A {
2N/A.
2N/A$a
2N/A0
2N/A };
2N/A
2N/A.
2N/Aw tifnames.c
2N/Ae bool
2N/A1,$s;"[^"]*"[ ]*".." ;/* ;
2N/A1,$s;$; */;
2N/A1,$s;^; ;
2N/A1i
2N/A char
2N/A.
2N/A$a
2N/A Sentinel; /* End of bools. DO NOT MOVE! */
2N/A.
2N/Aw boolvals
2N/Ae num
2N/A1,$s/" .*/", /
2N/A1,$s/.* "/"/
2N/A1,$-10g/^/.,+9j
2N/A+,$j
2N/A1i
2N/Achar *numnames[] =
2N/A {
2N/A.
2N/A$a
2N/A0
2N/A };
2N/A
2N/A.
2N/A0r tinames.c
2N/Aw tinames.c
2N/Ae num
2N/A1,$s/^[^"]*"[^"]*".//
2N/A1,$s/" .*/", /
2N/A1,$-10g/^/.,+9j
2N/A+,$j
2N/A1i
2N/Achar *numcodes[] =
2N/A {
2N/A.
2N/A$a
2N/A0
2N/A };
2N/A
2N/A.
2N/A0r tnames.c
2N/Aw tnames.c
2N/Ae num
2N/A1,$s/^\([a-z][0-9a-z_]*\),.*/"\1", /
2N/A1,$-4g/^/.,+3j
2N/A+,$j
2N/A1i
2N/Achar *numfnames[] =
2N/A {
2N/A.
2N/A$a
2N/A0
2N/A };
2N/A
2N/A.
2N/A0r tifnames.c
2N/Aw tifnames.c
2N/Ae num
2N/A1,$s;"[^"]*"[ ]*".." ;/* ;
2N/A1,$s;$; */;
2N/A1,$s;^; ;
2N/A1i
2N/A short
2N/A.
2N/A$a
2N/A Sentinel; /* End of nums. DO NOT MOVE! */
2N/A.
2N/Aw numvals
2N/Ae str
2N/A1,$s/" .*/", /
2N/A1,$s/.* "/"/
2N/A1,$-10g/^/.,+9j
2N/A+,$j
2N/A1i
2N/Achar *strnames[] =
2N/A {
2N/A.
2N/A$a
2N/A0
2N/A };
2N/A
2N/A.
2N/A0r tinames.c
2N/Aw tinames.c
2N/Ae str
2N/A1,$s/^[^"]*"[^"]*".//
2N/A1,$s/" .*/", /
2N/A1,$-10g/^/.,+9j
2N/A+,$j
2N/A1i
2N/Achar *strcodes[] =
2N/A {
2N/A.
2N/A$a
2N/A0
2N/A };
2N/A
2N/A.
2N/A0r tnames.c
2N/Aw tnames.c
2N/Ae str
2N/A1,$s/^\([a-z][0-9a-z_]*\),.*/"\1", /
2N/A1,$-4g/^/.,+3j
2N/A+,$j
2N/A1i
2N/Achar *strfnames[] =
2N/A {
2N/A.
2N/A$a
2N/A0
2N/A };
2N/A
2N/A.
2N/A0r tifnames.c
2N/Aw tifnames.c
2N/Ae str
2N/A1,$s;"[^"]*"[ ]*".." ;/* ;
2N/A1,$s;$; */;
2N/A1,$s;^; strs.;
2N/A$a
2N/A Sentinel; /* End of strings. DO NOT MOVE! */
2N/A.
2N/Aw strvals
2N/A1,$d
2N/Ar tnames.c
2N/A1i
2N/A/* tnames.c: Made automatically from caps and maketerm.ed - don't edit me! */
2N/A.
2N/A1,$s/ $//
2N/A0r copyright.h
2N/A1,.g/#pragma ident/d
2N/Aw tnames.c
2N/A1,$d
2N/Ar tinames.c
2N/A1i
2N/A/* tinames.c: Made automatically from caps and maketerm.ed - don't edit me! */
2N/A.
2N/A1,$s/ $//
2N/A0r copyright.h
2N/A1,.g/#pragma ident/d
2N/Aw tinames.c
2N/A1,$d
2N/Ar tifnames.c
2N/A1i
2N/A/* tifnames.c: Made automatically from caps and maketerm.ed - don't edit me! */
2N/A.
2N/A1,$s/ $//
2N/A0r copyright.h
2N/A1,.g/#pragma ident/d
2N/Aw tifnames.c
2N/Ae bool
2N/A1,$d
2N/Aa
2N/A
2N/Atypedef char *charptr;
2N/Astruct strs {
2N/A charptr
2N/A.
2N/Ar strvals
2N/A1,.s/strs\.//
2N/A$a
2N/A};
2N/A
2N/Astruct _bool_struct {
2N/A.
2N/Ar boolvals
2N/Aa
2N/A};
2N/A
2N/Astruct _num_struct {
2N/A.
2N/Ar numvals
2N/Aa
2N/A};
2N/A.
2N/Aw ./tmp/term.h.new
2N/Ae ./tmp/term.h.new
2N/Ag/^ ./s/^ / _/
2N/Aw ./tmp/term.h.new
2N/Ae boolvals
2N/A.kb
2N/A.r numvals
2N/A.kn
2N/A1,$v/^ /d
2N/A1,$s/^ //
2N/A1,$s/ [^ ].*/ /
2N/A1,$s/,/ /
2N/A1,'bs/.*/#define & CURB _&/
2N/A'b+1,'ns/.*/#define & CURN _&/
2N/A1,$g/;/d
2N/Aw ./tmp/term.h.new2
2N/Ae strvals
2N/A1,$v/^ /d
2N/A1,$s/^ //
2N/A1,$s/ [^ ].*/ /
2N/A1,$s/,/ /
2N/A1,$s/.*/#define & CURS _&/
2N/A1,$s/strs\.//
2N/A1,$s/strs.\(.\)/strs._\1/
2N/A1,$g/;/d
2N/Aw
2N/Ae ./tmp/term.h.new2
2N/A$r strvals
2N/Aw ./tmp/term.h.new1
2N/Ae ./tmp/term.h.new1
2N/A$r ./tmp/term.h.new
2N/Aw ./tmp/term.h.new
2N/Ae ./tmp/term.h.new
2N/A1,$s/[ ]*$//
2N/A1,$s/CURS _strs/CURS strs/
2N/Aw ./tmp/term.h.new
2N/Ae ./tmp/term.h.new
2N/A1;/CURS strs/+100;.,+99s/CURS strs/CURS strs2/
2N/A.+1,+100s/CURS strs/CURS strs3/
2N/A.+1,$s/CURS strs/CURS strs4/
2N/A/^struct strs/+101s/,/;/
2N/Aa
2N/A};
2N/A
2N/Astruct strs2 {
2N/A charptr
2N/A.
2N/A+100s/,/;/
2N/Aa
2N/A};
2N/A
2N/Astruct strs3 {
2N/A charptr
2N/A.
2N/A+100s/,/;/
2N/Aa
2N/A};
2N/A
2N/Astruct strs4 {
2N/A charptr
2N/A.
2N/A1,$s/_Sentinel/Sentinel/
2N/Aw ./tmp/term.h.new
2N/Ae ./tmp/term.h.new
2N/Ag/[ .]_cursor_/s/_cursor_/_crsr_/
2N/Ag/[ .]_delete_/s/_delete_/_dlt_/
2N/Ag/[ .]_enter_/s/_enter_/_entr_/
2N/Ag/[ .]_insert_/s/_insert_/_ins_/
2N/Ag/[ .]_key_/s/_key_/_ky_/
2N/Ag/[ .]_keypad_/s/_keypad_/_kpad_/
2N/Ag/[ .]_label_/s/_label_/_labl_/
2N/Ag/[ .]_memory_/s/_memory_/_mem_/
2N/Ag/[ .]_parm_/s/_parm_/_prm_/
2N/Ag/[ .]_scroll_/s/_scroll_/_scrll_/
2N/Ag/^ _......[,;] \//s/, /,/
2N/Ag/^ _..............[,;] \//s/, /,/
2N/Ag/^ _......................[,;] \//s/, /,/
2N/Aw ./tmp/term.h.new
2N/Ae ./tmp/term.h.new
2N/A!# the following lines GO away when Vr2 compat code goes away
2N/A1;/^#define auto_left_margin/,/^#define xon_xoff/s/CURB.*/CUR _b/
2N/A1;/^#define auto_left_margin/,/^#define xon_xoff/w ./tmp/tmp.term.h
2N/A1;/^#define auto_left_margin/,/^#define xon_xoff/d
2N/A!/usr/bin/echo '{printf "\%s\%d\\n", $0,++i}' > ./tmp/tmp.awk
2N/A.-1r !awk -f ./tmp/tmp.awk < ./tmp/tmp.term.h
2N/A1;/^#define columns/,/^#define width_status_line/s/CURN.*/CUR _c/
2N/A1;/^#define columns/,/^#define width_status_line/w ./tmp/tmp.term.h
2N/A1;/^#define columns/,/^#define width_status_line/d
2N/A!/usr/bin/echo '{printf "\%s\%d\\n", $0,++i}' > ./tmp/tmp.awk
2N/A.-1r !awk -f ./tmp/tmp.awk < ./tmp/tmp.term.h
2N/A1;/^#define back_tab/,/^#define lab_f8/s/CURS.*/CUR _Vr2_Astrs._s/
2N/A1;/^#define back_tab/,/^#define lab_f8/w ./tmp/tmp.term.h
2N/A1;/^#define back_tab/,/^#define lab_f8/d
2N/A!/usr/bin/echo '{printf "\%s\%d\\n", $0,++i}' > ./tmp/tmp.awk
2N/A.-1r !awk -f ./tmp/tmp.awk < ./tmp/tmp.term.h
2N/A1;/^#define lab_f9/,/^#define prtr_non/s/CURS.*/CUR _Vr2_Bstrs._s/
2N/A1;/^#define lab_f9/,/^#define prtr_non/w ./tmp/tmp.term.h
2N/A1;/^#define lab_f9/,/^#define prtr_non/d
2N/A!/usr/bin/echo 'BEGIN{i=100}\n{printf "\%s\%d\\n", $0,++i}' > ./tmp/tmp.awk
2N/A.-1r !awk -f ./tmp/tmp.awk < ./tmp/tmp.term.h
2N/A!rm -f ./tmp/tmp.term.h ./tmp/tmp.awk
2N/Aw ./tmp/term.h.new
2N/Ae ./tmp/term.h.new
2N/A!# Vr2 compat code ends here
2N/A1i
2N/A#ifndef _TERM_H
2N/A#define _TERM_H
2N/A
2N/A/*
2N/A * term.h - this file is automatically made from caps and maketerm.ed.
2N/A * Don't make changes directly to term.h.
2N/A */
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A.
2N/A$a
2N/A
2N/Astruct _str_struct {
2N/A struct strs strs;
2N/A struct strs2 strs2;
2N/A struct strs3 strs3;
2N/A struct strs4 strs4;
2N/A};
2N/A
2N/A#define NUM_ATTRIBUTES 9
2N/A#define UNACCESSIBLE 1
2N/A#define NO_TERMINAL 2
2N/A#define CORRUPTED 3
2N/A#define ENTRY_TOO_LONG 4
2N/A#define TERMINFO_TOO_LONG 5
2N/A#define TERM_BAD_MALLOC 6
2N/A#define NOT_READABLE 7
2N/A#define _VR2_COMPAT_CODE
2N/A#ifdef _VR2_COMPAT_CODE
2N/Astruct _Vr2_Astrs {
2N/A charptr
2N/A _s1, _s2, _s3, _s4, _s5, _s6, _s7, _s8, _s9, _s10,
2N/A _s11, _s12, _s13, _s14, _s15, _s16, _s17, _s18, _s19, _s20,
2N/A _s21, _s22, _s23, _s24, _s25, _s26, _s27, _s28, _s29, _s30,
2N/A _s31, _s32, _s33, _s34, _s35, _s36, _s37, _s38, _s39, _s40,
2N/A _s41, _s42, _s43, _s44, _s45, _s46, _s47, _s48, _s49, _s50,
2N/A _s51, _s52, _s53, _s54, _s55, _s56, _s57, _s58, _s59, _s60,
2N/A _s61, _s62, _s63, _s64, _s65, _s66, _s67, _s68, _s69, _s70,
2N/A _s71, _s72, _s73, _s74, _s75, _s76, _s77, _s78, _s79, _s80,
2N/A _s81, _s82, _s83, _s84, _s85, _s86, _s87, _s88, _s89, _s90,
2N/A _s91, _s92, _s93, _s94, _s95, _s96, _s97, _s98, _s99, _s100;
2N/A};
2N/A
2N/Astruct _Vr2_Bstrs {
2N/A charptr
2N/A _s101, _s102, _s103, _s104, _s105, _s106, _s107, _s108, _s109, _s110,
2N/A _s111, _s112, _s113, _s114, _s115, _s116, _s117, _s118, _s119, _s120,
2N/A _s121, _s122, _s123, _s124, _s125, _s126, _s127, _s128, _s129, _s130,
2N/A _s131, _s132, _s133, _s134, _s135, _s136, _s137, _s138, _s139, _s140,
2N/A _s141, _s142, _s143, _s144, _s145;
2N/A};
2N/A#endif /* _VR2_COMPAT_CODE */
2N/A
2N/Atypedef struct {
2N/A char *_sends; /* Characters sent when key is pressed */
2N/A short _keyval; /* "char" we pass back to program */
2N/A} _KEY_MAP;
2N/A
2N/Atypedef struct {
2N/A short foreground; /* foreground color */
2N/A short background; /* background color */
2N/A bool init; /* TRUE if pair was initialized */
2N/A} _Color_pair;
2N/A
2N/A
2N/Atypedef struct {
2N/A short r, g, b;
2N/A} _Color;
2N/A
2N/A
2N/A/*
2N/A * This definition for the term struct allows the boolean, number
2N/A * and string information to grow in the future and still allow .o
2N/A * compatibility.
2N/A */
2N/A
2N/Astruct term {
2N/A#ifdef _VR2_COMPAT_CODE
2N/A char
2N/A _b1, _b2, _b3, _b4, _b5, _b6, _b7, _b8, _b9, _b10,
2N/A _b11, _b12, _b13, _b14, _b15, _b16, _b17, _b18, _b19, _b20, _b21;
2N/A short
2N/A _c1, _c2, _c3, _c4, _c5, _c6, _c7, _c8;
2N/A struct _Vr2_Astrs _Vr2_Astrs;
2N/A struct _Vr2_Bstrs _Vr2_Bstrs;
2N/A#endif /* _VR2_COMPAT_CODE */
2N/A short Filedes; /* file descriptor being written to */
2N/A SGTTY Ottyb, /* original state of the terminal */
2N/A Nttyb; /* current state of the terminal */
2N/A#ifdef SYSV
2N/A SGTTYS Ottybs, /* original state of the terminal */
2N/A Nttybs; /* current state of the terminal */
2N/A#endif
2N/A#ifdef DIOCSETT
2N/A struct termcb new, old; /* CB/UNIX virtual terminals */
2N/A#endif
2N/A#ifdef LTILDE
2N/A int newlmode, oldlmode; /* BSD tty driver */
2N/A#endif
2N/A /* end of Vr2 structure */
2N/A struct _bool_struct *_bools;
2N/A struct _num_struct *_nums;
2N/A struct _str_struct *_strs;
2N/A char *_strtab;
2N/A#ifdef FIONREAD
2N/A long timeout; /* for BSD halfdelay mode */
2N/A#endif
2N/A /* end of Vr3 structure */
2N/A chtype sgr_mode; /* current phys. graphic rendition */
2N/A chtype sgr_faked; /* attributes faked by vidputs */
2N/A int _delay; /* timeout for inputs */
2N/A int _inputfd; /* input file descriptor */
2N/A int _check_fd; /* typeahead file descriptor */
2N/A _KEY_MAP **_keys, /* key map */
2N/A *internal_keys; /* pointer to free key structures */
2N/A short _ksz, /* size of keymap */
2N/A _lastkey_ordered, /* where the last ordered key is */
2N/A _lastmacro_ordered, /* where last ordered macro is */
2N/A _first_macro;
2N/A bool funckeystarter[0400];
2N/A /* map of which chars start fn keys */
2N/A bool _fl_rawmode, /* in cbreak(=1) or raw(=2) mode */
2N/A fl_typeahdok, /* ok to use typeahead */
2N/A _cursorstate, /* cursor: 0=invis, 1=norm, 2=vvis */
2N/A _iwait; /* true if input-pending */
2N/A short _regs[26]; /* tparm static registers */
2N/A#define INP_QSIZE 32
2N/A chtype /* a place to put stuff ungetch'ed */
2N/A _input_queue[INP_QSIZE];
2N/A short _ungotten; /* # chars ungotten by ungetch() */
2N/A char _chars_on_queue; /* # chars on queue */
2N/A#ifdef _VR3_COMPAT_CODE
2N/A _ochtype *_acsmap;
2N/A chtype *_acs32map; /* map of alternate char set chars */
2N/A#else /* _VR3_COMPAT_CODE */
2N/A chtype *_acsmap; /* map of alternate char set chars */
2N/A#endif /* _VR3_COMPAT_CODE */
2N/A char *turn_on_seq[NUM_ATTRIBUTES];
2N/A chtype bit_vector;
2N/A char *cursor_seq[3];
2N/A char _termname[15];
2N/A char *turn_off_seq[3];
2N/A chtype check_turn_off;
2N/A chtype non_faked_mode;
2N/A _Color_pair _cur_pair;
2N/A _Color_pair *_pairs_tbl;
2N/A _Color *_color_tbl;
2N/A};
2N/A
2N/Atypedef struct term TERMINAL;
2N/A
2N/A/* allow old names for these capabilities */
2N/A#define beehive_glitch no_esc_ctlc
2N/A#define teleray_glitch dest_tabs_magic_smso
2N/A
2N/Aextern TERMINAL *cur_term;
2N/Aextern struct _bool_struct *cur_bools;
2N/Aextern struct _num_struct *cur_nums;
2N/Aextern struct _str_struct *cur_strs;
2N/A
2N/A#ifdef SINGLE
2N/Aextern TERMINAL _first_term;
2N/Aextern struct _bool_struct _frst_bools;
2N/Aextern struct _num_struct _frst_nums;
2N/Aextern struct _str_struct _frst_strs;
2N/A
2N/A#define CUR _first_term.
2N/A#define CURB _frst_bools.
2N/A#define CURN _frst_nums.
2N/A#define CURS _frst_strs.
2N/A#define PROGTTY _first_term.Nttyb
2N/A#define SHELLTTY _first_term.Ottyb
2N/A#ifdef SYSV
2N/A#define PROGTTYS _first_term.Nttybs
2N/A#define SHELLTTYS _first_term.Ottybs
2N/A#endif
2N/A#else
2N/A#define CUR cur_term->
2N/A#define CURB cur_bools->
2N/A#define CURN cur_nums->
2N/A#define CURS cur_strs->
2N/A#define PROGTTY (cur_term->Nttyb)
2N/A#define SHELLTTY (cur_term->Ottyb)
2N/A#ifdef SYSV
2N/A#define PROGTTYS (cur_term->Nttybs)
2N/A#define SHELLTTYS (cur_term->Ottybs)
2N/A#endif
2N/A#endif
2N/A
2N/A#ifndef NOMACROS
2N/A#define set_curterm setcurterm
2N/A#define del_curterm delterm
2N/A#else /* NOMACROS */
2N/A
2N/A#ifdef __STDC__
2N/Aextern TERMINAL *set_curterm(TERMINAL *);
2N/Aextern int del_curterm(TERMINAL *);
2N/A#else /* __STDC__ */
2N/Aextern TERMINAL *set_curterm();
2N/Aextern int del_curterm();
2N/A#endif /* __STDC__ */
2N/A
2N/A#endif /* NOMACROS */
2N/A
2N/Aextern short term_errno;
2N/A
2N/A#ifdef SYSV
2N/Aextern int prog_istermios;
2N/Aextern int shell_istermios;
2N/A#endif
2N/A
2N/Aextern char term_parm_err[], *term_err_strings[], *Def_term,
2N/A *boolnames[], *boolcodes[], *boolfnames[],
2N/A *numnames[], *numcodes[], *numfnames[],
2N/A *strnames[], *strcodes[], *strfnames[];
2N/A
2N/A#ifdef __STDC__
2N/Aextern TERMINAL *setcurterm(TERMINAL *);
2N/A
2N/A#if defined(_XPG4_2) || defined(_LP64) || defined(__cplusplus)
2N/Aextern char
2N/A *tparm(char *, long, long, long, long, long, long, long, long, long);
2N/A#else
2N/A/* this is wrong, but is needed for historical reasons */
2N/Aextern char *tparm();
2N/A#endif
2N/A
2N/Aextern char *tgoto(char *, int, int),
2N/A *tgetstr(char *, char **),
2N/A *tigetstr(char *),
2N/A *termname(void);
2N/A
2N/Aextern int tgetent(char *, char *), tgetflag(char *), tgetnum(char *),
2N/A tputs(char *, int, int (*)(char)), putp(char *),
2N/A tigetint(char *), tigetflag(char *), tigetnum(char *),
2N/A vidputs(chtype, int (*)(char)), vidattr(chtype);
2N/A
2N/Aextern int resetterm(void), fixterm(void), saveterm(void),
2N/A restartterm(char *, int, int *), delterm(TERMINAL *);
2N/A
2N/Aextern void termerr(void), tinputfd(int);
2N/A#else /* __STDC__ */
2N/Aextern TERMINAL *setcurterm();
2N/Aextern char *tparm(), *tgoto(), *tgetstr(), *tigetstr(),
2N/A *termname();
2N/A
2N/Aextern int tgetent(), tgetflag(), tgetnum(),
2N/A tigetint(), tigetflag(), tigetnum(),
2N/A tputs(), putp(), vidputs(), vidattr();
2N/A
2N/Aextern int resetterm(), fixterm(), saveterm(),
2N/A restartterm(), delterm();
2N/A
2N/Aextern void termerr(), tinputfd();
2N/A#endif /* __STDC__ */
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _TERM_H */
2N/A.
2N/A0r copyright.h
2N/A1,.g/#pragma ident/d
2N/Ag/\@(\#)maketerm.ed/s//\@(\#)term.h/
2N/A1,$s/,\/\*/, \/\*/
2N/Aw term.h
2N/A!rm -f boolnames boolvals bool numnames numvals num strnames strvals str ./tmp/term.h.new ./tmp/tmp.awk ./tmp/tmp.term.h
2N/Aq