7 #if defined(unix) && !defined(GO32)
16 #if defined(unix) && !defined(GO32)
17 static int sigwinch (int sigtype
)
19 extern void schedule_update(void);
21 signal (SIGWINCH
, (void *) sigwinch
);
26 int display_rows
, display_cols
;
28 void display_beep(void)
33 static void get_screen_size (void) {
37 struct winsize wind_struct
;
39 if ((ioctl(1,TIOCGWINSZ
,&wind_struct
) == 0)
40 || (ioctl(0, TIOCGWINSZ
, &wind_struct
) == 0)
41 || (ioctl(2, TIOCGWINSZ
, &wind_struct
) == 0)) {
42 c
= (int) wind_struct
.ws_col
;
43 r
= (int) wind_struct
.ws_row
;
49 int86 (0x10, ®s
, ®s
);
52 regs
.x
.ax
= 0x1130, regs
.h
.bh
= 0;
53 int86 (0x10, ®s
, ®s
);
57 if ((r
<= 0) || (r
> 200)) r
= 24;
58 if ((c
<= 0) || (c
> 250)) c
= 80;
59 display_rows
= SLtt_Screen_Rows
= r
;
60 display_cols
= SLtt_Screen_Cols
= c
;
63 void display_setup(void)
67 if (SLang_init_tty (ABORT
, 1, 0) == -1) {
68 fprintf(stderr
, "tweak: SLang_init_tty: returned error code\n");
71 SLang_set_abort_signal (NULL
);
72 SLtt_Use_Ansi_Colors
= TRUE
;
75 if (SLsmg_init_smg () < 0) {
76 fprintf(stderr
, "tweak: SLsmg_init_smg: returned error code\n");
81 #if defined(unix) && !defined(GO32)
82 signal (SIGWINCH
, (void *) sigwinch
);
86 void display_cleanup(void)
92 void display_moveto(int y
, int x
)
97 void display_refresh(void)
102 void display_write_str(char *str
)
104 SLsmg_write_nchars(str
, strlen(str
));
107 void display_write_chars(char *str
, int len
)
109 SLsmg_write_nchars(str
, len
);
112 void display_define_colour(int colour
, int fg
, int bg
)
114 static char *colours
[16] = {
115 "black", "red", "green", "brown",
116 "blue", "magenta", "cyan", "lightgray",
117 "gray", "brightred", "brightgreen", "yellow",
118 "brightblue", "brightmagenta", "brightcyan", "white",
122 sprintf(cname
, "colour%d", colour
);
124 SLtt_set_color(colour
, cname
, colours
[fg
], colours
[bg
]);
127 void display_set_colour(int colour
)
129 SLsmg_set_color(colour
);
132 void display_clear_to_eol(void)
137 int display_getkey(void)
139 return SLang_getkey();
142 int display_input_to_flush(void)
144 return SLang_input_pending(0);
147 void display_post_error(void)
153 void display_recheck_size(void)