home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / CURSES.LZH / CHARPICK.C < prev    next >
C/C++ Source or Header  |  1980-01-01  |  2KB  |  70 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 (...mcvax!enea!infovax!bl)    */
  10. /****************************************************************/
  11. /* 1.0:    Release:                    870515    */
  12. /* 1.2:    Rcsid[] string for maintenance:            881002    */
  13. /* 1.3:    MSC -W3, Turbo'C' -w -w-pro checkes:        881005    */
  14. /****************************************************************/
  15.  
  16. #include <curses.h>
  17. #include <curspriv.h>
  18.  
  19. char _curses_charpick_rcsid[] = "@(#)charpick.c v1.3 - 881005";
  20.  
  21. /****************************************************************/
  22. /* Winch(win) returns the character at the current position in    */
  23. /* window 'win'.                        */
  24. /****************************************************************/
  25.  
  26. int    winch(win)
  27.   WINDOW    *win;
  28.   {
  29.   return((win->_line[win->_cury][win->_curx]) & 0xff);
  30.   } /* winch */
  31.  
  32. /****************************************************************/
  33. /* Inch() returns the character at the current cursor position    */
  34. /* in stdscr.                            */
  35. /****************************************************************/
  36.  
  37. int inch()
  38.   {
  39.   return((stdscr->_line[stdscr->_cury][stdscr->_curx]) & 0xff);
  40.   } /* inch */
  41.  
  42. /****************************************************************/
  43. /* Mvinch() moves the stdscr cursor to a new position, then    */
  44. /* returns the character at that position.            */
  45. /****************************************************************/
  46.  
  47. int mvinch(y,x)
  48.   int  y;
  49.   int  x;
  50.   {
  51.   if (wmove(stdscr,y,x) == ERR)
  52.     return(ERR);
  53.   return((stdscr->_line[stdscr->_cury][stdscr->_curx]) & 0xff);
  54.   } /* mvinch */
  55.  
  56. /****************************************************************/
  57. /* Mvwinch() moves the cursor of window 'win' to a new posi-    */
  58. /* tion, then returns the character at that position.        */
  59. /****************************************************************/
  60.  
  61. int mvwinch(win,y,x)
  62.   WINDOW *win;
  63.   int  y;
  64.   int  x;
  65.   {
  66.   if (wmove(win,y,x) == ERR)
  67.     return(ERR);
  68.   return((win->_line[win->_cury][win->_curx]) & 0xff);
  69.   } /* mvwinch */
  70.