Skip Menu |

This queue is for tickets about the Curses CPAN distribution.

Report information
The Basics
Id: 53818
Status: resolved
Worked: 30 min
Priority: 0/
Queue: Curses

People
Owner: Nobody in particular
Requestors: jurgen.defurne [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Curses 1.27 does not compile in Cygwin 1.7.1-1
Date: Tue, 19 Jan 2010 14:28:51 +0100
To: bug-Curses [...] rt.cpan.org
From: Jurgen Defurne <jurgen.defurne [...] gmail.com>
In file included from Curses.c:391: CursesVar.c: In function ‘XS_Curses_Vars_STORE’: CursesVar.c:190: error: lvalue required as left operand of assignment CursesVar.c:197: error: lvalue required as left operand of assignment CursesVar.c:204: error: lvalue required as left operand of assignment CursesVar.c:211: error: lvalue required as left operand of assignment CursesVar.c:218: error: lvalue required as left operand of assignment CursesVar.c:225: error: lvalue required as left operand of assignment make: *** [Curses.o] Error 1 Cygwin 1.7 delivers ncurses 5.7, Perl 5.10.1 and gcc 4.3.4. Regards. Jurgen Defurne
On Tue Jan 19 08:29:20 2010, jurgen.defurne@gmail.com wrote: Show quoted text
> In file included from Curses.c:391: > CursesVar.c: In function ‘XS_Curses_Vars_STORE’: > CursesVar.c:190: error: lvalue required as left operand of assignment > CursesVar.c:197: error: lvalue required as left operand of assignment > CursesVar.c:204: error: lvalue required as left operand of assignment > CursesVar.c:211: error: lvalue required as left operand of assignment > CursesVar.c:218: error: lvalue required as left operand of assignment > CursesVar.c:225: error: lvalue required as left operand of assignment > make: *** [Curses.o] Error 1 > Cygwin 1.7 delivers ncurses 5.7, Perl 5.10.1 and gcc 4.3.4.
The latest ncurses wraps its vars into functions to be re-entrant. This has to be undefined. c-config.h at the top: /* do not wrap the vars into functions */ #define NCURSES_REENTRANT 0 -- Reini Urban
I'm sorry. I had to disable writing to LINES, COLS, curscr, stdscr, COLORS, COLOR_PAIRS, because with the new NCURSES_REENTRANT lib, writing is forbidden. It's now wrapped behind a function call. I believe this affects all platforms, but some ncurses expert should clarify how to write to LINES now.
Subject: Curses-1.28.patch
diffbk diff -u ./Curses.c~ ./Curses.c --- ./Curses.c~ 2008-11-08 05:30:10.000000000 +0100 +++ ./Curses.c 2010-01-19 17:06:55.031250000 +0100 @@ -37,6 +37,10 @@ #undef bool.h in the Mac OSX hints file, so someone presumably found it necessary. But we have also had a Mac OSX system on which compile failed _because_ of that undef, for the reason described above. + + If NCURSES_REENTRANT is defined we cannot write to the public vars anymore. + This affects LINES, COLS, curscr, stdscr, COLORS, COLOR_PAIRS. + */ #undef instr @@ -50,6 +54,11 @@ #define NEED_sv_2pv_flags #include "ppport.h" +/* If we are lucky we can still write to some vars */ +#ifndef NCURSES_REENTRANT +#define NCURSES_REENTRANT 0 +#endif + #ifndef C_PANELSUPPORT # define PANEL int #endif diff -u ./Curses.pm~ ./Curses.pm --- ./Curses.pm~ 2009-01-20 16:24:27.000000000 +0100 +++ ./Curses.pm 2010-01-19 16:41:20.843750000 +0100 @@ -51,7 +51,7 @@ package Curses; -$VERSION = '1.27'; # Makefile.PL picks this up +$VERSION = '1.28'; # Makefile.PL picks this up use Carp; require Exporter; diff -u ./CursesVar.c~ ./CursesVar.c --- ./CursesVar.c~ 2007-03-11 09:29:09.000000000 +0100 +++ ./CursesVar.c 2010-01-19 17:02:57.468750000 +0100 @@ -186,42 +186,42 @@ switch (num) { case 1: -#ifdef C_LINES - LINES = (int)SvIV(ST(1)); +#if defined(C_LINES) && !NCURSES_REENTRANT + NCURSES_PUBLIC_VAR(LINES) = (int)SvIV(ST(1)); #else c_var_not_there("LINES"); #endif break; case 2: -#ifdef C_COLS +#if defined(C_COLS) && !NCURSES_REENTRANT COLS = (int)SvIV(ST(1)); #else c_var_not_there("COLS"); #endif break; case 3: -#ifdef C_STDSCR +#if defined(C_STDSCR) && !NCURSES_REENTRANT stdscr = c_sv2window(ST(1), -1); #else c_var_not_there("stdscr"); #endif break; case 4: -#ifdef C_CURSCR +#if defined(C_CURSCR) && !NCURSES_REENTRANT curscr = c_sv2window(ST(1), -1); #else c_var_not_there("curscr"); #endif break; case 5: -#ifdef C_COLORS +#if defined(C_COLORS) && !NCURSES_REENTRANT COLORS = (int)SvIV(ST(1)); #else c_var_not_there("COLORS"); #endif break; case 6: -#ifdef C_COLOR_PAIRS +#if defined(C_COLOR_PAIRS) && !NCURSES_REENTRANT COLOR_PAIRS = (int)SvIV(ST(1)); #else c_var_not_there("COLOR_PAIRS"); diff -u ./HISTORY~ ./HISTORY --- ./HISTORY~ 2009-01-20 16:24:06.000000000 +0100 +++ ./HISTORY 2010-01-19 17:10:02.109375000 +0100 @@ -11,6 +11,12 @@ Curses itself is much older than the Perl implementation. Curses was originally only a C programming library. +New in 1.28 (Released January ??, 2010) + + Fixes for NCURSES_REENTRANT by Reini Urban. With NCURSES_REENTRANT + defined we cannot write to some puiblic variables anymore, we can only + read from LINES, COLS, curscr, stdscr, COLORS, COLOR_PAIRS. + New in 1.27 (Released January 20, 2009) Extraneous .i and .s files in 1.26 removed. 'make clean' cleans all diff -u ./c-config.h~ ./c-config.h --- ./c-config.h~ 2010-01-19 15:26:14.437500000 +0100 +++ ./c-config.h 2010-01-19 16:59:38.515625000 +0100 @@ -5,7 +5,8 @@ */ /* These hints thanks to Federico Spinazzi <spinazzi@databankgroup.it> - (2001) and yselkowitz@users.sourceforge.net (October 2005) + (2001), yselkowitz@users.sourceforge.net (October 2005), + Reini Urban (January 2010). */ #include <ncurses.h>
Based on information in 53842, I'd say the right thing is to disable all setting of variables by default, and allow people to add to config.h to get the old function. There's probably nobody using it.
Subject: Re: [rt.cpan.org #53818] Curses 1.27 does not compile in Cygwin 1.7.1-1
Date: Thu, 21 Jan 2010 14:16:47 +0100
To: bug-Curses [...] rt.cpan.org
From: Jurgen Defurne <jurgen.defurne [...] gmail.com>
Hai, Reini, I do not know if your patch was already production ready ? If it wasn't, sorry for trying it out :) I applied it to Curses 1.27, but it fails horribly here : gcc -c -I/usr/include/ncurses -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -DUSEIMPORTLIB -O3 -DVERSION=\"1.28\" -DXS_VERSION=\"1.28\" "-I/usr/lib/perl5/5.10/i686-cygwin/CORE" Curses.c Curses.c: In function ‘c_domove’: Curses.c:129: error: expected declaration specifiers before ‘WINDOW’ Curses.c: In function ‘c_chtype2sv’: Curses.c:180: error: ‘ERR’ undeclared (first use in this function) Curses.c:180: error: (Each undeclared identifier is reported only once Curses.c:180: error: for each function it appears in.) Curses.c: In function ‘c_sv2field’: Curses.c:195: warning: cast to pointer from integer of different size Curses.c: In function ‘c_sv2form’: Curses.c:220: warning: cast to pointer from integer of different size Curses.c: In function ‘c_sv2item’: Curses.c:242: warning: cast to pointer from integer of different size Curses.c: In function ‘c_sv2menu’: Curses.c:265: warning: cast to pointer from integer of different size Curses.c: In function ‘c_sv2panel’: Curses.c:287: warning: cast to pointer from integer of different size Curses.c: In function ‘c_sv2screen’: Curses.c:309: warning: cast to pointer from integer of different size Curses.c: At top level: Curses.c:325: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token Curses.c:329: error: expected identifier or ‘(’ before ‘{’ token Curses.c: In function ‘c_window2sv’: Curses.c:344: error: expected declaration specifiers before ‘WINDOW’ In file included from Curses.c:399: CursesFun.c: In function ‘XS_Curses_initscr’: CursesFun.c:1233: error: ‘WINDOW’ undeclared (first use in this function) CursesFun.c:1233: error: ‘ret’ undeclared (first use in this function) CursesFun.c: In function ‘XS_Curses_newterm’: CursesFun.c:1295: warning: initialization makes pointer from integer without a cast CursesFun.c: In function ‘XS_Curses_set_term’: CursesFun.c:1314: warning: initialization makes pointer from integer without a cast CursesFun.c: In function ‘XS_Curses_newpad’: CursesFun.c:2454: error: ‘WINDOW’ undeclared (first use in this function) CursesFun.c:2454: error: ‘ret’ undeclared (first use in this function) CursesFun.c: In function ‘XS_Curses_slk_label’: CursesFun.c:2879: warning: initialization makes pointer from integer without a cast CursesFun.c: In function ‘XS_Curses_termname’: CursesFun.c:3198: warning: initialization makes pointer from integer without a cast CursesFun.c: In function ‘XS_Curses_unctrl’: CursesFun.c:3378: warning: initialization makes pointer from integer without a cast CursesFun.c: In function ‘XS_Curses_getwin’: CursesFun.c:3493: error: ‘WINDOW’ undeclared (first use in this function) CursesFun.c:3493: error: ‘ret’ undeclared (first use in this function) CursesFun.c: In function ‘XS_Curses_newwin’: CursesFun.c:3555: error: ‘WINDOW’ undeclared (first use in this function) CursesFun.c:3555: error: ‘ret’ undeclared (first use in this function) CursesFun.c: In function ‘XS_Curses_keybound’: CursesFun.c:4090: warning: initialization makes pointer from integer without a cast Regards, Jurgen Defurne
In 1.28, Curses::Var::STORE always fails and doesn't try to set any variables, unless you build with ALLOW_VARS_STORE set in c-config.h to get the old behavior. This should allow it to compile with the re- entrant version of Ncurses.