xref: /titanic_50/usr/src/lib/libcurses/screen/maketerm.ed (revision bd93c05dbd9b8f1e8d2edf48c777bc881f927608)
1H
2!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
3e caps
4g/^#/d
5/--- begin bool/+1,/--- end bool/-1 w bool
6/--- begin num/+1,/--- end num/-1 w num
7/--- begin str/+1,/--- end str/-1 w str
8E bool
91,$s/"	.*/", /
101,$s/.*	"/"/
111,$-10g/^/.,+9j
12+,$j
131i
14char	*boolnames[] =
15	{
16.
17$a
180
19	};
20
21.
22w tinames.c
23e bool
241,$s/^[^"]*"[^"]*".//
251,$s/"	.*/", /
261,$-10g/^/.,+9j
27+,$j
281i
29char	*boolcodes[] =
30	{
31.
32$a
330
34	};
35
36.
37w tnames.c
38e bool
391,$s/^\([a-z][0-9a-z_]*\),.*/"\1", /
401,$-4g/^/.,+3j
41+,$j
421i
43char	*boolfnames[] =
44	{
45.
46$a
470
48	};
49
50.
51w tifnames.c
52e bool
531,$s;"[^"]*"[ 	]*".."	;/* ;
541,$s;$; */;
551,$s;^;	;
561i
57    char
58.
59$a
60	Sentinel;		/* End of bools. DO NOT MOVE! */
61.
62w boolvals
63e num
641,$s/"	.*/", /
651,$s/.*	"/"/
661,$-10g/^/.,+9j
67+,$j
681i
69char	*numnames[] =
70	{
71.
72$a
730
74	};
75
76.
770r tinames.c
78w tinames.c
79e num
801,$s/^[^"]*"[^"]*".//
811,$s/"	.*/", /
821,$-10g/^/.,+9j
83+,$j
841i
85char	*numcodes[] =
86	{
87.
88$a
890
90	};
91
92.
930r tnames.c
94w tnames.c
95e num
961,$s/^\([a-z][0-9a-z_]*\),.*/"\1", /
971,$-4g/^/.,+3j
98+,$j
991i
100char	*numfnames[] =
101	{
102.
103$a
1040
105	};
106
107.
1080r tifnames.c
109w tifnames.c
110e num
1111,$s;"[^"]*"[ 	]*".."	;/* ;
1121,$s;$; */;
1131,$s;^;	;
1141i
115    short
116.
117$a
118	Sentinel;		/* End of nums. DO NOT MOVE! */
119.
120w numvals
121e str
1221,$s/"	.*/", /
1231,$s/.*	"/"/
1241,$-10g/^/.,+9j
125+,$j
1261i
127char	*strnames[] =
128	{
129.
130$a
1310
132	};
133
134.
1350r tinames.c
136w tinames.c
137e str
1381,$s/^[^"]*"[^"]*".//
1391,$s/"	.*/", /
1401,$-10g/^/.,+9j
141+,$j
1421i
143char	*strcodes[] =
144	{
145.
146$a
1470
148	};
149
150.
1510r tnames.c
152w tnames.c
153e str
1541,$s/^\([a-z][0-9a-z_]*\),.*/"\1", /
1551,$-4g/^/.,+3j
156+,$j
1571i
158char	*strfnames[] =
159	{
160.
161$a
1620
163	};
164
165.
1660r tifnames.c
167w tifnames.c
168e str
1691,$s;"[^"]*"[ 	]*".."	;/* ;
1701,$s;$; */;
1711,$s;^;	strs.;
172$a
173	Sentinel;		/* End of strings. DO NOT MOVE! */
174.
175w strvals
1761,$d
177r tnames.c
1781i
179/* tnames.c: Made automatically from caps and maketerm.ed - don't edit me! */
180.
1811,$s/ $//
1820r copyright.h
1831,.g/#pragma ident/d
184w tnames.c
1851,$d
186r tinames.c
1871i
188/* tinames.c: Made automatically from caps and maketerm.ed - don't edit me! */
189.
1901,$s/ $//
1910r copyright.h
1921,.g/#pragma ident/d
193w tinames.c
1941,$d
195r tifnames.c
1961i
197/* tifnames.c: Made automatically from caps and maketerm.ed - don't edit me! */
198.
1991,$s/ $//
2000r copyright.h
2011,.g/#pragma ident/d
202w tifnames.c
203e bool
2041,$d
205a
206
207typedef char *charptr;
208struct strs {
209    charptr
210.
211r strvals
2121,.s/strs\.//
213$a
214};
215
216struct _bool_struct {
217.
218r boolvals
219a
220};
221
222struct _num_struct {
223.
224r numvals
225a
226};
227.
228w ./tmp/term.h.new
229e ./tmp/term.h.new
230g/^	./s/^	/	_/
231w ./tmp/term.h.new
232e boolvals
233.kb
234.r numvals
235.kn
2361,$v/^	/d
2371,$s/^	//
2381,$s/	[^	].*/	/
2391,$s/,/ /
2401,'bs/.*/#define	&	CURB _&/
241'b+1,'ns/.*/#define	&	CURN _&/
2421,$g/;/d
243w ./tmp/term.h.new2
244e strvals
2451,$v/^	/d
2461,$s/^	//
2471,$s/	[^	].*/	/
2481,$s/,/ /
2491,$s/.*/#define	&	CURS _&/
2501,$s/strs\.//
2511,$s/strs.\(.\)/strs._\1/
2521,$g/;/d
253w
254e ./tmp/term.h.new2
255$r strvals
256w ./tmp/term.h.new1
257e ./tmp/term.h.new1
258$r ./tmp/term.h.new
259w ./tmp/term.h.new
260e ./tmp/term.h.new
2611,$s/[ 	]*$//
2621,$s/CURS _strs/CURS strs/
263w ./tmp/term.h.new
264e ./tmp/term.h.new
2651;/CURS strs/+100;.,+99s/CURS strs/CURS strs2/
266.+1,+100s/CURS strs/CURS strs3/
267.+1,$s/CURS strs/CURS strs4/
268/^struct strs/+101s/,/;/
269a
270};
271
272struct strs2 {
273    charptr
274.
275+100s/,/;/
276a
277};
278
279struct strs3 {
280    charptr
281.
282+100s/,/;/
283a
284};
285
286struct strs4 {
287    charptr
288.
2891,$s/_Sentinel/Sentinel/
290w ./tmp/term.h.new
291e ./tmp/term.h.new
292g/[ 	.]_cursor_/s/_cursor_/_crsr_/
293g/[ 	.]_delete_/s/_delete_/_dlt_/
294g/[ 	.]_enter_/s/_enter_/_entr_/
295g/[ 	.]_insert_/s/_insert_/_ins_/
296g/[ 	.]_key_/s/_key_/_ky_/
297g/[ 	.]_keypad_/s/_keypad_/_kpad_/
298g/[ 	.]_label_/s/_label_/_labl_/
299g/[ 	.]_memory_/s/_memory_/_mem_/
300g/[ 	.]_parm_/s/_parm_/_prm_/
301g/[ 	.]_scroll_/s/_scroll_/_scrll_/
302g/^	_......[,;]			\//s/,	/,/
303g/^	_..............[,;]		\//s/,	/,/
304g/^	_......................[,;]	\//s/,	/,/
305w ./tmp/term.h.new
306e ./tmp/term.h.new
307!# the following lines GO away when Vr2 compat code goes away
3081;/^#define	auto_left_margin/,/^#define	xon_xoff/s/CURB.*/CUR _b/
3091;/^#define	auto_left_margin/,/^#define	xon_xoff/w ./tmp/tmp.term.h
3101;/^#define	auto_left_margin/,/^#define	xon_xoff/d
311!/usr/bin/print '{printf "\%s\%d\\n", $0,++i}' > ./tmp/tmp.awk
312.-1r !awk -f ./tmp/tmp.awk < ./tmp/tmp.term.h
3131;/^#define	columns/,/^#define	width_status_line/s/CURN.*/CUR _c/
3141;/^#define	columns/,/^#define	width_status_line/w ./tmp/tmp.term.h
3151;/^#define	columns/,/^#define	width_status_line/d
316!/usr/bin/print '{printf "\%s\%d\\n", $0,++i}' > ./tmp/tmp.awk
317.-1r !awk -f ./tmp/tmp.awk < ./tmp/tmp.term.h
3181;/^#define	back_tab/,/^#define	lab_f8/s/CURS.*/CUR _Vr2_Astrs._s/
3191;/^#define	back_tab/,/^#define	lab_f8/w ./tmp/tmp.term.h
3201;/^#define	back_tab/,/^#define	lab_f8/d
321!/usr/bin/print '{printf "\%s\%d\\n", $0,++i}' > ./tmp/tmp.awk
322.-1r !awk -f ./tmp/tmp.awk < ./tmp/tmp.term.h
3231;/^#define	lab_f9/,/^#define	prtr_non/s/CURS.*/CUR _Vr2_Bstrs._s/
3241;/^#define	lab_f9/,/^#define	prtr_non/w ./tmp/tmp.term.h
3251;/^#define	lab_f9/,/^#define	prtr_non/d
326!/usr/bin/print 'BEGIN{i=100}\n{printf "\%s\%d\\n", $0,++i}' > ./tmp/tmp.awk
327.-1r !awk -f ./tmp/tmp.awk < ./tmp/tmp.term.h
328!rm -f ./tmp/tmp.term.h ./tmp/tmp.awk
329w ./tmp/term.h.new
330e ./tmp/term.h.new
331!# Vr2 compat code ends here
3321i
333#ifndef	_TERM_H
334#define	_TERM_H
335
336/*
337 * term.h - this file is automatically made from caps and maketerm.ed.
338 * Don't make changes directly to term.h.
339 */
340
341#ifdef	__cplusplus
342extern "C" {
343#endif
344
345.
346$a
347
348struct _str_struct {
349	struct strs strs;
350	struct strs2 strs2;
351	struct strs3 strs3;
352	struct strs4 strs4;
353};
354
355#define	NUM_ATTRIBUTES	9
356#define	UNACCESSIBLE		1
357#define	NO_TERMINAL		2
358#define	CORRUPTED		3
359#define	ENTRY_TOO_LONG		4
360#define	TERMINFO_TOO_LONG	5
361#define	TERM_BAD_MALLOC		6
362#define	NOT_READABLE		7
363#define	_VR2_COMPAT_CODE
364#ifdef _VR2_COMPAT_CODE
365struct _Vr2_Astrs {
366    charptr
367	_s1,  _s2,  _s3,  _s4,  _s5,  _s6,  _s7,  _s8,  _s9,  _s10,
368	_s11, _s12, _s13, _s14, _s15, _s16, _s17, _s18, _s19, _s20,
369	_s21, _s22, _s23, _s24, _s25, _s26, _s27, _s28, _s29, _s30,
370	_s31, _s32, _s33, _s34, _s35, _s36, _s37, _s38, _s39, _s40,
371	_s41, _s42, _s43, _s44, _s45, _s46, _s47, _s48, _s49, _s50,
372	_s51, _s52, _s53, _s54, _s55, _s56, _s57, _s58, _s59, _s60,
373	_s61, _s62, _s63, _s64, _s65, _s66, _s67, _s68, _s69, _s70,
374	_s71, _s72, _s73, _s74, _s75, _s76, _s77, _s78, _s79, _s80,
375	_s81, _s82, _s83, _s84, _s85, _s86, _s87, _s88, _s89, _s90,
376	_s91, _s92, _s93, _s94, _s95, _s96, _s97, _s98, _s99, _s100;
377};
378
379struct _Vr2_Bstrs {
380    charptr
381	_s101, _s102, _s103, _s104, _s105, _s106, _s107, _s108, _s109, _s110,
382	_s111, _s112, _s113, _s114, _s115, _s116, _s117, _s118, _s119, _s120,
383	_s121, _s122, _s123, _s124, _s125, _s126, _s127, _s128, _s129, _s130,
384	_s131, _s132, _s133, _s134, _s135, _s136, _s137, _s138, _s139, _s140,
385	_s141, _s142, _s143, _s144, _s145;
386};
387#endif /* _VR2_COMPAT_CODE */
388
389typedef struct {
390	char	*_sends;	/* Characters sent when key is pressed */
391	short	_keyval;	/* "char" we pass back to program */
392} _KEY_MAP;
393
394typedef struct {
395	short	foreground;	/* foreground color */
396	short	background;	/* background color */
397	bool	init;		/* TRUE if pair was initialized */
398} _Color_pair;
399
400
401typedef struct {
402	short	r, g, b;
403} _Color;
404
405
406/*
407 * This definition for the term struct allows the boolean, number
408 * and string information to grow in the future and still allow .o
409 * compatibility.
410 */
411
412struct term {
413#ifdef _VR2_COMPAT_CODE
414    char
415	_b1,  _b2,  _b3,  _b4,  _b5,  _b6,  _b7,  _b8,  _b9,  _b10,
416	_b11, _b12, _b13, _b14, _b15, _b16, _b17, _b18, _b19, _b20, _b21;
417    short
418	_c1, _c2, _c3, _c4, _c5, _c6, _c7, _c8;
419	struct _Vr2_Astrs _Vr2_Astrs;
420	struct _Vr2_Bstrs _Vr2_Bstrs;
421#endif /* _VR2_COMPAT_CODE */
422	short	Filedes;	/* file descriptor being written to */
423	SGTTY	Ottyb,		/* original state of the terminal */
424		Nttyb;		/* current state of the terminal */
425#ifdef SYSV
426	SGTTYS	Ottybs,		/* original state of the terminal */
427		Nttybs;		/* current state of the terminal */
428#endif
429#ifdef DIOCSETT
430	struct termcb new, old;	/* CB/UNIX virtual terminals */
431#endif
432#ifdef LTILDE
433	int newlmode, oldlmode;	/* BSD tty driver */
434#endif
435	/* end of Vr2 structure */
436	struct _bool_struct *_bools;
437	struct _num_struct *_nums;
438	struct _str_struct *_strs;
439	char	*_strtab;
440#ifdef FIONREAD
441	long	timeout;		/* for BSD halfdelay mode */
442#endif
443	/* end of Vr3 structure */
444	chtype	sgr_mode;		/* current phys. graphic rendition */
445	chtype	sgr_faked;		/* attributes faked by vidputs */
446	int	_delay;			/* timeout for inputs */
447	int	_inputfd;		/* input file descriptor */
448	int	_check_fd;		/* typeahead file descriptor */
449	_KEY_MAP	**_keys,	/* key map */
450			*internal_keys;	/* pointer to free key structures */
451	short		_ksz,		/* size of keymap */
452			_lastkey_ordered, /* where the last ordered key is */
453			_lastmacro_ordered, /* where last ordered macro is */
454			_first_macro;
455	bool		funckeystarter[0400];
456					/* map of which chars start fn keys */
457	bool		_fl_rawmode,	/* in cbreak(=1) or raw(=2) mode */
458			fl_typeahdok,	/* ok to use typeahead */
459			_cursorstate,	/* cursor: 0=invis, 1=norm, 2=vvis */
460			_iwait;		/* true if input-pending */
461	short		_regs[26];	/* tparm static registers */
462#define	INP_QSIZE	32
463	chtype				/* a place to put stuff ungetch'ed */
464			_input_queue[INP_QSIZE];
465	short	_ungotten;	/* # chars ungotten by ungetch() */
466	char		_chars_on_queue; /* # chars on queue */
467#ifdef _VR3_COMPAT_CODE
468	_ochtype	*_acsmap;
469	chtype		*_acs32map;	/* map of alternate char set chars */
470#else /* _VR3_COMPAT_CODE */
471	chtype		*_acsmap;	/* map of alternate char set chars */
472#endif /* _VR3_COMPAT_CODE */
473	char		*turn_on_seq[NUM_ATTRIBUTES];
474	chtype		bit_vector;
475	char		*cursor_seq[3];
476	char		_termname[15];
477	char		*turn_off_seq[3];
478	chtype		check_turn_off;
479	chtype		non_faked_mode;
480	_Color_pair	_cur_pair;
481	_Color_pair	*_pairs_tbl;
482	_Color		*_color_tbl;
483};
484
485typedef struct term TERMINAL;
486
487/* allow old names for these capabilities */
488#define	beehive_glitch	no_esc_ctlc
489#define	teleray_glitch	dest_tabs_magic_smso
490
491extern TERMINAL			*cur_term;
492extern struct _bool_struct	*cur_bools;
493extern struct _num_struct	*cur_nums;
494extern struct _str_struct	*cur_strs;
495
496#ifdef	SINGLE
497extern TERMINAL			_first_term;
498extern struct _bool_struct	_frst_bools;
499extern struct _num_struct	_frst_nums;
500extern struct _str_struct	_frst_strs;
501
502#define	CUR			_first_term.
503#define	CURB			_frst_bools.
504#define	CURN			_frst_nums.
505#define	CURS			_frst_strs.
506#define	PROGTTY			_first_term.Nttyb
507#define	SHELLTTY		_first_term.Ottyb
508#ifdef SYSV
509#define	PROGTTYS		_first_term.Nttybs
510#define	SHELLTTYS		_first_term.Ottybs
511#endif
512#else
513#define	CUR			cur_term->
514#define	CURB			cur_bools->
515#define	CURN			cur_nums->
516#define	CURS			cur_strs->
517#define	PROGTTY			(cur_term->Nttyb)
518#define	SHELLTTY		(cur_term->Ottyb)
519#ifdef SYSV
520#define	PROGTTYS		(cur_term->Nttybs)
521#define	SHELLTTYS		(cur_term->Ottybs)
522#endif
523#endif
524
525#ifndef	NOMACROS
526#define	set_curterm	setcurterm
527#define	del_curterm	delterm
528#else	/* NOMACROS */
529
530#ifdef	__STDC__
531extern	TERMINAL	*set_curterm(TERMINAL *);
532extern	int		del_curterm(TERMINAL *);
533#else	/* __STDC__ */
534extern	TERMINAL	*set_curterm();
535extern	int		del_curterm();
536#endif	/* __STDC__ */
537
538#endif  /* NOMACROS */
539
540extern	short	term_errno;
541
542#ifdef SYSV
543extern	int	prog_istermios;
544extern	int	shell_istermios;
545#endif
546
547extern	char	term_parm_err[], *term_err_strings[], *Def_term,
548		*boolnames[], *boolcodes[], *boolfnames[],
549		*numnames[], *numcodes[], *numfnames[],
550		*strnames[], *strcodes[], *strfnames[];
551
552#ifdef __STDC__
553extern	TERMINAL	*setcurterm(TERMINAL *);
554
555#if defined(_XPG4_2) || defined(_LP64) || defined(__cplusplus)
556extern	char
557	*tparm(char *, long, long, long, long, long, long, long, long, long);
558#else
559/* this is wrong, but is needed for historical reasons */
560extern	char	*tparm();
561#endif
562
563extern char	*tgoto(char *, int, int),
564		*tgetstr(char *, char **),
565		*tigetstr(char *),
566		*termname(void);
567
568extern	int	tgetent(char *, char *), tgetflag(char *), tgetnum(char *),
569		tputs(char *, int, int (*)(char)), putp(char *),
570		tigetint(char *), tigetflag(char *), tigetnum(char *),
571		vidputs(chtype, int (*)(char)), vidattr(chtype);
572
573extern	int	resetterm(void), fixterm(void), saveterm(void),
574		restartterm(char *, int, int *), delterm(TERMINAL *);
575
576extern	void	termerr(void), tinputfd(int);
577#else  /* __STDC__ */
578extern	TERMINAL	*setcurterm();
579extern	char	*tparm(), *tgoto(), *tgetstr(), *tigetstr(),
580		*termname();
581
582extern	int	tgetent(), tgetflag(), tgetnum(),
583		tigetint(), tigetflag(), tigetnum(),
584		tputs(), putp(), vidputs(), vidattr();
585
586extern	int	resetterm(), fixterm(), saveterm(),
587		restartterm(), delterm();
588
589extern	void	termerr(), tinputfd();
590#endif /* __STDC__ */
591
592#ifdef	__cplusplus
593}
594#endif
595
596#endif	/* _TERM_H */
597.
5980r copyright.h
5991,.g/#pragma ident/d
600g/\@(\#)maketerm.ed/s//\@(\#)term.h/
6011,$s/,\/\*/, \/\*/
602w term.h
603!rm -f boolnames boolvals bool numnames numvals num strnames strvals str ./tmp/term.h.new ./tmp/tmp.awk ./tmp/tmp.term.h
604q
605