home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / git-4.3 / git-4 / git-4.3.11 / src / window.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-22  |  1.9 KB  |  102 lines

  1. /* window.c -- A *very* simple window management.  */
  2.  
  3. /* Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
  4.  
  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License as published by
  7.    the Free Software Foundation; either version 2, or (at your option)
  8.    any later version.
  9.  
  10.    This program is distributed in the hope that it will be useful,
  11.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.    GNU General Public License for more details.
  14.  
  15.    You should have received a copy of the GNU General Public License
  16.    along with this program; if not, write to the Free Software
  17.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  18.  
  19. /* Written by Tudor Hulubei and Andrei Pitis.  */
  20.  
  21.  
  22. #ifdef HAVE_CONFIG_H
  23. #include <config.h>
  24. #endif
  25.  
  26. #include <stdio.h>
  27.  
  28. #ifdef HAVE_STDLIB_H
  29. #include <stdlib.h>
  30. #else /* !HAVE_STDLIB_H */
  31. #include "ansi_stdlib.h"
  32. #endif /* !HAVE_STDLIB_H */
  33.  
  34. #include "window.h"
  35. #include "xmalloc.h"
  36. #include "tty.h"
  37.  
  38.  
  39. window_t *
  40. window_init(x, y, lines, columns)
  41.     size_t x, y, lines, columns;
  42. {
  43.     window_t *this  = (window_t *)xmalloc(sizeof(window_t));
  44.  
  45.     window_resize(this, x, y, lines, columns);
  46.     return this;
  47. }
  48.  
  49.  
  50. void
  51. window_end(win)
  52.     window_t *win;
  53. {
  54.     if (win)
  55.     xfree(win);
  56. }
  57.  
  58.  
  59. void
  60. window_resize(this, x, y, lines, columns)
  61.     window_t *this;
  62.     size_t x, y, lines, columns;
  63. {
  64.     this->x       = x;
  65.     this->y       = y;
  66.     this->lines   = lines;
  67.     this->columns = columns;
  68. }
  69.  
  70.  
  71. size_t
  72. window_puts(str, length)
  73.     char *str;
  74.     size_t length;
  75. {
  76.     return tty_puts(str, length);
  77. }
  78.  
  79.  
  80. size_t
  81. window_putc(c)
  82.     char c;
  83. {
  84.     return tty_putc(c);
  85. }
  86.  
  87.  
  88. void
  89. window_goto(this, y, x)
  90.     window_t *this;
  91.     size_t y, x;
  92. {
  93.     tty_goto(y + this->y, x + this->x);
  94. }
  95.  
  96.  
  97. void
  98. window_update()
  99. {
  100.     tty_update();
  101. }
  102.