diff options
| author | Richard M. Stallman | 1995-02-14 07:43:44 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-02-14 07:43:44 +0000 |
| commit | 0c0b6c79117558ce932f2c262aab686f50c306eb (patch) | |
| tree | 7bda1cf43e55b96a9879ab89273cb585dfa2434b /src | |
| parent | b87c5d3d05ff4f1d1f5a94b5784d442a6dc9fdee (diff) | |
| download | emacs-0c0b6c79117558ce932f2c262aab686f50c306eb.tar.gz emacs-0c0b6c79117558ce932f2c262aab686f50c306eb.zip | |
(speeds): Make it ints. Add some higher speeds.
(tputs) [emacs]: If speed is high, convert to smaller units.
(tputs): Really use SPEED to calculate PADCOUNT.
Diffstat (limited to 'src')
| -rw-r--r-- | src/termcap.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/termcap.c b/src/termcap.c index bcd1ece8cfd..0d77ae45604 100644 --- a/src/termcap.c +++ b/src/termcap.c | |||
| @@ -267,14 +267,14 @@ char PC; | |||
| 267 | /* Actual baud rate if positive; | 267 | /* Actual baud rate if positive; |
| 268 | - baud rate / 100 if negative. */ | 268 | - baud rate / 100 if negative. */ |
| 269 | 269 | ||
| 270 | static short speeds[] = | 270 | static int speeds[] = |
| 271 | { | 271 | { |
| 272 | #ifdef VMS | 272 | #ifdef VMS |
| 273 | 0, 50, 75, 110, 134, 150, -3, -6, -12, -18, | 273 | 0, 50, 75, 110, 134, 150, -3, -6, -12, -18, |
| 274 | -20, -24, -36, -48, -72, -96, -192 | 274 | -20, -24, -36, -48, -72, -96, -192 |
| 275 | #else /* not VMS */ | 275 | #else /* not VMS */ |
| 276 | 0, 50, 75, 110, 135, 150, -2, -3, -6, -12, | 276 | 0, 50, 75, 110, 135, 150, -2, -3, -6, -12, |
| 277 | -18, -24, -48, -96, -192, -384 | 277 | -18, -24, -48, -96, -192, -288, -384, -576, -1152 |
| 278 | #endif /* not VMS */ | 278 | #endif /* not VMS */ |
| 279 | }; | 279 | }; |
| 280 | 280 | ||
| @@ -290,6 +290,10 @@ tputs (str, nlines, outfun) | |||
| 290 | #ifdef emacs | 290 | #ifdef emacs |
| 291 | extern baud_rate; | 291 | extern baud_rate; |
| 292 | speed = baud_rate; | 292 | speed = baud_rate; |
| 293 | /* For quite high speeds, convert to the smaller | ||
| 294 | units to avoid overflow. */ | ||
| 295 | if (speed > 10000) | ||
| 296 | speed = - speed / 100; | ||
| 293 | #else | 297 | #else |
| 294 | if (ospeed == 0) | 298 | if (ospeed == 0) |
| 295 | speed = tputs_baud_rate; | 299 | speed = tputs_baud_rate; |
| @@ -318,11 +322,14 @@ tputs (str, nlines, outfun) | |||
| 318 | while (*str) | 322 | while (*str) |
| 319 | (*outfun) (*str++); | 323 | (*outfun) (*str++); |
| 320 | 324 | ||
| 321 | /* padcount is now in units of tenths of msec. */ | 325 | /* PADCOUNT is now in units of tenths of msec. |
| 322 | padcount *= speeds[ospeed]; | 326 | SPEED is mesured in characters per 10 seconds |
| 327 | or in characters per .1 seconds (if negative). | ||
| 328 | We use the smaller units for larger speeds to avoid overflow. */ | ||
| 329 | padcount *= speed; | ||
| 323 | padcount += 500; | 330 | padcount += 500; |
| 324 | padcount /= 1000; | 331 | padcount /= 1000; |
| 325 | if (speeds[ospeed] < 0) | 332 | if (speed < 0) |
| 326 | padcount = -padcount; | 333 | padcount = -padcount; |
| 327 | else | 334 | else |
| 328 | { | 335 | { |