[DRE-commits] [SCM] ruby-ncursesw.git branch, upstream, updated. upstream/1.2.4.3-1-g13834fe

Per Andersson avtobiff at gmail.com
Sat Apr 7 18:39:30 UTC 2012


The following commit has been merged in the upstream branch:
commit 13834fe6b7f70cdcc5b42568c51d59be42173571
Author: Per Andersson <avtobiff at gmail.com>
Date:   Sat Apr 7 18:53:52 2012 +0200

    Imported Upstream version 1.3.1

diff --git a/MANIFEST b/MANIFEST
deleted file mode 100644
index 8e1ca07..0000000
--- a/MANIFEST
+++ /dev/null
@@ -1,28 +0,0 @@
-Changes
-COPYING
-MANIFEST
-README
-THANKS
-TODO
-VERSION
-examples/example.rb
-examples/form.rb
-examples/form2.rb
-examples/hello_ncurses.rb
-examples/LICENSES_for_examples
-examples/rain.rb
-examples/tclock.rb
-examples/read_line.rb
-examples/test_scanw.rb
-extconf.rb
-form_wrap.c
-form_wrap.h
-make_dist.rb
-ncurses_wrap.c
-ncurses_wrap.h
-lib/ncurses.rb
-panel_wrap.c
-panel_wrap.h
-menu_wrap.c
-menu_wrap.h
-
diff --git a/README b/README
index 531c782..ac104cc 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-$Id: README,v 1.16 2009/05/03 14:13:27 t-peters Exp $
+$Id: README,v 1.16 2009-05-03 14:13:27 t-peters Exp $
 ------------------------------------------------------------------------
 This directory contains a ruby module for accessing the FSF's ncurses
 library.
diff --git a/THANKS b/THANKS
index ae0fdfd..e2b7ed9 100644
--- a/THANKS
+++ b/THANKS
@@ -1,4 +1,4 @@
-$Id: THANKS,v 1.9 2009/05/03 10:37:54 t-peters Exp $
+$Id: THANKS,v 1.10 2011-05-30 23:36:12 t-peters Exp $
 
 A list of people that helped me with ncurses-ruby
 
@@ -13,3 +13,4 @@ Simon Strandgaard
 Paul Duncan
 Tim Sutherland
 Earle Clubb
+graaf           (Berlios user)
\ No newline at end of file
diff --git a/TODO b/TODO
index 0fbebbe..1d652cd 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,4 @@
-$Id: TODO,v 1.6 2003/03/22 22:55:27 t-peters Exp $
+$Id: TODO,v 1.6 2003-03-22 22:55:27 t-peters Exp $
 
 This is the complete list of functions present in ncurses that have not yet
 been wrapped by ncurses-ruby:
diff --git a/VERSION b/VERSION
index e8ea05d..3a3cd8c 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.2.4
+1.3.1
diff --git a/compat.h b/compat.h
deleted file mode 100644
index 7691855..0000000
--- a/compat.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _COMPAT_H
-#define _COMPAT_H
-
-#ifndef STR2CSTR
-#define STR2CSTR(x) ({ VALUE *y = (x); StringValuePtr(y); })
-#endif
-
-#endif
diff --git a/examples/LICENSES_for_examples b/examples/LICENSES_for_examples
index 9725ec3..ca4a9e2 100644
--- a/examples/LICENSES_for_examples
+++ b/examples/LICENSES_for_examples
@@ -1,4 +1,4 @@
-$Id: LICENSES_for_examples,v 1.6 2004/05/13 21:55:17 t-peters Exp $
+$Id: LICENSES_for_examples,v 1.6 2004-05-13 21:55:17 t-peters Exp $
 
 Ideally, an example program on how to use a library should be in the public
 domain.
diff --git a/examples/example.rb b/examples/example.rb
old mode 100755
new mode 100644
index e49b9d9..02a0931
--- a/examples/example.rb
+++ b/examples/example.rb
@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby
 
-# $Id: example.rb,v 1.4 2002/03/04 13:24:29 t-peters Exp $
+# $Id: example.rb,v 1.4 2002-03-04 13:24:29 t-peters Exp $
 
 # This file provides an example for the usage of the ncurses-ruby module.
 # Copyright (C) 2002 Tobias Peters <t-peters at users.berlios.de>
@@ -59,7 +59,7 @@
 
 
 
-require "ncurses"
+require "ncursesw"
 
 def moving(scr)
   scr.clear() # clear screen
diff --git a/examples/form.rb b/examples/form.rb
old mode 100755
new mode 100644
index 1526741..88c1d81
--- a/examples/form.rb
+++ b/examples/form.rb
@@ -8,7 +8,7 @@
 # Copyright (c) 2001 by Pradeep Padala. This document may be distributed 
 # under the terms set forth in the LDP license at linuxdoc.org/COPYRIGHT.html.
  
-require 'ncurses.rb'
+require 'ncursesw.rb'
 
 begin
   scr = Ncurses.initscr()
diff --git a/examples/form2.rb b/examples/form2.rb
old mode 100755
new mode 100644
index 140a5a7..2bea254
--- a/examples/form2.rb
+++ b/examples/form2.rb
@@ -11,7 +11,7 @@
 # Copyright (c) 2001 by Pradeep Padala. This document may be distributed 
 # under the terms set forth in the LDP license at linuxdoc.org/COPYRIGHT.html.
 
-require 'ncurses'
+require 'ncursesw'
 
 include Ncurses
 include Ncurses::Form
diff --git a/examples/hello_ncurses.rb b/examples/hello_ncurses.rb
old mode 100755
new mode 100644
index c6727d3..314e531
--- a/examples/hello_ncurses.rb
+++ b/examples/hello_ncurses.rb
@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby
 
-# $Id: hello_ncurses.rb,v 1.3 2002/02/28 13:50:03 t-peters Exp $
+# $Id: hello_ncurses.rb,v 1.3 2002-02-28 13:50:03 t-peters Exp $
 
 # this ncurses-ruby program follows an ancient tradition of example
 # computer programs: When invoked, it prints a friendly greeting on the
@@ -14,7 +14,7 @@
 
 # First, we have to tell Ruby to use the Ncurses extension module:
 
-require "ncurses"
+require "ncursesw"
 
 
 
diff --git a/examples/rain.rb b/examples/rain.rb
old mode 100755
new mode 100644
index fa91b6c..1bf7297
--- a/examples/rain.rb
+++ b/examples/rain.rb
@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby
 
-# $Id: rain.rb,v 1.6 2005/08/22 21:41:49 t-peters Exp $
+# $Id: rain.rb,v 1.6 2005-08-22 21:41:49 t-peters Exp $
 
 # This program is a translation of the popular rain.c demo program from the
 # ncurses library distribution.
@@ -40,7 +40,7 @@
 
 
 
-require "ncurses"
+require "ncursesw"
 
 
 # A class responsible for raindrop drawing
diff --git a/examples/read_line.rb b/examples/read_line.rb
old mode 100755
new mode 100644
index 8ac9bdc..08eac3f
--- a/examples/read_line.rb
+++ b/examples/read_line.rb
@@ -7,7 +7,7 @@
 # No warranties
 # Share and enjoy!
 
-require "ncurses"
+require "ncursesw"
 
 # read_line returns an array
 # [string, last_cursor_position_in_string, keycode_of_terminating_enter_key].
diff --git a/examples/tclock.rb b/examples/tclock.rb
old mode 100755
new mode 100644
index a5a8f2e..6ad165e
--- a/examples/tclock.rb
+++ b/examples/tclock.rb
@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby
 
-# $Id: tclock.rb,v 1.6 2002/02/28 13:50:10 t-peters Exp $
+# $Id: tclock.rb,v 1.6 2002-02-28 13:50:10 t-peters Exp $
 
 # tclock - analog/digital clock for curses, translated to ruby
 # Copyright (C) 2002 Tobias Peters <t-peters at users.berlios.de>
@@ -30,7 +30,7 @@
 # clearly marked as such.                                                 #
 ###########################################################################
 
-require "ncurses"
+require "ncursesw"
 PI = Math::PI
 
 def sign(_x)
diff --git a/examples/test_scanw.rb b/examples/test_scanw.rb
old mode 100755
new mode 100644
index de1ed82..39bf2e9
--- a/examples/test_scanw.rb
+++ b/examples/test_scanw.rb
@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby
 
-# $Id: test_scanw.rb,v 1.1 2003/03/22 22:55:00 t-peters Exp $
+# $Id: test_scanw.rb,v 1.1 2003-03-22 22:55:00 t-peters Exp $
 #
 # Test of the scanw function. Should really not be used in any serious curses
 # program. To use it, install scanf for ruby.
@@ -9,7 +9,7 @@
 #
 # No warranties. Share and enjoy.
 
-require "ncurses"
+require "ncursesw"
 begin
   Ncurses.initscr
   Ncurses.mvaddstr(4, 19, "Give me a number: ")
diff --git a/extconf.rb b/extconf.rb
old mode 100755
new mode 100644
index f087409..0b4203f
--- a/extconf.rb
+++ b/extconf.rb
@@ -2,7 +2,7 @@
 
 # ncurses-ruby is a ruby module for accessing the FSF's ncurses library
 # (C) 2002, 2004 Tobias Peters <t-peters at users.berlios.de>
-# (C) 2005, 2009 Tobias Herzke
+# (C) 2005, 2009, 2011 Tobias Herzke
 #
 # This module is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -18,7 +18,7 @@
 # License along with this module; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
-# $Id: extconf.rb,v 1.14 2009/05/03 14:13:27 t-peters Exp $
+# $Id: extconf_ncursesw.rb,v 1.1 2011-05-30 23:05:50 t-peters Exp $
 
 require "mkmf"
 
@@ -28,22 +28,16 @@ $CXXFLAGS  = $CFLAGS
 have_header("unistd.h")
 have_header("locale.h")
 
-if have_header("ncurses.h")
-  curses_header = "ncurses.h"
-elsif have_header("ncurses/curses.h")
-  curses_header = "ncurses/curses.h"
-elsif have_header("curses.h")
-  curses_header = "curses.h"
+if have_header("ncursesw/curses.h")
+  curses_header = "ncursesw/curses.h"
 else
-  raise "ncurses header file not found"
+  raise "ncursesw header file not found"
 end
 
 if have_library("ncursesw", "wmove")
   curses_lib = "ncursesw"
-elsif have_library("pdcurses", "wmove")
-  curses_lib = "pdcurses"
 else
-  raise "ncurses library not found"
+  raise "ncursesw library not found"
 end
 
 have_func("newscr")
@@ -122,16 +116,16 @@ have_func("assume_default_colors")
 have_func("attr_get")
 
 puts "checking for the panel library..."
-if have_header("panel.h")
+if have_header("ncursesw/panel.h")
   have_library("panelw", "panel_hidden")
 end
 puts "checking for the form library..."
-if have_header("form.h")
+if have_header("ncursesw/form.h")
   have_library("formw", "new_form")
 end
 puts "checking for the menu library..."
-if have_header("menu.h")
-  have_library("menu", "new_menu")
+if have_header("ncursesw/menu.h")
+  have_library("menuw", "new_menu")
 end
 
 create_makefile('ncursesw_bin')
diff --git a/form_wrap.c b/form_wrap.c
index e59d423..346d443 100644
--- a/form_wrap.c
+++ b/form_wrap.c
@@ -22,14 +22,15 @@
  *  License along with this module; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  *
+ * Changes
+ * (C) 2011 Tobias Herzke
  */
 
 
-#ifdef HAVE_FORM_H
+#if defined(HAVE_FORM_H) || defined(HAVE_NCURSESW_FORM_H)
 
 #include "form_wrap.h"
 #include "ncurses_wrap.h"
-#include "compat.h"
 
 VALUE mForm;
 VALUE cFIELD;
@@ -1128,7 +1129,7 @@ static void* make_arg(va_list* ap) {
 	 if (args != Qnil) {		
 		if (NUM2INT(argc)-1 != rbncurs_array_length(args)) {	
 		  char msg[500];
-		  snprintf(msg, 500, "The validation functions for this field type need %d additional arguments.",NUM2INT(argc)-1);
+		  snprintf(msg, 500, "The validation functions for this field type need %d additional arguments.",(int)(NUM2INT(argc)-1));
 		  msg[499]=0;
 		  rb_raise(rb_eArgError, msg);	
 		}
diff --git a/form_wrap.h b/form_wrap.h
index 4f92c22..f8a015c 100644
--- a/form_wrap.h
+++ b/form_wrap.h
@@ -18,12 +18,19 @@
  *  License along with this module; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  *
+ * Changes
+ * (C) 2011 Tobias Herzke
  */
 
-#if !defined(FORM_HH) && defined(HAVE_FORM_H)
+#if !defined(FORM_HH) && (defined(HAVE_FORM_H) || defined(HAVE_NCURSESW_FORM_H))
 #define FORM_HH
 
+#ifdef HAVE_FORM_H
 #include <form.h>
+#else
+#include <ncursesw/form.h>
+#endif
+
 #include <ruby.h>
 
 extern VALUE mForm;
diff --git a/lib/ncursesw.rb b/lib/ncurses_sugar.rb
similarity index 98%
copy from lib/ncursesw.rb
copy to lib/ncurses_sugar.rb
index 25b7b79..b0e462b 100644
--- a/lib/ncursesw.rb
+++ b/lib/ncurses_sugar.rb
@@ -1,7 +1,7 @@
 # ncurses-ruby is a ruby module for accessing the FSF's ncurses library
 # (C) 2002, 2003, 2004 Tobias Peters <t-peters at users.berlios.de>
 # (C) 2004 Simon Kaczor <skaczor at cox.net>
-# (C) 2005 Tobias Herzke
+# (C) 2005 2011 Tobias Herzke
 #
 # This module is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -17,10 +17,7 @@
 # License along with this module; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
-# $Id: ncurses.rb,v 1.8 2009/05/03 10:37:54 t-peters Exp $
-
-require "ncursesw_bin.so"
-
+# $Id: ncurses_sugar.rb,v 1.1 2011-05-30 23:05:50 t-peters Exp $
 
 # Ncurses constants with leading underscore
 def Ncurses._XOPEN_CURSES
diff --git a/lib/ncursesw.rb b/lib/ncursesw.rb
index 25b7b79..e84b65b 100644
--- a/lib/ncursesw.rb
+++ b/lib/ncursesw.rb
@@ -1,7 +1,7 @@
 # ncurses-ruby is a ruby module for accessing the FSF's ncurses library
 # (C) 2002, 2003, 2004 Tobias Peters <t-peters at users.berlios.de>
 # (C) 2004 Simon Kaczor <skaczor at cox.net>
-# (C) 2005 Tobias Herzke
+# (C) 2005 2011 Tobias Herzke
 #
 # This module is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -17,328 +17,7 @@
 # License along with this module; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
-# $Id: ncurses.rb,v 1.8 2009/05/03 10:37:54 t-peters Exp $
+# $Id: ncursesw.rb,v 1.1 2011-05-30 23:05:51 t-peters Exp $
 
 require "ncursesw_bin.so"
-
-
-# Ncurses constants with leading underscore
-def Ncurses._XOPEN_CURSES
-  Ncurses::XOPEN_CURSES
-end
-def Ncurses._SUBWIN  
-  Ncurses::SUBWIN
-end
-def Ncurses._ENDLINE 
-  Ncurses::ENDLINE
-end
-def Ncurses._FULLWIN 
-  Ncurses::FULLWIN
-end
-def Ncurses._SCROLLWIN
-  Ncurses::SCROLLWIN
-end
-def Ncurses._ISPAD   
-  Ncurses::ISPAD
-end
-def Ncurses._HASMOVED
-  Ncurses::HASMOVED
-end
-def Ncurses._WRAPPED 
-  Ncurses::WRAPPED
-end
-def Ncurses._NOCHANGE
-  Ncurses::NOCHANGE
-end
-def Ncurses._NEWINDEX
-  Ncurses::NEWINDEX
-end
-
-
-module Ncurses
-  module Destroy_checker; def destroyed?; @destroyed; end; end
-  class WINDOW
-    include Destroy_checker
-    def method_missing(name, *args)
-      name = name.to_s
-      if (name[0,2] == "mv")
-        test_name = name.dup
-        test_name[2,0] = "w" # insert "w" after"mv"
-        if (Ncurses.respond_to?(test_name))
-          return Ncurses.send(test_name, self, *args)
-        end
-      end
-      test_name = "w" + name
-      if (Ncurses.respond_to?(test_name))
-        return Ncurses.send(test_name, self, *args)
-      end
-      Ncurses.send(name, self, *args)
-    end
-    def respond_to?(name)
-      name = name.to_s
-      if (name[0,2] == "mv" && Ncurses.respond_to?("mvw" + name[2..-1]))
-        return true
-      end
-      Ncurses.respond_to?("w" + name) || Ncurses.respond_to?(name)
-    end
-    def del
-      Ncurses.delwin(self)
-    end
-    alias delete del
-    def WINDOW.new(*args)
-      Ncurses.newwin(*args)
-    end
-  end
-  class SCREEN
-    include Destroy_checker
-    def del
-      Ncurses.delscreen(self)
-    end
-    alias delete del
-  end
-  class MEVENT
-    attr_accessor :id, :x,:y,:z, :bstate
-  end
-  GETSTR_LIMIT = 1024
-
-  module Panel 
-    class PANEL; end
-  end
-
-  module Form
-    class FORM
-      attr_reader :user_object
-
-      # This placeholder replaces the form_userptr function in curses
-      def user_object=(obj)
-        @user_object = obj
-      end
-    end
-    
-    class FIELD
-      attr_reader :user_object
-
-      # This placeholder replaces the field_userptr function in curses
-      def user_object=(obj)
-        @user_object = obj
-      end
-    end
-
-    class FIELDTYPE
-    end
-  end
-
-  module Menu
-    class MENU
-      attr_reader :user_object
-
-      # This placeholder replaces the menu_userptr function in curses
-      def user_object=(obj)
-        @user_object = obj
-      end
-    end
-    
-    class ITEM
-      attr_reader :user_object
-
-      # This placeholder replaces the item_userptr function in curses
-      def user_object=(obj)
-        @user_object = obj
-      end
-    end
-  end
-end
-def Ncurses.inchnstr(str,n)
-  Ncurses.winchnstr(Ncurses.stdscr, str, n)
-end
-def Ncurses.inchstr(str)
-  Ncurses.winchstr(Ncurses.stdscr, str)
-end
-def Ncurses.mvinchnstr(y,x, str, n)
-  Ncurses.mvwinchnstr(Ncurses.stdscr, y,x, str, n)
-end
-def Ncurses.mvinchstr(y,x, str)
-  Ncurses.mvwinchstr(Ncurses.stdscr, y,x, str)
-end
-def Ncurses.mvwinchnstr(win, y,x, str, n)
-  if (Ncurses.wmove(win,y,x) == Ncurses::ERR) 
-    Ncurses::ERR
-  else
-    Ncurses.winchnstr(win,str,n)
-  end
-end
-def Ncurses.mvwinchstr(win, y,x, str)
-  maxy = []; maxx = []; getmaxyx(win, maxy,maxx)
-  return Ncurses::ERR if (maxx[0] == Ncurses::ERR)
-  Ncurses.mvwinchnstr(win, y,x, str, maxx[0]+1)
-end
-def Ncurses.winchstr(win, str)
-  maxy = []; maxx = []; getmaxyx(win, maxy,maxx)
-  return Ncurses::ERR if (maxx[0] == Ncurses::ERR)
-  Ncurses.winchnstr(win, str, maxx[0]+1)
-end
-
-def Ncurses.getnstr(str,n)
-  Ncurses.wgetnstr(Ncurses.stdscr, str, n)
-end
-def Ncurses.mvgetnstr(y,x, str, n)
-  Ncurses.mvwgetnstr(Ncurses.stdscr, y,x, str, n)
-end
-def Ncurses.mvwgetnstr(win, y,x, str, n)
-  if (Ncurses.wmove(win,y,x) == Ncurses::ERR) 
-    Ncurses::ERR
-  else
-    Ncurses.wgetnstr(win,str,n)
-  end
-end
-
-def Ncurses.innstr(str,n)
-  Ncurses.winnstr(Ncurses.stdscr, str, n)
-end
-def Ncurses.instr(str)
-  Ncurses.winstr(Ncurses.stdscr, str)
-end
-def Ncurses.mvinnstr(y,x, str, n)
-  Ncurses.mvwinnstr(Ncurses.stdscr, y,x, str, n)
-end
-def Ncurses.mvinstr(y,x, str)
-  Ncurses.mvwinstr(Ncurses.stdscr, y,x, str)
-end
-def Ncurses.mvwinnstr(win, y,x, str, n)
-  if (Ncurses.wmove(win,y,x) == Ncurses::ERR) 
-    Ncurses::ERR
-  else
-    Ncurses.winnstr(win,str,n)
-  end
-end
-def Ncurses.mvwinstr(win, y,x, str)
-  maxy = []; maxx = []; getmaxyx(win, maxy,maxx)
-  return Ncurses::ERR if (maxx[0] == Ncurses::ERR)
-  Ncurses.mvwinnstr(win, y,x, str, maxx[0]+1)
-end
-def Ncurses.winstr(win, str)
-  maxy = []; maxx = []; getmaxyx(win, maxy,maxx)
-  return Ncurses::ERR if (maxx[0] == Ncurses::ERR)
-  Ncurses.winnstr(win, str, maxx[0]+1)
-end
-
-def Ncurses.mouse_trafo(pY, pX, to_screen)
-  Ncurses.wmouse_trafo(Ncurses.stdscr, pY, pX, to_screen)
-end
-
-def Ncurses.getcurx(win)
-  x = []; y = []; Ncurses.getyx(win, y,x); x[0]
-end
-def Ncurses.getcury(win)
-  x = []; y = []; Ncurses.getyx(win, y,x); y[0]
-end
-def Ncurses.getbegx(win)
-  x = []; y = []; Ncurses.getbegyx(win, y,x); x[0]
-end
-def Ncurses.getbegy(win)
-  x = []; y = []; Ncurses.getbegyx(win, y,x); y[0]
-end
-def Ncurses.getmaxx(win)
-  x = []; y = []; Ncurses.getmaxyx(win, y,x); x[0]
-end
-def Ncurses.getmaxy(win)
-  x = []; y = []; Ncurses.getmaxyx(win, y,x); y[0]
-end
-def Ncurses.getparx(win)
-  x = []; y = []; Ncurses.getparyx(win, y,x); x[0]
-end
-def Ncurses.getpary(win)
-  x = []; y = []; Ncurses.getparyx(win, y,x); y[0]
-end
-def Ncurses.erase
-  Ncurses.werase(Ncurses.stdscr)
-end
-def Ncurses.getstr(str)
-  Ncurses.getnstr(str, Ncurses::GETSTR_LIMIT)
-end
-def Ncurses.mvgetstr(y,x, str)
-  Ncurses.mvgetnstr(y,x, str, Ncurses::GETSTR_LIMIT)
-end
-def Ncurses.mvwgetstr(win, y,x, str)
-  Ncurses.mvwgetnstr(win, y,x, str, Ncurses::GETSTR_LIMIT)
-end
-def Ncurses.wgetstr(win, str)
-  Ncurses.wgetnstr(win, str, Ncurses::GETSTR_LIMIT)
-end
-
-def Ncurses.scanw(format, result)
-  Ncurses.wscanw(Ncurses.stdscr, format, result)
-end
-def Ncurses.mvscanw(y,x, format, result)
-  Ncurses.mvwscanw(Ncurses.stdscr, y,x, format, result)
-end
-def Ncurses.mvwscanw(win, y,x, format, result)
-  if (Ncurses.wmove(win, y,x) == Ncurses::ERR) 
-    Ncurses::ERR
-  else
-    Ncurses.wscanw(win, format, result)
-  end
-end
-def Ncurses.wscanw(win, format, result)
-  str = ""
-  if (Ncurses.wgetstr(win, str) == Ncurses::ERR) 
-    Ncurses::ERR
-  else
-    require "scanf.rb" # Use ruby's implementation of scanf
-    result.replace(str.scanf(format))
-  end
-end
-
-def Ncurses.mvprintw(*args)
-  Ncurses.mvwprintw(Ncurses.stdscr, *args)
-end
-def Ncurses.mvwprintw(win, y,x, *args)
-  if (Ncurses.wmove(win,y,x) == Ncurses::ERR) 
-    Ncurses::ERR
-  else
-    wprintw(win, *args)
-  end
-end
-def Ncurses.printw(*args)
-  Ncurses.wprintw(Ncurses.stdscr, *args)
-end
-def Ncurses.touchline(win, start, count)
-  Ncurses.wtouchln(win, start, count, 1)
-end
-def Ncurses.touchwin(win)
-  wtouchln(win, 0, getmaxy(win), 1)
-end
-
-module Ncurses
-  Ncurses = self # for accessing Ncurses from a Module that includes Ncurses
-
-  # Some users like to include ncurses names despite namespace pollution
-  # This module is for them
-  module Namespace
-    def self.append_features(target)
-      # include constants
-      unless target.ancestors.member?(Ncurses)
-        target.__send__(:include, Ncurses)
-      end
-      
-      # make methods available
-      unless target.respond_to?(:pre_Ncurses_method_missing)
-        target.module_eval{
-          alias pre_Ncurses_method_missing method_missing
-          def method_missing(name, *args)
-            if Ncurses.respond_to?(name)
-              Ncurses.send(name, *args)
-            else
-              pre_Ncurses_method_missing(name, *args)
-            end
-          end
-        }
-      end
-    end
-    def self.entend_object(object)
-      class << object
-        self
-      end.__send__(:include, self)
-    end
-  end
-end
+require "ncurses_sugar.rb"
diff --git a/make_dist.rb b/make_dist.rb
index 79988a6..11e08f8 100755
--- a/make_dist.rb
+++ b/make_dist.rb
@@ -1,6 +1,7 @@
 #!/usr/bin/env ruby
-
-# $Id: make_dist.rb,v 1.6 2003/08/29 22:50:12 t-peters Exp $
+# (C) 2002-2011 Tobias Herzke
+# License: LGPL v2.1
+# $Id: make_dist.rb,v 1.8 2011-05-30 23:05:50 t-peters Exp $
 
 require "fileutils"
 
@@ -10,36 +11,28 @@ def sys(i)
 end
 
 dir  = File.dirname(__FILE__)
-base = File.basename(dir)
-base = "ncurses-ruby" if base == "."
 
-files = IO.readlines(dir + "/MANIFEST").collect{|filename|filename.chomp}
+%w(ncurses ncursesw).each{|flavor|
+
+base = flavor+"-ruby"
 
-Version = File.new("#{dir}/VERSION").readline.chomp!
+files = IO.readlines(dir + "/MANIFEST_"+flavor).collect{|filename|filename.chomp}
+
+Version = File.new("#{dir}/VERSION").readline.chomp
 
 FileUtils.mkdir "#{base}-#{Version}"
 files.each{|filename|
   if filename.index "/"
     FileUtils.mkdir_p "#{base}-#{Version}/#{File.dirname(filename)}"
   end
-  sys "cp #{dir}/#{filename} #{base}-#{Version}/#{filename}"
+  if filename.index("example") 
+    sys "sed -e '/require/ s/ncurses/#{flavor}/' <#{dir}/#{filename} >#{base}-#{Version}/#{filename}"
+  else
+    sys "cp #{dir}/#{filename} #{base}-#{Version}/#{filename}"
+  end
 }
+sys "cp #{dir}/extconf_#{flavor}.rb #{base}-#{Version}/extconf.rb"
 sys "tar cjf #{base}-#{Version}.tar.bz2 --owner=0 --group=0 #{base}-#{Version}"
 
-# check if we create a binary distribution for a mingw extension
-binary_description = `file ncurses.so`
-
-if ((binary_description =~ /\s(windows)\s/i)                  &&
-    (binary_description =~ /\s(pe)|(portable executable)\s/i) &&
-    (binary_description =~ /\s(dll)\s/i))
-  sys "cp ncurses.so README.binary #{base}-#{Version}"
-  Dir.glob("#{base}-#{Version}/README*").each{|textfile|
-    text = IO.readlines(textfile).map{|line|line.chomp + "\r\n"}
-    File.open(textfile + ".txt", "wb"){|outfd| outfd.write(text.join)}
-    sys "rm #{textfile}"
-  }
-  sys "rm #{base}-#{Version}/{MANIFEST,make_dist.rb}"
-  sys "zip -9 -r #{base}-#{Version}-i386-mswin32.zip #{base}-#{Version}"
-end
-
 sys "rm -r #{base}-#{Version}/"
+}
diff --git a/menu_wrap.c b/menu_wrap.c
index c7f3a60..f76582f 100644
--- a/menu_wrap.c
+++ b/menu_wrap.c
@@ -22,13 +22,14 @@
  *  License along with this module; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  *
+ * Changes
+ * (C) 2011 Tobias Herzke
  */
 
-#ifdef HAVE_MENU_H
+#if defined(HAVE_MENU_H) || defined(HAVE_NCURSESW_MENU_H)
 
 #include "menu_wrap.h"
 #include "ncurses_wrap.h"
-#include "compat.h"
 
 VALUE mMenu;
 VALUE cITEM;
diff --git a/menu_wrap.h b/menu_wrap.h
index 198c42b..c2081c8 100644
--- a/menu_wrap.h
+++ b/menu_wrap.h
@@ -19,12 +19,18 @@
  *  License along with this module; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  *
+ * Changes
+ * (C) 2011 Tobias Herzke
  */
 
-#if !defined(MENU_HH) && defined(HAVE_MENU_H)
+#if !defined(MENU_HH) && (defined(HAVE_MENU_H) || defined(HAVE_NCURSESW_MENU_H))
 #define MENU_HH
 
+#ifdef HAVE_MENU_H
 #include <menu.h>
+#else
+#include <ncursesw/menu.h>
+#endif
 #include <ruby.h>
 
 extern VALUE mMenu;
diff --git a/metadata.yml b/metadata.yml
deleted file mode 100644
index d235c5a..0000000
--- a/metadata.yml
+++ /dev/null
@@ -1,81 +0,0 @@
---- !ruby/object:Gem::Specification 
-name: ncursesw
-version: !ruby/object:Gem::Version 
-  version: 1.2.4.3
-platform: ruby
-authors: []
-
-autorequire: 
-bindir: 
-cert_chain: 
-date: 2010-11-9 13:45:50 -08:00
-default_executable: 
-dependencies: []
-
-description: Hacked up version of ncurses gem that supports wide characters and ruby1.9.2. Original ncurses gem by t-peters at users.berlios.de.
-email: lanerl at gmail.com
-executables: []
-
-extensions: 
-- extconf.rb
-extra_rdoc_files: []
-
-files: 
-- Changes
-- COPYING
-- MANIFEST
-- README
-- THANKS
-- TODO
-- VERSION
-- examples/example.rb
-- examples/form.rb
-- examples/form2.rb
-- examples/hello_ncurses.rb
-- examples/LICENSES_for_examples
-- examples/rain.rb
-- examples/tclock.rb
-- examples/read_line.rb
-- examples/test_scanw.rb
-- extconf.rb
-- form_wrap.c
-- form_wrap.h
-- make_dist.rb
-- ncurses_wrap.c
-- ncurses_wrap.h
-- lib/ncursesw.rb
-- panel_wrap.c
-- panel_wrap.h
-- menu_wrap.c
-- menu_wrap.h
-- compat.h
-has_rdoc: true
-homepage: http://ncurses-ruby.berlios.de/
-licenses: []
-
-post_install_message: 
-rdoc_options: []
-
-require_paths: 
-- lib
-required_ruby_version: !ruby/object:Gem::Requirement 
-  requirements: 
-  - - ">"
-    - !ruby/object:Gem::Version 
-      version: 0.0.0
-  version: 
-required_rubygems_version: !ruby/object:Gem::Requirement 
-  requirements: 
-  - - ">="
-    - !ruby/object:Gem::Version 
-      version: "0"
-  version: 
-requirements: []
-
-rubyforge_project: 
-rubygems_version: 1.3.7
-signing_key: 
-specification_version: -1
-summary: "This wrapper provides access to the functions, macros, global variables and constants of the ncurses library.  These are mapped to a Ruby Module named \"Ncurses\":  Functions and external variables are implemented as singleton functions of the Module Ncurses."
-test_files: []
-
diff --git a/ncurses_wrap.c b/ncurses_wrap.c
index defe150..09609d1 100755
--- a/ncurses_wrap.c
+++ b/ncurses_wrap.c
@@ -2,7 +2,7 @@
  * ncurses-ruby is a ruby module for accessing the FSF's ncurses library
  * (C) 2002, 2003, 2004 Tobias Peters <t-peters at berlios.de>
  * (C) 2004 Simon Kaczor <skaczor at cox.net>
- * (C) 2005 2006 2009 Tobias Herzke
+ * (C) 2005 2006 2009 2011 Tobias Herzke
  *
  *  This module is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -18,7 +18,7 @@
  *  License along with this module; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  *
- * $Id: ncurses_wrap.c,v 1.18 2009/07/31 10:49:24 t-peters Exp $
+ * $Id: ncurses_wrap.c,v 1.20 2011-05-30 23:28:23 t-peters Exp $
  *
  * This file was adapted from the original ncurses header file which
  * has the following copyright statements:
@@ -65,7 +65,6 @@
 */
 
 #include "ncurses_wrap.h"
-#include "compat.h"
 #ifdef HAVE_LOCALE_H
 #include <locale.h>
 #endif
@@ -336,15 +335,15 @@ static VALUE rbncurs_winnstr(VALUE dummy, VALUE rb_win, VALUE rb_chstr, VALUE rb
     return INT2NUM(return_value);
 }
 
-#ifdef HAVE_PANEL_H
+#if defined(HAVE_PANEL_H) || defined(HAVE_NCURSESW_PANEL_H)
 #include "panel_wrap.h" /* needs access to mNcurses, wrap_window, get_window */
 #endif
 
-#ifdef HAVE_FORM_H
+#if defined(HAVE_FORM_H) || defined(HAVE_NCURSESW_FORM_H)
 #include "form_wrap.h" /* needs init_form */
 #endif
 
-#ifdef HAVE_MENU_H
+#if defined(HAVE_MENU_H) || defined(HAVE_NCURSESW_MENU_H)
 #include "menu_wrap.h" /* needs init_menu */
 #endif
 
@@ -815,7 +814,7 @@ static int rbncurshelper_nonblocking_wgetch(WINDOW *c_win) {
     int halfdelay = NUM2INT(rb_iv_get(mNcurses, "@halfdelay"));
     int infd = NUM2INT(rb_iv_get(mNcurses, "@infd"));
     double screen_delay = halfdelay * 0.1;
-#if defined(NCURSES_VERSION) && defined(NCURSES_OPAQUE) && !NCURSES_OPAQUE
+#ifdef NCURSES_VERSION
     int windelay = c_win->_delay;
 #else
     int windelay = 0;
@@ -832,7 +831,7 @@ static int rbncurshelper_nonblocking_wgetch(WINDOW *c_win) {
     gettimeofday(&tv, &tz);
     starttime = tv.tv_sec + tv.tv_usec * 1e-6;
     finishtime = starttime + delay;
-#if defined(NCURSES_VERSION) && defined(NCURSES_OPAQUE) && !NCURSES_OPAQUE
+#ifdef NCURSES_VERSION
     c_win->_delay = 0;
 #endif
     while (doupdate() /* detects resize */, (result = wgetch(c_win)) == ERR) {
@@ -851,7 +850,7 @@ static int rbncurshelper_nonblocking_wgetch(WINDOW *c_win) {
 	FD_SET(infd, &in_fds);
 	rb_thread_select(infd + 1, &in_fds, NULL, NULL, &tv);
     }
-#if defined(NCURSES_VERSION) && defined(NCURSES_OPAQUE) && !NCURSES_OPAQUE
+#ifdef NCURSES_VERSION
     c_win->_delay = windelay;
 #endif
     return result;
@@ -2395,7 +2394,7 @@ static VALUE rbncurs_tracef(int argc, VALUE * argv, VALUE dummy)
         return Qnil;
     }
     _tracef("%s",
-            STR2CSTR(funcall3(rb_mKernel, rb_intern("sprintf"), argc, argv)));
+            STR2CSTR(rb_funcall3(rb_mKernel, rb_intern("sprintf"), argc, argv)));
     return Qnil;
 }
 #endif /* HAVE__TRACEF */
@@ -2725,10 +2724,12 @@ static void init_safe_functions(void)
     NCFUNC(setlocale, 2);
 #endif
 }
+#ifdef HAVE_NCURSESW_CURSES_H
 void Init_ncursesw_bin(void)
+#else
+void Init_ncurses_bin(void)
+#endif
 {
-    setlocale(LC_ALL, "");
-
     mNcurses = rb_define_module("Ncurses");
     eNcurses = rb_define_class_under(mNcurses, "Exception", rb_eRuntimeError);
     rb_iv_set(mNcurses, "@windows_hash", rb_hash_new());
@@ -2759,13 +2760,13 @@ static void Init_ncurses_full(void)
     init_functions_3();
 
     init_SCREEN_methods();
-#ifdef HAVE_PANEL_H
+#if defined(HAVE_PANEL_H) || defined(HAVE_NCURSESW_PANEL_H)
     init_panel();
 #endif
-#ifdef HAVE_FORM_H
+#if defined(HAVE_FORM_H) || defined(HAVE_NCURSESW_FORM_H)
     init_form();
 #endif
-#ifdef HAVE_MENU_H
+#if defined(HAVE_MENU_H) || defined(HAVE_NCURSESW_MENU_H)
     init_menu();
 #endif
 }
diff --git a/ncurses_wrap.h b/ncurses_wrap.h
index 1593a2a..97cc61a 100644
--- a/ncurses_wrap.h
+++ b/ncurses_wrap.h
@@ -2,7 +2,7 @@
  * ncurses-ruby is a ruby module for accessing the FSF's ncurses library
  * (C) 2002, 2003 Tobias Peters <t-peters at berlios.de>
  * (C) 2004 Simon Kaczor <skaczor at cox.net>
- * (C) 2009 Tobias Herzke
+ * (C) 2009 2011 Tobias Herzke
  *
  *  This module is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -18,7 +18,7 @@
  *  License along with this module; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  *
- * $Id: ncurses_wrap.h,v 1.3 2009/05/03 20:37:26 t-peters Exp $
+ * $Id: ncurses_wrap.h,v 1.4 2011-05-30 23:05:50 t-peters Exp $
  *
  * This file was adapted from the original ncurses header file which
  * has the following copyright statements:
@@ -79,11 +79,12 @@ int close(int);
 #  ifdef HAVE_NCURSES_CURSES_H
 #    include <ncurses/curses.h>
 #  else
-#    include <curses.h>
+#    ifdef HAVE_NCURSESW_CURSES_H
+#      include <ncursesw/curses.h>
+#    endif
 #  endif
 #endif
 
-#include <locale.h>
 #include <ruby.h>
 
 extern VALUE mNcurses;  /* module Ncurses */
diff --git a/panel_wrap.c b/panel_wrap.c
index 4e9bcf4..9680b25 100644
--- a/panel_wrap.c
+++ b/panel_wrap.c
@@ -1,6 +1,7 @@
 /*
  * ncurses-ruby is a ruby module for accessing the FSF's ncurses library
  * (C) 2002 Tobias Peters <t-peters at berlios.de>
+ * (C) 2011 Tobias Herzke
  * 
  *  This module is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -17,13 +18,12 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  */
 
-/* $Id: panel_wrap.c,v 1.2 2004/07/31 08:35:13 t-peters Exp $ */
+/* $Id: panel_wrap.c,v 1.3 2011-05-30 23:05:50 t-peters Exp $ */
 
-#ifdef HAVE_PANEL_H
+#if defined(HAVE_PANEL_H) || defined(HAVE_NCURSESW_PANEL_H)
 
 #include "panel_wrap.h"
 #include "ncurses_wrap.h"
-#include "compat.h"
 
 VALUE mPanel;
 VALUE cPANEL;
diff --git a/panel_wrap.h b/panel_wrap.h
index 39d7968..9cd46fd 100755
--- a/panel_wrap.h
+++ b/panel_wrap.h
@@ -1,6 +1,7 @@
 /*
  * ncurses-ruby is a ruby module for accessing the FSF's ncurses library
  * (C) 2002 Tobias Peters <t-peters at berlios.de>
+ * (C) 2011 Tobias Herzke
  * 
  *  This module is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -17,11 +18,15 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  */
 
-/* $Id: panel_wrap.h,v 1.5 2004/07/31 08:35:13 t-peters Exp $ */
+/* $Id: panel_wrap.h,v 1.6 2011-05-30 23:05:50 t-peters Exp $ */
 
-#if !defined(PANEL_HH) && defined(HAVE_PANEL_H)
+#if !defined(PANEL_HH) && (defined(HAVE_PANEL_H) || defined(HAVE_NCURSESW_PANEL_H))
 #define PANEL_HH
+#ifdef HAVE_PANEL_H
 #include <panel.h>
+#else
+#include <ncursesw/panel.h>
+#endif
 #include <ruby.h>
 
 extern VALUE mPanel;

-- 
ruby-ncursesw.git



More information about the Pkg-ruby-extras-commits mailing list