~ubuntu-branches/ubuntu/maverick/texinfo/maverick

« back to all changes in this revision

Viewing changes to info/terminal.c

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Preining
  • Date: 2005-10-28 15:10:30 UTC
  • mto: (2.1.1 dapper) (3.1.4 hardy)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20051028151030-9nsf2s2k2z3fktjt
Tags: upstream-4.8
ImportĀ upstreamĀ versionĀ 4.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* terminal.c -- How to handle the physical terminal for Info.
2
 
   $Id: terminal.c,v 1.23 2001/11/16 23:16:04 karl Exp $
 
1
/* terminal.c -- how to handle the physical terminal for Info.
 
2
   $Id: terminal.c,v 1.3 2004/04/11 17:56:46 karl Exp $
3
3
 
4
 
   Copyright (C) 1988, 89, 90, 91, 92, 93, 96, 97, 98, 99, 2001
5
 
   Free Software Foundation, Inc.
 
4
   Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1997, 1998,
 
5
   1999, 2001, 2002, 2004 Free Software Foundation, Inc.
6
6
 
7
7
   This program is free software; you can redistribute it and/or modify
8
8
   it under the terms of the GNU General Public License as published by
18
18
   along with this program; if not, write to the Free Software
19
19
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
20
 
21
 
   Written by Brian Fox (bfox@ai.mit.edu). */
 
21
   Originally written by Brian Fox (bfox@ai.mit.edu). */
22
22
 
23
23
#include "info.h"
24
24
#include "terminal.h"
103
103
/* The string to write to turn on the meta key, if this term has one. */
104
104
static char *term_mm;
105
105
 
106
 
/* The string to write to turn off the meta key, if this term has one. */
107
 
static char *term_mo;
108
 
 
109
106
/* The string to turn on inverse mode, if this term has one. */
110
107
static char *term_invbeg;
111
108
 
116
113
   return its argument, all the code I've looked at (termutils, less)
117
114
   does so, so fine.  */
118
115
static int
119
 
output_character_function (c)
120
 
     int c;
 
116
output_character_function (int c)
121
117
{
122
118
  putc (c, stdout);
123
119
  return c;
132
128
 
133
129
/* Tell the terminal that we will be doing cursor addressable motion.  */
134
130
static void
135
 
terminal_begin_using_terminal ()
 
131
terminal_begin_using_terminal (void)
136
132
{
137
 
  RETSIGTYPE (*sigsave) ();
 
133
  RETSIGTYPE (*sigsave) (int signum);
138
134
 
139
135
  if (term_keypad_on)
140
136
      send_to_terminal (term_keypad_on);
163
159
/* Tell the terminal that we will not be doing any more cursor
164
160
   addressable motion. */
165
161
static void
166
 
terminal_end_using_terminal ()
 
162
terminal_end_using_terminal (void)
167
163
{
168
 
  RETSIGTYPE (*sigsave) ();
 
164
  RETSIGTYPE (*sigsave) (int signum);
169
165
 
170
166
  if (term_keypad_off)
171
167
      send_to_terminal (term_keypad_off);
230
226
 
231
227
/* Move the cursor to the terminal location of X and Y. */
232
228
void
233
 
terminal_goto_xy (x, y)
234
 
     int x, y;
 
229
terminal_goto_xy (int x, int y)
235
230
{
236
231
  if (terminal_goto_xy_hook)
237
232
    (*terminal_goto_xy_hook) (x, y);
244
239
 
245
240
/* Print STRING to the terminal at the current position. */
246
241
void
247
 
terminal_put_text (string)
248
 
     char *string;
 
242
terminal_put_text (char *string)
249
243
{
250
244
  if (terminal_put_text_hook)
251
245
    (*terminal_put_text_hook) (string);
257
251
 
258
252
/* Print NCHARS from STRING to the terminal at the current position. */
259
253
void
260
 
terminal_write_chars (string, nchars)
261
 
     char *string;
262
 
     int nchars;
 
254
terminal_write_chars (char *string, int nchars)
263
255
{
264
256
  if (terminal_write_chars_hook)
265
257
    (*terminal_write_chars_hook) (string, nchars);
272
264
 
273
265
/* Clear from the current position of the cursor to the end of the line. */
274
266
void
275
 
terminal_clear_to_eol ()
 
267
terminal_clear_to_eol (void)
276
268
{
277
269
  if (terminal_clear_to_eol_hook)
278
270
    (*terminal_clear_to_eol_hook) ();
284
276
 
285
277
/* Clear the entire terminal screen. */
286
278
void
287
 
terminal_clear_screen ()
 
279
terminal_clear_screen (void)
288
280
{
289
281
  if (terminal_clear_screen_hook)
290
282
    (*terminal_clear_screen_hook) ();
296
288
 
297
289
/* Move the cursor up one line. */
298
290
void
299
 
terminal_up_line ()
 
291
terminal_up_line (void)
300
292
{
301
293
  if (terminal_up_line_hook)
302
294
    (*terminal_up_line_hook) ();
308
300
 
309
301
/* Move the cursor down one line. */
310
302
void
311
 
terminal_down_line ()
 
303
terminal_down_line (void)
312
304
{
313
305
  if (terminal_down_line_hook)
314
306
    (*terminal_down_line_hook) ();
320
312
 
321
313
/* Turn on reverse video if possible. */
322
314
void
323
 
terminal_begin_inverse ()
 
315
terminal_begin_inverse (void)
324
316
{
325
317
  if (terminal_begin_inverse_hook)
326
318
    (*terminal_begin_inverse_hook) ();
332
324
 
333
325
/* Turn off reverse video if possible. */
334
326
void
335
 
terminal_end_inverse ()
 
327
terminal_end_inverse (void)
336
328
{
337
329
  if (terminal_end_inverse_hook)
338
330
    (*terminal_end_inverse_hook) ();
345
337
/* Ring the terminal bell.  The bell is run visibly if it both has one and
346
338
   terminal_use_visible_bell_p is non-zero. */
347
339
void
348
 
terminal_ring_bell ()
 
340
terminal_ring_bell (void)
349
341
{
350
342
  if (terminal_ring_bell_hook)
351
343
    (*terminal_ring_bell_hook) ();
360
352
 
361
353
/* At the line START, delete COUNT lines from the terminal display. */
362
354
static void
363
 
terminal_delete_lines (start, count)
364
 
     int start, count;
 
355
terminal_delete_lines (int start, int count)
365
356
{
366
357
  int lines;
367
358
 
384
375
 
385
376
/* At the line START, insert COUNT lines in the terminal display. */
386
377
static void
387
 
terminal_insert_lines (start, count)
388
 
     int start, count;
 
378
terminal_insert_lines (int start, int count)
389
379
{
390
380
  int lines;
391
381
 
412
402
   towards the top of the screen, else they are scrolled towards the
413
403
   bottom of the screen. */
414
404
void
415
 
terminal_scroll_terminal (start, end, amount)
416
 
     int start, end, amount;
 
405
terminal_scroll_terminal (int start, int end, int amount)
417
406
{
418
407
  if (!terminal_can_scroll)
419
408
    return;
449
438
/* Re-initialize the terminal considering that the TERM/TERMCAP variable
450
439
   has changed. */
451
440
void
452
 
terminal_new_terminal (terminal_name)
453
 
     char *terminal_name;
 
441
terminal_new_terminal (char *terminal_name)
454
442
{
455
443
  if (terminal_new_terminal_hook)
456
444
    (*terminal_new_terminal_hook) (terminal_name);
462
450
 
463
451
/* Set the global variables SCREENWIDTH and SCREENHEIGHT. */
464
452
void
465
 
terminal_get_screen_size ()
 
453
terminal_get_screen_size (void)
466
454
{
467
455
  if (terminal_get_screen_size_hook)
468
456
    (*terminal_get_screen_size_hook) ();
522
510
   TERMINAL_HAS_META_P becomes nonzero if this terminal supports a Meta
523
511
   key.  Finally, the terminal screen is cleared. */
524
512
void
525
 
terminal_initialize_terminal (terminal_name)
526
 
     char *terminal_name;
 
513
terminal_initialize_terminal (char *terminal_name)
527
514
{
528
515
  char *buffer;
529
516
 
632
619
  if (terminal_has_meta_p)
633
620
    {
634
621
      term_mm = tgetstr ("mm", &buffer);
635
 
      term_mo = tgetstr ("mo", &buffer);
636
622
    }
637
623
  else
638
624
    {
639
625
      term_mm = NULL;
640
 
      term_mo = NULL;
641
626
    }
642
627
 
643
628
  /* Attempt to find the arrow keys.  */
704
689
 
705
690
/* Prepare to start using the terminal to read characters singly. */
706
691
void
707
 
terminal_prep_terminal ()
 
692
terminal_prep_terminal (void)
708
693
{
709
694
  int tty;
710
695
 
844
829
/* Restore the tty settings back to what they were before we started using
845
830
   this terminal. */
846
831
void
847
 
terminal_unprep_terminal ()
 
832
terminal_unprep_terminal (void)
848
833
{
849
834
  int tty;
850
835