xref: /titanic_50/usr/src/lib/libcurses/screen/maketerm.ed (revision c51cb4bc539e1650eb5bb4f805cc779bfce99c06)
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#pragma ident	"%Z%%M%	%I%	%E% SMI"
180
181/* tnames.c: Made automatically from caps and maketerm.ed - don't edit me! */
182.
1831,$s/ $//
1840r copyright.h
1851,.g/#pragma ident/d
186w tnames.c
1871,$d
188r tinames.c
1891i
190#pragma ident	"%Z%%M%	%I%	%E% SMI"
191
192/* tinames.c: Made automatically from caps and maketerm.ed - don't edit me! */
193.
1941,$s/ $//
1950r copyright.h
1961,.g/#pragma ident/d
197w tinames.c
1981,$d
199r tifnames.c
2001i
201#pragma ident	"%Z%%M%	%I%	%E% SMI"
202
203/* tifnames.c: Made automatically from caps and maketerm.ed - don't edit me! */
204.
2051,$s/ $//
2060r copyright.h
2071,.g/#pragma ident/d
208w tifnames.c
209e bool
2101,$d
211a
212
213typedef char *charptr;
214struct strs {
215    charptr
216.
217r strvals
2181,.s/strs\.//
219$a
220};
221
222struct _bool_struct {
223.
224r boolvals
225a
226};
227
228struct _num_struct {
229.
230r numvals
231a
232};
233.
234w ./tmp/term.h.new
235e ./tmp/term.h.new
236g/^	./s/^	/	_/
237w ./tmp/term.h.new
238e boolvals
239.kb
240.r numvals
241.kn
2421,$v/^	/d
2431,$s/^	//
2441,$s/	[^	].*/	/
2451,$s/,/ /
2461,'bs/.*/#define	&	CURB _&/
247'b+1,'ns/.*/#define	&	CURN _&/
2481,$g/;/d
249w ./tmp/term.h.new2
250e strvals
2511,$v/^	/d
2521,$s/^	//
2531,$s/	[^	].*/	/
2541,$s/,/ /
2551,$s/.*/#define	&	CURS _&/
2561,$s/strs\.//
2571,$s/strs.\(.\)/strs._\1/
2581,$g/;/d
259w
260e ./tmp/term.h.new2
261$r strvals
262w ./tmp/term.h.new1
263e ./tmp/term.h.new1
264$r ./tmp/term.h.new
265w ./tmp/term.h.new
266e ./tmp/term.h.new
2671,$s/[ 	]*$//
2681,$s/CURS _strs/CURS strs/
269w ./tmp/term.h.new
270e ./tmp/term.h.new
2711;/CURS strs/+100;.,+99s/CURS strs/CURS strs2/
272.+1,+100s/CURS strs/CURS strs3/
273.+1,$s/CURS strs/CURS strs4/
274/^struct strs/+101s/,/;/
275a
276};
277
278struct strs2 {
279    charptr
280.
281+100s/,/;/
282a
283};
284
285struct strs3 {
286    charptr
287.
288+100s/,/;/
289a
290};
291
292struct strs4 {
293    charptr
294.
2951,$s/_Sentinel/Sentinel/
296w ./tmp/term.h.new
297e ./tmp/term.h.new
298g/[ 	.]_cursor_/s/_cursor_/_crsr_/
299g/[ 	.]_delete_/s/_delete_/_dlt_/
300g/[ 	.]_enter_/s/_enter_/_entr_/
301g/[ 	.]_insert_/s/_insert_/_ins_/
302g/[ 	.]_key_/s/_key_/_ky_/
303g/[ 	.]_keypad_/s/_keypad_/_kpad_/
304g/[ 	.]_label_/s/_label_/_labl_/
305g/[ 	.]_memory_/s/_memory_/_mem_/
306g/[ 	.]_parm_/s/_parm_/_prm_/
307g/[ 	.]_scroll_/s/_scroll_/_scrll_/
308g/^	_......[,;]			\//s/,	/,/
309g/^	_..............[,;]		\//s/,	/,/
310g/^	_......................[,;]	\//s/,	/,/
311w ./tmp/term.h.new
312e ./tmp/term.h.new
313!# the following lines GO away when Vr2 compat code goes away
3141;/^#define	auto_left_margin/,/^#define	xon_xoff/s/CURB.*/CUR _b/
3151;/^#define	auto_left_margin/,/^#define	xon_xoff/w ./tmp/tmp.term.h
3161;/^#define	auto_left_margin/,/^#define	xon_xoff/d
317!/usr/bin/echo '{printf "\%s\%d\\n", $0,++i}' > ./tmp/tmp.awk
318.-1r !awk -f ./tmp/tmp.awk < ./tmp/tmp.term.h
3191;/^#define	columns/,/^#define	width_status_line/s/CURN.*/CUR _c/
3201;/^#define	columns/,/^#define	width_status_line/w ./tmp/tmp.term.h
3211;/^#define	columns/,/^#define	width_status_line/d
322!/usr/bin/echo '{printf "\%s\%d\\n", $0,++i}' > ./tmp/tmp.awk
323.-1r !awk -f ./tmp/tmp.awk < ./tmp/tmp.term.h
3241;/^#define	back_tab/,/^#define	lab_f8/s/CURS.*/CUR _Vr2_Astrs._s/
3251;/^#define	back_tab/,/^#define	lab_f8/w ./tmp/tmp.term.h
3261;/^#define	back_tab/,/^#define	lab_f8/d
327!/usr/bin/echo '{printf "\%s\%d\\n", $0,++i}' > ./tmp/tmp.awk
328.-1r !awk -f ./tmp/tmp.awk < ./tmp/tmp.term.h
3291;/^#define	lab_f9/,/^#define	prtr_non/s/CURS.*/CUR _Vr2_Bstrs._s/
3301;/^#define	lab_f9/,/^#define	prtr_non/w ./tmp/tmp.term.h
3311;/^#define	lab_f9/,/^#define	prtr_non/d
332!/usr/bin/echo 'BEGIN{i=100}\n{printf "\%s\%d\\n", $0,++i}' > ./tmp/tmp.awk
333.-1r !awk -f ./tmp/tmp.awk < ./tmp/tmp.term.h
334!rm -f ./tmp/tmp.term.h ./tmp/tmp.awk
335w ./tmp/term.h.new
336e ./tmp/term.h.new
337!# Vr2 compat code ends here
3381i
339#ifndef	_TERM_H
340#define	_TERM_H
341
342#pragma ident	"%Z%%M%	%I%	%E% SMI"
343
344/*
345 * term.h - this file is automatically made from caps and maketerm.ed.
346 * Don't make changes directly to term.h.
347 */
348
349#ifdef	__cplusplus
350extern "C" {
351#endif
352
353.
354$a
355
356struct _str_struct {
357	struct strs strs;
358	struct strs2 strs2;
359	struct strs3 strs3;
360	struct strs4 strs4;
361};
362
363#define	NUM_ATTRIBUTES	9
364#define	UNACCESSIBLE		1
365#define	NO_TERMINAL		2
366#define	CORRUPTED		3
367#define	ENTRY_TOO_LONG		4
368#define	TERMINFO_TOO_LONG	5
369#define	TERM_BAD_MALLOC		6
370#define	NOT_READABLE		7
371#define	_VR2_COMPAT_CODE
372#ifdef _VR2_COMPAT_CODE
373struct _Vr2_Astrs {
374    charptr
375	_s1,  _s2,  _s3,  _s4,  _s5,  _s6,  _s7,  _s8,  _s9,  _s10,
376	_s11, _s12, _s13, _s14, _s15, _s16, _s17, _s18, _s19, _s20,
377	_s21, _s22, _s23, _s24, _s25, _s26, _s27, _s28, _s29, _s30,
378	_s31, _s32, _s33, _s34, _s35, _s36, _s37, _s38, _s39, _s40,
379	_s41, _s42, _s43, _s44, _s45, _s46, _s47, _s48, _s49, _s50,
380	_s51, _s52, _s53, _s54, _s55, _s56, _s57, _s58, _s59, _s60,
381	_s61, _s62, _s63, _s64, _s65, _s66, _s67, _s68, _s69, _s70,
382	_s71, _s72, _s73, _s74, _s75, _s76, _s77, _s78, _s79, _s80,
383	_s81, _s82, _s83, _s84, _s85, _s86, _s87, _s88, _s89, _s90,
384	_s91, _s92, _s93, _s94, _s95, _s96, _s97, _s98, _s99, _s100;
385};
386
387struct _Vr2_Bstrs {
388    charptr
389	_s101, _s102, _s103, _s104, _s105, _s106, _s107, _s108, _s109, _s110,
390	_s111, _s112, _s113, _s114, _s115, _s116, _s117, _s118, _s119, _s120,
391	_s121, _s122, _s123, _s124, _s125, _s126, _s127, _s128, _s129, _s130,
392	_s131, _s132, _s133, _s134, _s135, _s136, _s137, _s138, _s139, _s140,
393	_s141, _s142, _s143, _s144, _s145;
394};
395#endif /* _VR2_COMPAT_CODE */
396
397typedef struct {
398	char	*_sends;	/* Characters sent when key is pressed */
399	short	_keyval;	/* "char" we pass back to program */
400} _KEY_MAP;
401
402typedef struct {
403	short	foreground;	/* foreground color */
404	short	background;	/* background color */
405	bool	init;		/* TRUE if pair was initialized */
406} _Color_pair;
407
408
409typedef struct {
410	short	r, g, b;
411} _Color;
412
413
414/*
415 * This definition for the term struct allows the boolean, number
416 * and string information to grow in the future and still allow .o
417 * compatibility.
418 */
419
420struct term {
421#ifdef _VR2_COMPAT_CODE
422    char
423	_b1,  _b2,  _b3,  _b4,  _b5,  _b6,  _b7,  _b8,  _b9,  _b10,
424	_b11, _b12, _b13, _b14, _b15, _b16, _b17, _b18, _b19, _b20, _b21;
425    short
426	_c1, _c2, _c3, _c4, _c5, _c6, _c7, _c8;
427	struct _Vr2_Astrs _Vr2_Astrs;
428	struct _Vr2_Bstrs _Vr2_Bstrs;
429#endif /* _VR2_COMPAT_CODE */
430	short	Filedes;	/* file descriptor being written to */
431	SGTTY	Ottyb,		/* original state of the terminal */
432		Nttyb;		/* current state of the terminal */
433#ifdef SYSV
434	SGTTYS	Ottybs,		/* original state of the terminal */
435		Nttybs;		/* current state of the terminal */
436#endif
437#ifdef DIOCSETT
438	struct termcb new, old;	/* CB/UNIX virtual terminals */
439#endif
440#ifdef LTILDE
441	int newlmode, oldlmode;	/* BSD tty driver */
442#endif
443	/* end of Vr2 structure */
444	struct _bool_struct *_bools;
445	struct _num_struct *_nums;
446	struct _str_struct *_strs;
447	char	*_strtab;
448#ifdef FIONREAD
449	long	timeout;		/* for BSD halfdelay mode */
450#endif
451	/* end of Vr3 structure */
452	chtype	sgr_mode;		/* current phys. graphic rendition */
453	chtype	sgr_faked;		/* attributes faked by vidputs */
454	int	_delay;			/* timeout for inputs */
455	int	_inputfd;		/* input file descriptor */
456	int	_check_fd;		/* typeahead file descriptor */
457	_KEY_MAP	**_keys,	/* key map */
458			*internal_keys;	/* pointer to free key structures */
459	short		_ksz,		/* size of keymap */
460			_lastkey_ordered, /* where the last ordered key is */
461			_lastmacro_ordered, /* where last ordered macro is */
462			_first_macro;
463	bool		funckeystarter[0400];
464					/* map of which chars start fn keys */
465	bool		_fl_rawmode,	/* in cbreak(=1) or raw(=2) mode */
466			fl_typeahdok,	/* ok to use typeahead */
467			_cursorstate,	/* cursor: 0=invis, 1=norm, 2=vvis */
468			_iwait;		/* true if input-pending */
469	short		_regs[26];	/* tparm static registers */
470#define	INP_QSIZE	32
471	chtype				/* a place to put stuff ungetch'ed */
472			_input_queue[INP_QSIZE];
473	short	_ungotten;	/* # chars ungotten by ungetch() */
474	char		_chars_on_queue; /* # chars on queue */
475#ifdef _VR3_COMPAT_CODE
476	_ochtype	*_acsmap;
477	chtype		*_acs32map;	/* map of alternate char set chars */
478#else /* _VR3_COMPAT_CODE */
479	chtype		*_acsmap;	/* map of alternate char set chars */
480#endif /* _VR3_COMPAT_CODE */
481	char		*turn_on_seq[NUM_ATTRIBUTES];
482	chtype		bit_vector;
483	char		*cursor_seq[3];
484	char		_termname[15];
485	char		*turn_off_seq[3];
486	chtype		check_turn_off;
487	chtype		non_faked_mode;
488	_Color_pair	_cur_pair;
489	_Color_pair	*_pairs_tbl;
490	_Color		*_color_tbl;
491};
492
493typedef struct term TERMINAL;
494
495/* allow old names for these capabilities */
496#define	beehive_glitch	no_esc_ctlc
497#define	teleray_glitch	dest_tabs_magic_smso
498
499extern TERMINAL			*cur_term;
500extern struct _bool_struct	*cur_bools;
501extern struct _num_struct	*cur_nums;
502extern struct _str_struct	*cur_strs;
503
504#ifdef	SINGLE
505extern TERMINAL			_first_term;
506extern struct _bool_struct	_frst_bools;
507extern struct _num_struct	_frst_nums;
508extern struct _str_struct	_frst_strs;
509
510#define	CUR			_first_term.
511#define	CURB			_frst_bools.
512#define	CURN			_frst_nums.
513#define	CURS			_frst_strs.
514#define	PROGTTY			_first_term.Nttyb
515#define	SHELLTTY		_first_term.Ottyb
516#ifdef SYSV
517#define	PROGTTYS		_first_term.Nttybs
518#define	SHELLTTYS		_first_term.Ottybs
519#endif
520#else
521#define	CUR			cur_term->
522#define	CURB			cur_bools->
523#define	CURN			cur_nums->
524#define	CURS			cur_strs->
525#define	PROGTTY			(cur_term->Nttyb)
526#define	SHELLTTY		(cur_term->Ottyb)
527#ifdef SYSV
528#define	PROGTTYS		(cur_term->Nttybs)
529#define	SHELLTTYS		(cur_term->Ottybs)
530#endif
531#endif
532
533#ifndef	NOMACROS
534#define	set_curterm	setcurterm
535#define	del_curterm	delterm
536#else	/* NOMACROS */
537
538#ifdef	__STDC__
539extern	TERMINAL	*set_curterm(TERMINAL *);
540extern	int		del_curterm(TERMINAL *);
541#else	/* __STDC__ */
542extern	TERMINAL	*set_curterm();
543extern	int		del_curterm();
544#endif	/* __STDC__ */
545
546#endif  /* NOMACROS */
547
548extern	short	term_errno;
549
550#ifdef SYSV
551extern	int	prog_istermios;
552extern	int	shell_istermios;
553#endif
554
555extern	char	term_parm_err[], *term_err_strings[], *Def_term,
556		*boolnames[], *boolcodes[], *boolfnames[],
557		*numnames[], *numcodes[], *numfnames[],
558		*strnames[], *strcodes[], *strfnames[];
559
560#ifdef __STDC__
561extern	TERMINAL	*setcurterm(TERMINAL *);
562
563#if defined(_XPG4_2) || defined(_LP64) || defined(__cplusplus)
564extern	char
565	*tparm(char *, long, long, long, long, long, long, long, long, long);
566#else
567/* this is wrong, but is needed for historical reasons */
568extern	char	*tparm();
569#endif
570
571extern char	*tgetstr(char *, char **),
572		*tigetstr(char *),
573		*termname(void);
574
575extern	int	tgetent(char *, char *), tgetflag(char *), tgetnum(char *),
576		tputs(char *, int, int (*)(char)), putp(char *),
577		tigetint(char *), tigetflag(char *), tigetnum(char *),
578		vidputs(chtype, int (*)(char)), vidattr(chtype);
579
580extern	int	resetterm(void), fixterm(void), saveterm(void),
581		restartterm(char *, int, int *), delterm(TERMINAL *);
582
583extern	void	termerr(void), tinputfd(int);
584#else  /* __STDC__ */
585extern	TERMINAL	*setcurterm();
586extern	char	*tparm(), *tgoto(), *tgetstr(), *tigetstr(),
587		*termname();
588
589extern	int	tgetent(), tgetflag(), tgetnum(),
590		tigetint(), tigetflag(), tigetnum(),
591		tputs(), putp(), vidputs(), vidattr();
592
593extern	int	resetterm(), fixterm(), saveterm(),
594		restartterm(), delterm();
595
596extern	void	termerr(), tinputfd();
597#endif /* __STDC__ */
598
599#ifdef	__cplusplus
600}
601#endif
602
603#endif	/* _TERM_H */
604.
6050r copyright.h
6061,.g/#pragma ident/d
607g/\@(\#)maketerm.ed/s//\@(\#)term.h/
6081,$s/,\/\*/, \/\*/
609w term.h
610!rm -f boolnames boolvals bool numnames numvals num strnames strvals str ./tmp/term.h.new ./tmp/tmp.awk ./tmp/tmp.term.h
611q
612