home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 332_01 / charpick.c < prev    next >
C/C++ Source or Header  |  1990-01-06  |  3KB  |  72 lines

  1. /****************************************************************/
  2. /* Winch() routine of the PCcurses package            */
  3. /*                                */
  4. /****************************************************************/
  5. /* This version of curses is based on ncurses, a curses version    */
  6. /* originally written by Pavel Curtis at Cornell University.    */
  7. /* I have made substantial changes to make it run on IBM PC's,    */
  8. /* and therefore consider myself free to make it public domain.    */
  9. /*                Bjorn Larsson (bl@infovox.se)    */
  10. /****************************************************************/
  11. /* 1.4:  Use of short wherever possible. Portability        */
  12. /*     improvements:                    900114    */
  13. /* 1.3:     MSC -W3, Turbo'C' -w -w-pro checkes:        881005    */
  14. /* 1.2:     Rcsid[] string for maintenance:        881002    */
  15. /* 1.0:     Release:                    870515    */
  16. /****************************************************************/
  17.  
  18. #include <curses.h>
  19. #include <curspriv.h>
  20.  
  21. char _curses_charpick_rcsid[] = "@(#)charpick.c   v.1.4  - 900114";
  22.  
  23. /****************************************************************/
  24. /* Winch(win) returns the character at the current position in    */
  25. /* window 'win'.                        */
  26. /****************************************************************/
  27.  
  28. int    winch(win)
  29.   WINDOW    *win;
  30.   {
  31.   return((win->_line[win->_cury][win->_curx]) & 0xff);
  32.   } /* winch */
  33.  
  34. /****************************************************************/
  35. /* Inch() returns the character at the current cursor position    */
  36. /* in stdscr.                            */
  37. /****************************************************************/
  38.  
  39. int inch()
  40.   {
  41.   return((stdscr->_line[stdscr->_cury][stdscr->_curx]) & 0xff);
  42.   } /* inch */
  43.  
  44. /****************************************************************/
  45. /* Mvinch() moves the stdscr cursor to a new position, then    */
  46. /* returns the character at that position.            */
  47. /****************************************************************/
  48.  
  49. int mvinch(y,x)
  50.   int  y;
  51.   int  x;
  52.   {
  53.   if (wmove(stdscr,y,x) == ERR)
  54.     return(ERR);
  55.   return((stdscr->_line[stdscr->_cury][stdscr->_curx]) & 0xff);
  56.   } /* mvinch */
  57.  
  58. /****************************************************************/
  59. /* Mvwinch() moves the cursor of window 'win' to a new posi-    */
  60. /* tion, then returns the character at that position.        */
  61. /****************************************************************/
  62.  
  63. int mvwinch(win,y,x)
  64.   WINDOW *win;
  65.   int  y;
  66.   int  x;
  67.   {
  68.   if (wmove(win,y,x) == ERR)
  69.     return(ERR);
  70.   return((win->_line[win->_cury][win->_curx]) & 0xff);
  71.   } /* mvwinch */
  72.