xref: /titanic_41/usr/src/lib/libcurses/screen/maketerm.ed (revision fd9cb95cbb2f626355a60efb9d02c5f0a33c10e6)
1!#ident	"%Z%%M%	%I%	%E% SMI"
2H
3!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
4e caps
5g/^#/d
6/--- begin bool/+1,/--- end bool/-1 w bool
7/--- begin num/+1,/--- end num/-1 w num
8/--- begin str/+1,/--- end str/-1 w str
9E bool
101,$s/"	.*/", /
111,$s/.*	"/"/
121,$-10g/^/.,+9j
13+,$j
141i
15char	*boolnames[] =
16	{
17.
18$a
190
20	};
21
22.
23w tinames.c
24e bool
251,$s/^[^"]*"[^"]*".//
261,$s/"	.*/", /
271,$-10g/^/.,+9j
28+,$j
291i
30char	*boolcodes[] =
31	{
32.
33$a
340
35	};
36
37.
38w tnames.c
39e bool
401,$s/^\([a-z][0-9a-z_]*\),.*/"\1", /
411,$-4g/^/.,+3j
42+,$j
431i
44char	*boolfnames[] =
45	{
46.
47$a
480
49	};
50
51.
52w tifnames.c
53e bool
541,$s;"[^"]*"[ 	]*".."	;/* ;
551,$s;$; */;
561,$s;^;	;
571i
58    char
59.
60$a
61	Sentinel;		/* End of bools. DO NOT MOVE! */
62.
63w boolvals
64e num
651,$s/"	.*/", /
661,$s/.*	"/"/
671,$-10g/^/.,+9j
68+,$j
691i
70char	*numnames[] =
71	{
72.
73$a
740
75	};
76
77.
780r tinames.c
79w tinames.c
80e num
811,$s/^[^"]*"[^"]*".//
821,$s/"	.*/", /
831,$-10g/^/.,+9j
84+,$j
851i
86char	*numcodes[] =
87	{
88.
89$a
900
91	};
92
93.
940r tnames.c
95w tnames.c
96e num
971,$s/^\([a-z][0-9a-z_]*\),.*/"\1", /
981,$-4g/^/.,+3j
99+,$j
1001i
101char	*numfnames[] =
102	{
103.
104$a
1050
106	};
107
108.
1090r tifnames.c
110w tifnames.c
111e num
1121,$s;"[^"]*"[ 	]*".."	;/* ;
1131,$s;$; */;
1141,$s;^;	;
1151i
116    short
117.
118$a
119	Sentinel;		/* End of nums. DO NOT MOVE! */
120.
121w numvals
122e str
1231,$s/"	.*/", /
1241,$s/.*	"/"/
1251,$-10g/^/.,+9j
126+,$j
1271i
128char	*strnames[] =
129	{
130.
131$a
1320
133	};
134
135.
1360r tinames.c
137w tinames.c
138e str
1391,$s/^[^"]*"[^"]*".//
1401,$s/"	.*/", /
1411,$-10g/^/.,+9j
142+,$j
1431i
144char	*strcodes[] =
145	{
146.
147$a
1480
149	};
150
151.
1520r tnames.c
153w tnames.c
154e str
1551,$s/^\([a-z][0-9a-z_]*\),.*/"\1", /
1561,$-4g/^/.,+3j
157+,$j
1581i
159char	*strfnames[] =
160	{
161.
162$a
1630
164	};
165
166.
1670r tifnames.c
168w tifnames.c
169e str
1701,$s;"[^"]*"[ 	]*".."	;/* ;
1711,$s;$; */;
1721,$s;^;	strs.;
173$a
174	Sentinel;		/* End of strings. DO NOT MOVE! */
175.
176w strvals
1771,$d
178r tnames.c
1791i
180#pragma ident	"%Z%%M%	%I%	%E% SMI"
181
182/* tnames.c: Made automatically from caps and maketerm.ed - don't edit me! */
183.
1841,$s/ $//
1850r copyright.h
186/copyright\.h/d
187w tnames.c
1881,$d
189r tinames.c
1901i
191#pragma ident	"%Z%%M%	%I%	%E% SMI"
192
193/* tinames.c: Made automatically from caps and maketerm.ed - don't edit me! */
194.
1951,$s/ $//
1960r copyright.h
197/copyright\.h/d
198w tinames.c
1991,$d
200r tifnames.c
2011i
202#pragma ident	"%Z%%M%	%I%	%E% SMI"
203
204/* tifnames.c: Made automatically from caps and maketerm.ed - don't edit me! */
205.
2061,$s/ $//
2070r copyright.h
208/copyright\.h/d
209w tifnames.c
210e bool
2111,$d
212a
213
214typedef char *charptr;
215struct strs {
216    charptr
217.
218r strvals
2191,.s/strs\.//
220$a
221};
222
223struct _bool_struct {
224.
225r boolvals
226a
227};
228
229struct _num_struct {
230.
231r numvals
232a
233};
234.
235w ./tmp/term.h.new
236e ./tmp/term.h.new
237g/^	./s/^	/	_/
238w ./tmp/term.h.new
239e boolvals
240.kb
241.r numvals
242.kn
2431,$v/^	/d
2441,$s/^	//
2451,$s/	[^	].*/	/
2461,$s/,/ /
2471,'bs/.*/#define	&	CURB _&/
248'b+1,'ns/.*/#define	&	CURN _&/
2491,$g/;/d
250w ./tmp/term.h.new2
251e strvals
2521,$v/^	/d
2531,$s/^	//
2541,$s/	[^	].*/	/
2551,$s/,/ /
2561,$s/.*/#define	&	CURS _&/
2571,$s/strs\.//
2581,$s/strs.\(.\)/strs._\1/
2591,$g/;/d
260w
261e ./tmp/term.h.new2
262$r strvals
263w ./tmp/term.h.new1
264e ./tmp/term.h.new1
265$r ./tmp/term.h.new
266w ./tmp/term.h.new
267e ./tmp/term.h.new
2681,$s/[ 	]*$//
2691,$s/CURS _strs/CURS strs/
270w ./tmp/term.h.new
271e ./tmp/term.h.new
2721;/CURS strs/+100;.,+99s/CURS strs/CURS strs2/
273.+1,+100s/CURS strs/CURS strs3/
274.+1,$s/CURS strs/CURS strs4/
275/^struct strs/+101s/,/;/
276a
277};
278
279struct strs2 {
280    charptr
281.
282+100s/,/;/
283a
284};
285
286struct strs3 {
287    charptr
288.
289+100s/,/;/
290a
291};
292
293struct strs4 {
294    charptr
295.
2961,$s/_Sentinel/Sentinel/
297w ./tmp/term.h.new
298e ./tmp/term.h.new
299g/[ 	.]_cursor_/s/_cursor_/_crsr_/
300g/[ 	.]_delete_/s/_delete_/_dlt_/
301g/[ 	.]_enter_/s/_enter_/_entr_/
302g/[ 	.]_insert_/s/_insert_/_ins_/
303g/[ 	.]_key_/s/_key_/_ky_/
304g/[ 	.]_keypad_/s/_keypad_/_kpad_/
305g/[ 	.]_label_/s/_label_/_labl_/
306g/[ 	.]_memory_/s/_memory_/_mem_/
307g/[ 	.]_parm_/s/_parm_/_prm_/
308g/[ 	.]_scroll_/s/_scroll_/_scrll_/
309g/^	_......[,;]			\//s/,	/,/
310g/^	_..............[,;]		\//s/,	/,/
311g/^	_......................[,;]	\//s/,	/,/
312w ./tmp/term.h.new
313e ./tmp/term.h.new
314!# the following lines GO away when Vr2 compat code goes away
3151;/^#define	auto_left_margin/,/^#define	xon_xoff/s/CURB.*/CUR _b/
3161;/^#define	auto_left_margin/,/^#define	xon_xoff/w ./tmp/tmp.term.h
3171;/^#define	auto_left_margin/,/^#define	xon_xoff/d
318!/usr/bin/echo '{printf "\%s\%d\\n", $0,++i}' > ./tmp/tmp.awk
319.-1r !awk -f ./tmp/tmp.awk < ./tmp/tmp.term.h
3201;/^#define	columns/,/^#define	width_status_line/s/CURN.*/CUR _c/
3211;/^#define	columns/,/^#define	width_status_line/w ./tmp/tmp.term.h
3221;/^#define	columns/,/^#define	width_status_line/d
323!/usr/bin/echo '{printf "\%s\%d\\n", $0,++i}' > ./tmp/tmp.awk
324.-1r !awk -f ./tmp/tmp.awk < ./tmp/tmp.term.h
3251;/^#define	back_tab/,/^#define	lab_f8/s/CURS.*/CUR _Vr2_Astrs._s/
3261;/^#define	back_tab/,/^#define	lab_f8/w ./tmp/tmp.term.h
3271;/^#define	back_tab/,/^#define	lab_f8/d
328!/usr/bin/echo '{printf "\%s\%d\\n", $0,++i}' > ./tmp/tmp.awk
329.-1r !awk -f ./tmp/tmp.awk < ./tmp/tmp.term.h
3301;/^#define	lab_f9/,/^#define	prtr_non/s/CURS.*/CUR _Vr2_Bstrs._s/
3311;/^#define	lab_f9/,/^#define	prtr_non/w ./tmp/tmp.term.h
3321;/^#define	lab_f9/,/^#define	prtr_non/d
333!/usr/bin/echo 'BEGIN{i=100}\n{printf "\%s\%d\\n", $0,++i}' > ./tmp/tmp.awk
334.-1r !awk -f ./tmp/tmp.awk < ./tmp/tmp.term.h
335!rm -f ./tmp/tmp.term.h ./tmp/tmp.awk
336w ./tmp/term.h.new
337e ./tmp/term.h.new
338!# Vr2 compat code ends here
3391i
340#ifndef	_TERM_H
341#define	_TERM_H
342
343#pragma ident	"%Z%%M%	%I%	%E% SMI"
344
345/*
346 * term.h - this file is automatically made from caps and maketerm.ed.
347 * Don't make changes directly to term.h.
348 */
349
350#ifdef	__cplusplus
351extern "C" {
352#endif
353
354.
355$a
356
357struct _str_struct {
358	struct strs strs;
359	struct strs2 strs2;
360	struct strs3 strs3;
361	struct strs4 strs4;
362};
363
364#define	NUM_ATTRIBUTES	9
365#define	UNACCESSIBLE		1
366#define	NO_TERMINAL		2
367#define	CORRUPTED		3
368#define	ENTRY_TOO_LONG		4
369#define	TERMINFO_TOO_LONG	5
370#define	TERM_BAD_MALLOC		6
371#define	NOT_READABLE		7
372#define	_VR2_COMPAT_CODE
373#ifdef _VR2_COMPAT_CODE
374struct _Vr2_Astrs {
375    charptr
376	_s1,  _s2,  _s3,  _s4,  _s5,  _s6,  _s7,  _s8,  _s9,  _s10,
377	_s11, _s12, _s13, _s14, _s15, _s16, _s17, _s18, _s19, _s20,
378	_s21, _s22, _s23, _s24, _s25, _s26, _s27, _s28, _s29, _s30,
379	_s31, _s32, _s33, _s34, _s35, _s36, _s37, _s38, _s39, _s40,
380	_s41, _s42, _s43, _s44, _s45, _s46, _s47, _s48, _s49, _s50,
381	_s51, _s52, _s53, _s54, _s55, _s56, _s57, _s58, _s59, _s60,
382	_s61, _s62, _s63, _s64, _s65, _s66, _s67, _s68, _s69, _s70,
383	_s71, _s72, _s73, _s74, _s75, _s76, _s77, _s78, _s79, _s80,
384	_s81, _s82, _s83, _s84, _s85, _s86, _s87, _s88, _s89, _s90,
385	_s91, _s92, _s93, _s94, _s95, _s96, _s97, _s98, _s99, _s100;
386};
387
388struct _Vr2_Bstrs {
389    charptr
390	_s101, _s102, _s103, _s104, _s105, _s106, _s107, _s108, _s109, _s110,
391	_s111, _s112, _s113, _s114, _s115, _s116, _s117, _s118, _s119, _s120,
392	_s121, _s122, _s123, _s124, _s125, _s126, _s127, _s128, _s129, _s130,
393	_s131, _s132, _s133, _s134, _s135, _s136, _s137, _s138, _s139, _s140,
394	_s141, _s142, _s143, _s144, _s145;
395};
396#endif /* _VR2_COMPAT_CODE */
397
398typedef struct {
399	char	*_sends;	/* Characters sent when key is pressed */
400	short	_keyval;	/* "char" we pass back to program */
401} _KEY_MAP;
402
403typedef struct {
404	short	foreground;	/* foreground color */
405	short	background;	/* background color */
406	bool	init;		/* TRUE if pair was initialized */
407} _Color_pair;
408
409
410typedef struct {
411	short	r, g, b;
412} _Color;
413
414
415/*
416 * This definition for the term struct allows the boolean, number
417 * and string information to grow in the future and still allow .o
418 * compatibility.
419 */
420
421struct term {
422#ifdef _VR2_COMPAT_CODE
423    char
424	_b1,  _b2,  _b3,  _b4,  _b5,  _b6,  _b7,  _b8,  _b9,  _b10,
425	_b11, _b12, _b13, _b14, _b15, _b16, _b17, _b18, _b19, _b20, _b21;
426    short
427	_c1, _c2, _c3, _c4, _c5, _c6, _c7, _c8;
428	struct _Vr2_Astrs _Vr2_Astrs;
429	struct _Vr2_Bstrs _Vr2_Bstrs;
430#endif /* _VR2_COMPAT_CODE */
431	short	Filedes;	/* file descriptor being written to */
432	SGTTY	Ottyb,		/* original state of the terminal */
433		Nttyb;		/* current state of the terminal */
434#ifdef SYSV
435	SGTTYS	Ottybs,		/* original state of the terminal */
436		Nttybs;		/* current state of the terminal */
437#endif
438#ifdef DIOCSETT
439	struct termcb new, old;	/* CB/UNIX virtual terminals */
440#endif
441#ifdef LTILDE
442	int newlmode, oldlmode;	/* BSD tty driver */
443#endif
444	/* end of Vr2 structure */
445	struct _bool_struct *_bools;
446	struct _num_struct *_nums;
447	struct _str_struct *_strs;
448	char	*_strtab;
449#ifdef FIONREAD
450	long	timeout;		/* for BSD halfdelay mode */
451#endif
452	/* end of Vr3 structure */
453	chtype	sgr_mode;		/* current phys. graphic rendition */
454	chtype	sgr_faked;		/* attributes faked by vidputs */
455	int	_delay;			/* timeout for inputs */
456	int	_inputfd;		/* input file descriptor */
457	int	_check_fd;		/* typeahead file descriptor */
458	_KEY_MAP	**_keys,	/* key map */
459			*internal_keys;	/* pointer to free key structures */
460	short		_ksz,		/* size of keymap */
461			_lastkey_ordered, /* where the last ordered key is */
462			_lastmacro_ordered, /* where last ordered macro is */
463			_first_macro;
464	bool		funckeystarter[0400];
465					/* map of which chars start fn keys */
466	bool		_fl_rawmode,	/* in cbreak(=1) or raw(=2) mode */
467			fl_typeahdok,	/* ok to use typeahead */
468			_cursorstate,	/* cursor: 0=invis, 1=norm, 2=vvis */
469			_iwait;		/* true if input-pending */
470	short		_regs[26];	/* tparm static registers */
471#define	INP_QSIZE	32
472	chtype				/* a place to put stuff ungetch'ed */
473			_input_queue[INP_QSIZE];
474	short	_ungotten;	/* # chars ungotten by ungetch() */
475	char		_chars_on_queue; /* # chars on queue */
476#ifdef _VR3_COMPAT_CODE
477	_ochtype	*_acsmap;
478	chtype		*_acs32map;	/* map of alternate char set chars */
479#else /* _VR3_COMPAT_CODE */
480	chtype		*_acsmap;	/* map of alternate char set chars */
481#endif /* _VR3_COMPAT_CODE */
482	char		*turn_on_seq[NUM_ATTRIBUTES];
483	chtype		bit_vector;
484	char		*cursor_seq[3];
485	char		_termname[15];
486	char		*turn_off_seq[3];
487	chtype		check_turn_off;
488	chtype		non_faked_mode;
489	_Color_pair	_cur_pair;
490	_Color_pair	*_pairs_tbl;
491	_Color		*_color_tbl;
492};
493
494typedef struct term TERMINAL;
495
496/* allow old names for these capabilities */
497#define	beehive_glitch	no_esc_ctlc
498#define	teleray_glitch	dest_tabs_magic_smso
499
500extern TERMINAL			*cur_term;
501extern struct _bool_struct	*cur_bools;
502extern struct _num_struct	*cur_nums;
503extern struct _str_struct	*cur_strs;
504
505#ifdef	SINGLE
506extern TERMINAL			_first_term;
507extern struct _bool_struct	_frst_bools;
508extern struct _num_struct	_frst_nums;
509extern struct _str_struct	_frst_strs;
510
511#define	CUR			_first_term.
512#define	CURB			_frst_bools.
513#define	CURN			_frst_nums.
514#define	CURS			_frst_strs.
515#define	PROGTTY			_first_term.Nttyb
516#define	SHELLTTY		_first_term.Ottyb
517#ifdef SYSV
518#define	PROGTTYS		_first_term.Nttybs
519#define	SHELLTTYS		_first_term.Ottybs
520#endif
521#else
522#define	CUR			cur_term->
523#define	CURB			cur_bools->
524#define	CURN			cur_nums->
525#define	CURS			cur_strs->
526#define	PROGTTY			(cur_term->Nttyb)
527#define	SHELLTTY		(cur_term->Ottyb)
528#ifdef SYSV
529#define	PROGTTYS		(cur_term->Nttybs)
530#define	SHELLTTYS		(cur_term->Ottybs)
531#endif
532#endif
533
534#ifndef	NOMACROS
535#define	set_curterm	setcurterm
536#define	del_curterm	delterm
537#else	/* NOMACROS */
538
539#ifdef	__STDC__
540extern	TERMINAL	*set_curterm(TERMINAL *);
541extern	int		del_curterm(TERMINAL *);
542#else	/* __STDC__ */
543extern	TERMINAL	*set_curterm();
544extern	int		del_curterm();
545#endif	/* __STDC__ */
546
547#endif  /* NOMACROS */
548
549extern	short	term_errno;
550
551#ifdef SYSV
552extern	int	prog_istermios;
553extern	int	shell_istermios;
554#endif
555
556extern	char	term_parm_err[], *term_err_strings[], *Def_term,
557		*boolnames[], *boolcodes[], *boolfnames[],
558		*numnames[], *numcodes[], *numfnames[],
559		*strnames[], *strcodes[], *strfnames[];
560
561#ifdef __STDC__
562extern	TERMINAL	*setcurterm(TERMINAL *);
563
564#if defined(_XPG4_2) || defined(_LP64) || defined(__cplusplus)
565extern	char
566	*tparm(char *, long, long, long, long, long, long, long, long, long);
567#else
568/* this is wrong, but is needed for historical reasons */
569extern	char	*tparm();
570#endif
571
572extern char	*tgetstr(char *, char **),
573		*tigetstr(char *),
574		*termname(void);
575
576extern	int	tgetent(char *, char *), tgetflag(char *), tgetnum(char *),
577		tputs(char *, int, int (*)(char)), putp(char *),
578		tigetint(char *), tigetflag(char *), tigetnum(char *),
579		vidputs(chtype, int (*)(char)), vidattr(chtype);
580
581extern	int	resetterm(void), fixterm(void), saveterm(void),
582		restartterm(char *, int, int *), delterm(TERMINAL *);
583
584extern	void	termerr(void), tinputfd(int);
585#else  /* __STDC__ */
586extern	TERMINAL	*setcurterm();
587extern	char	*tparm(), *tgoto(), *tgetstr(), *tigetstr(),
588		*termname();
589
590extern	int	tgetent(), tgetflag(), tgetnum(),
591		tigetint(), tigetflag(), tigetnum(),
592		tputs(), putp(), vidputs(), vidattr();
593
594extern	int	resetterm(), fixterm(), saveterm(),
595		restartterm(), delterm();
596
597extern	void	termerr(), tinputfd();
598#endif /* __STDC__ */
599
600#ifdef	__cplusplus
601}
602#endif
603
604#endif	/* _TERM_H */
605.
6060r copyright.h
607/copyright\.h/d
6081,$s/\@(\#)maketerm.ed/\@(\#)term.h/
6091,$s/,\/\*/, \/\*/
610w term.h
611!rm -f boolnames boolvals bool numnames numvals num strnames strvals str ./tmp/term.h.new ./tmp/tmp.awk ./tmp/tmp.term.h
612q
613