sup

A curses threads-with-tags style email client

ncursesw-ruby.git

git clone https://supmua.dev/git/ncursesw-ruby/

ncurses_wrap.h (4754B) - raw

      1 /*
      2  * ncurses-ruby is a ruby module for accessing the FSF's ncurses library
      3  * (C) 2002, 2003 Tobias Peters <t-peters@berlios.de>
      4  * (C) 2004 Simon Kaczor <skaczor@cox.net>
      5  * (C) 2009 2011 Tobias Herzke
      6  * (C) 2013 Gaute Hope <eg@gaute.vetsj.com>
      7  *
      8  *  This module is free software; you can redistribute it and/or
      9  *  modify it under the terms of the GNU Lesser General Public
     10  *  License as published by the Free Software Foundation; either
     11  *  version 2 of the License, or (at your option) any later version.
     12  *
     13  *  This module is distributed in the hope that it will be useful,
     14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     16  *  Lesser General Public License for more details.
     17  *
     18  *  You should have received a copy of the GNU Lesser General Public
     19  *  License along with this module; if not, write to the Free Software
     20  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
     21  *
     22  * $Id: ncurses_wrap.h,v 1.4 2011-05-30 23:05:50 t-peters Exp $
     23  *
     24  * This file was adapted from the original ncurses header file which
     25  * has the following copyright statements:
     26  */
     27 
     28 /****************************************************************************
     29  * Copyright (c) 1998 Free Software Foundation, Inc.                        *
     30  *                                                                          *
     31  * Permission is hereby granted, free of charge, to any person obtaining a  *
     32  * copy of this software and associated documentation files (the            *
     33  * "Software"), to deal in the Software without restriction, including      *
     34  * without limitation the rights to use, copy, modify, merge, publish,      *
     35  * distribute, distribute with modifications, sublicense, and/or sell       *
     36  * copies of the Software, and to permit persons to whom the Software is    *
     37  * furnished to do so, subject to the following conditions:                 *
     38  *                                                                          *
     39  * The above copyright notice and this permission notice shall be included  *
     40  * in all copies or substantial portions of the Software.                   *
     41  *                                                                          *
     42  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
     43  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
     44  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
     45  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
     46  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
     47  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
     48  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
     49  *                                                                          *
     50  * Except as contained in this notice, the name(s) of the above copyright   *
     51  * holders shall not be used in advertising or otherwise to promote the     *
     52  * sale, use or other dealings in this Software without prior written       *
     53  * authorization.                                                           *
     54  ****************************************************************************/
     55 
     56 /****************************************************************************
     57  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
     58  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
     59  ****************************************************************************/
     60 
     61 /*
     62   NOT IMPLEMENTED:
     63   - terminfo, termcap-functions
     64   - rippoffline
     65   - v*printw functions (but normal printw functions are supported!)
     66 */
     67 
     68 # define _XOPEN_SOURCE_EXTENDED
     69 
     70 #if defined(HAVE_GETWIN) || defined(HAVE_PUTWIN)
     71 #  ifdef HAVE_UNISTD_H
     72 #    include <unistd.h>
     73 #  else
     74 int dup(int);
     75 int close(int);
     76 #  endif
     77 #endif
     78 
     79 #ifdef HAVE_NCURSES_H
     80 #  include <ncurses.h>
     81 #else
     82 #  ifdef HAVE_NCURSES_CURSES_H
     83 #    include <ncurses/curses.h>
     84 #  else
     85 #    ifdef HAVE_NCURSESW_CURSES_H
     86 #      include <ncursesw/curses.h>
     87 #    endif
     88 #  endif
     89 #endif
     90 
     91 #include <ruby.h>
     92 
     93 extern VALUE mNcurses;  /* module Ncurses */
     94 extern VALUE cWINDOW;   /* class Ncurses::WINDOW */
     95 extern VALUE cSCREEN;   /* class Ncurses::SCREEN */
     96 extern VALUE eNcurses;  /* Ncurses::Exception thrown by this extension */
     97 
     98 #define NCFUNC(name, nargs)                       \
     99   rb_define_singleton_method(mNcurses,            \
    100                              #name,               \
    101                              &rbncurs_ ## name,   \
    102                              nargs)
    103 
    104 WINDOW* get_window(VALUE rb_window);
    105 VALUE   wrap_window(WINDOW* window);
    106 long    rbncurs_array_length(VALUE rb_array);