From: Per Andersson <avtobiff@gmail.com>
Date: Mon, 9 Apr 2012 16:49:52 +0200
Subject: Define STR2CSTR macro
STR2CSTR is removed since Ruby 1.9.0. Define it to make ruby-ncurses
work for Ruby >= 1.9.0.
---
compat.h | 8 ++++++++
form_wrap.c | 1 +
menu_wrap.c | 1 +
ncurses_wrap.c | 1 +
panel_wrap.c | 1 +
5 files changed, 12 insertions(+), 0 deletions(-)
create mode 100644 compat.h
diff --git a/compat.h b/compat.h
new file mode 100644
index 0000000..3d07271
--- /dev/null
+++ b/compat.h
@@ -0,0 +1,8 @@
+#ifndef _COMPAT_H
+#define _COMPAT_H
+
+#ifndef STR2CSTR
+#define STR2CSTR(x) ({ VALUE *y = (x); StringValuePtr(y); })
+#endif
+
+#endif /* _COMPAT_H */
diff --git a/form_wrap.c b/form_wrap.c
index 346d443..c1a9e47 100644
--- a/form_wrap.c
+++ b/form_wrap.c
@@ -31,6 +31,7 @@
#include "form_wrap.h"
#include "ncurses_wrap.h"
+#include "compat.h"
VALUE mForm;
VALUE cFIELD;
diff --git a/menu_wrap.c b/menu_wrap.c
index f76582f..2878723 100644
--- a/menu_wrap.c
+++ b/menu_wrap.c
@@ -30,6 +30,7 @@
#include "menu_wrap.h"
#include "ncurses_wrap.h"
+#include "compat.h"
VALUE mMenu;
VALUE cITEM;
diff --git a/ncurses_wrap.c b/ncurses_wrap.c
index 09609d1..f342c61 100755
--- a/ncurses_wrap.c
+++ b/ncurses_wrap.c
@@ -65,6 +65,7 @@
*/
#include "ncurses_wrap.h"
+#include "compat.h"
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
diff --git a/panel_wrap.c b/panel_wrap.c
index 9680b25..53b282b 100644
--- a/panel_wrap.c
+++ b/panel_wrap.c
@@ -24,6 +24,7 @@
#include "panel_wrap.h"
#include "ncurses_wrap.h"
+#include "compat.h"
VALUE mPanel;
VALUE cPANEL;
--