comp.lang.ada
 help / color / mirror / Atom feed
* Anyone see a problem in 5.7 ncurses Ada?
@ 2011-03-09 18:55 localhost
  2011-03-09 19:45 ` Anh Vo
  2011-03-09 20:28 ` Emile8
  0 siblings, 2 replies; 12+ messages in thread
From: localhost @ 2011-03-09 18:55 UTC (permalink / raw)


I had built some programs against an earlier version of ncurses, I can't
remember whether it was 5.5 or later and they were working fine. When I
rebuilt them against 5.7 a few of them broke. I have tracked it down to
incorrect values being returned by get_size. For a 24x80 xterm get_size is
returning 25 columns and 81 lines. This makes the values actually 2 higher
than they should be, because the numbers are supposed to be
zero-relative. That is the lines should be 23 and the columns 79. Has anyone
else noticed this? I don't know whether it's in the Ada binding or in
ncurses itself. I would think if ncurses itself was broken people would have
noted and fixed it but then again I don't think the Ada binding has been
touched in years (and wow, it's good).



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Anyone see a problem in 5.7 ncurses Ada?
  2011-03-09 18:55 Anyone see a problem in 5.7 ncurses Ada? localhost
@ 2011-03-09 19:45 ` Anh Vo
  2011-03-09 19:52   ` localhost
  2011-03-09 20:28 ` Emile8
  1 sibling, 1 reply; 12+ messages in thread
From: Anh Vo @ 2011-03-09 19:45 UTC (permalink / raw)


On Mar 9, 10:55 am, localh...@example.org wrote:
> I had built some programs against an earlier version of ncurses, I can't
> remember whether it was 5.5 or later and they were working fine. When I
> rebuilt them against 5.7 a few of them broke. I have tracked it down to
> incorrect values being returned by get_size. For a 24x80 xterm get_size is
> returning 25 columns and 81 lines. This makes the values actually 2 higher
> than they should be, because the numbers are supposed to be
> zero-relative. That is the lines should be 23 and the columns 79. Has anyone
> else noticed this? I don't know whether it's in the Ada binding or in
> ncurses itself. I would think if ncurses itself was broken people would have
> noted and fixed it but then again I don't think the Ada binding has been
> touched in years (and wow, it's good).

I do not know much about it until recently. Try the latest version,
5.8. If the problem still persists, try version 5.6 or older before
sending a bug report.

Anh Vo



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Anyone see a problem in 5.7 ncurses Ada?
  2011-03-09 19:45 ` Anh Vo
@ 2011-03-09 19:52   ` localhost
  2011-03-09 20:00     ` Anh Vo
  2011-03-09 22:12     ` Emile8
  0 siblings, 2 replies; 12+ messages in thread
From: localhost @ 2011-03-09 19:52 UTC (permalink / raw)


> I do not know much about it until recently. 

Does that mean you also see the problem in 5.7?

> Try the latest version, 5.8. If the problem still persists, try version
> 5.6 or older before sending a bug report.

Ok but it will be awhile because I have a long to-do list.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Anyone see a problem in 5.7 ncurses Ada?
  2011-03-09 19:52   ` localhost
@ 2011-03-09 20:00     ` Anh Vo
  2011-03-09 20:02       ` localhost
  2011-03-09 22:12     ` Emile8
  1 sibling, 1 reply; 12+ messages in thread
From: Anh Vo @ 2011-03-09 20:00 UTC (permalink / raw)


On Mar 9, 11:52 am, localh...@example.org wrote:

> Does that mean you also see the problem in 5.7?

No, it means I never work on it including this version. By the way, I
downloaded version 5.8 yesterday but not building it yet.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Anyone see a problem in 5.7 ncurses Ada?
  2011-03-09 20:00     ` Anh Vo
@ 2011-03-09 20:02       ` localhost
  0 siblings, 0 replies; 12+ messages in thread
From: localhost @ 2011-03-09 20:02 UTC (permalink / raw)


On 2011-03-09, Anh Vo <anhvofrcaus@gmail.com> wrote:
> On Mar 9, 11:52�am, localh...@example.org wrote:
>
>> Does that mean you also see the problem in 5.7?
>
> No, it means I never work on it including this version. By the way, I
> downloaded version 5.8 yesterday but not building it yet.

Ok. Anyway it's a fantastic binding. I think the guy who wrote it wasn't
even an Ada developer but as far as I can tell he did an amazing job. Glad
to have somebody else using it maybe we can help each other out.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Anyone see a problem in 5.7 ncurses Ada?
  2011-03-09 18:55 Anyone see a problem in 5.7 ncurses Ada? localhost
  2011-03-09 19:45 ` Anh Vo
@ 2011-03-09 20:28 ` Emile8
  2011-03-09 20:53   ` Jeffrey Carter
  2011-03-10  6:14   ` localhost
  1 sibling, 2 replies; 12+ messages in thread
From: Emile8 @ 2011-03-09 20:28 UTC (permalink / raw)


On 9 mar, 19:55, localh...@example.org wrote:
> I had built some programs against an earlier version of ncurses, I can't
> remember whether it was 5.5 or later and they were working fine. When I
> rebuilt them against 5.7 a few of them broke. I have tracked it down to
> incorrect values being returned by get_size. For a 24x80 xterm get_size is
> returning 25 columns and 81 lines. This makes the values actually 2 higher
> than they should be, because the numbers are supposed to be
> zero-relative. That is the lines should be 23 and the columns 79. Has anyone
> else noticed this? I don't know whether it's in the Ada binding or in
> ncurses itself. I would think if ncurses itself was broken people would have
> noted and fixed it but then again I don't think the Ada binding has been
> touched in years (and wow, it's good).

I confirm your observation on the Ada binding of the version 5.7 of
ncurses. The numbers of lines and columns are 1 higher than the actual
ones. I don't know if this is relevant but Get_Size gives the number
of lines and columns of a window in the terminal. It seems so that the
standard_window is a bit greater than its terminal.

with Terminal_Interface.Curses; use Terminal_Interface.Curses;
with ncurses2.util;             use ncurses2.util;
with ada.text_io; use ada.text_io;
with Ada.integer_Text_IO; use Ada.integer_Text_IO;

procedure test1 is
   NL : Line_count;
   NC : Column_count;
begin
   init_screen;
   Get_size (number_of_columns => NC, number_of_lines => NL);
   put(integer(NL));
   put_line("");
   put(integer(NC));
   delay 10.0;
end test1;


Here after is the source code of Get_Size. It could be that the
problem comes from the value of Offset_XY.

procedure Get_Size
     (Win               : in Window := Standard_Window;
      Number_Of_Lines   : out Line_Count;
      Number_Of_Columns : out Column_Count)
   is
      function GetMaxY (W : Window) return C_Int;
      pragma Import (C, GetMaxY, "getmaxy");

      function GetMaxX (W : Window) return C_Int;
      pragma Import (C, GetMaxX, "getmaxx");

      Y : constant C_Int := GetMaxY (Win)
                          + C_Int (Offset_XY);
      X : constant C_Int := GetMaxX (Win)
                          + C_Int (Offset_XY);
   begin
      Number_Of_Lines   := Line_Count (Y);
      Number_Of_Columns := Column_Count (X);
   end Get_Size;



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Anyone see a problem in 5.7 ncurses Ada?
  2011-03-09 20:28 ` Emile8
@ 2011-03-09 20:53   ` Jeffrey Carter
  2011-03-09 21:42     ` Emile8
  2011-03-10  6:14   ` localhost
  1 sibling, 1 reply; 12+ messages in thread
From: Jeffrey Carter @ 2011-03-09 20:53 UTC (permalink / raw)


On 03/09/2011 01:28 PM, Emile8 wrote:
>
> procedure test1 is
>     NL : Line_count;
>     NC : Column_count;
> begin
>     init_screen;
>     Get_size (number_of_columns =>  NC, number_of_lines =>  NL);
>     put(integer(NL));
>     put_line("");

Skip_Line?

>     put(integer(NC));
>     delay 10.0;
> end test1;

-- 
Jeff Carter
"Sir Robin the not-quite-so-brave-as-Sir-Lancelot,
who had nearly fought the Dragon of Angnor,
who nearly stood up to the vicious Chicken of Bristol,
and who had personally wet himself at the
Battle of Badon Hill."
Monty Python & the Holy Grail
68



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Anyone see a problem in 5.7 ncurses Ada?
  2011-03-09 20:53   ` Jeffrey Carter
@ 2011-03-09 21:42     ` Emile8
  2011-03-10 14:43       ` Niklas Holsti
  0 siblings, 1 reply; 12+ messages in thread
From: Emile8 @ 2011-03-09 21:42 UTC (permalink / raw)


On 9 mar, 21:53, Jeffrey Carter <spam.jrcarter....@spam.not.acm.org>
wrote:
> On 03/09/2011 01:28 PM, Emile8 wrote:
>
>
>
> > procedure test1 is
> >     NL : Line_count;
> >     NC : Column_count;
> > begin
> >     init_screen;
> >     Get_size (number_of_columns =>  NC, number_of_lines =>  NL);
> >     put(integer(NL));
> >     put_line("");
>
> Skip_Line?
Ok for skip_line;
>
> >     put(integer(NC));
> >     delay 10.0;

        End_Windows;
        Curses_Free_All;
        -- to leave properly ncurses
> > end test1;
>
> --
> Jeff Carter
> "Sir Robin the not-quite-so-brave-as-Sir-Lancelot,
> who had nearly fought the Dragon of Angnor,
> who nearly stood up to the vicious Chicken of Bristol,
> and who had personally wet himself at the
> Battle of Badon Hill."
> Monty Python & the Holy Grail
> 68




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Anyone see a problem in 5.7 ncurses Ada?
  2011-03-09 19:52   ` localhost
  2011-03-09 20:00     ` Anh Vo
@ 2011-03-09 22:12     ` Emile8
  1 sibling, 0 replies; 12+ messages in thread
From: Emile8 @ 2011-03-09 22:12 UTC (permalink / raw)


On 9 mar, 20:52, localh...@example.org wrote:
> > I do not know much about it until recently.
>
> Does that mean you also see the problem in 5.7?
>
> > Try the latest version, 5.8. If the problem still persists, try version
> > 5.6 or older before sending a bug report.
>
> Ok but it will be awhile because I have a long to-do list.

I have downloaded and  just compiled the new version 5.8 of ncurses.
As in version 5.7, Get_Size 5.8  returns values 1 higher
than they should be.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Anyone see a problem in 5.7 ncurses Ada?
  2011-03-09 20:28 ` Emile8
  2011-03-09 20:53   ` Jeffrey Carter
@ 2011-03-10  6:14   ` localhost
  1 sibling, 0 replies; 12+ messages in thread
From: localhost @ 2011-03-10  6:14 UTC (permalink / raw)


> I confirm your observation on the Ada binding of the version 5.7 of
> ncurses. The numbers of lines and columns are 1 higher than the actual
> ones. I don't know if this is relevant but Get_Size gives the number
> of lines and columns of a window in the terminal. It seems so that the
> standard_window is a bit greater than its terminal.

Hi thanks for your help. I used xwininfo and the terminal is definitely
24x80. I also tested rxvt in addition to xterm in case it was the terminal,
same problem. In all cases get_size is returning 25x81 which is 2 more than
it should be (it should return 23x79, because the numbers are supposed to be
zero-relative). 

> Here after is the source code of Get_Size. It could be that the
> problem comes from the value of Offset_XY.

Thanks, I'll have a look when I get a chance, maybe we can dump that
field. In the meantime I'm just adjusting the values I get from get_size in
my programs to get past the issue.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Anyone see a problem in 5.7 ncurses Ada?
  2011-03-09 21:42     ` Emile8
@ 2011-03-10 14:43       ` Niklas Holsti
  2011-03-10 21:38         ` Jeffrey Carter
  0 siblings, 1 reply; 12+ messages in thread
From: Niklas Holsti @ 2011-03-10 14:43 UTC (permalink / raw)


Emile8 wrote:
> On 9 mar, 21:53, Jeffrey Carter <spam.jrcarter....@spam.not.acm.org>
> wrote:
>> On 03/09/2011 01:28 PM, Emile8 wrote:
>>
>>
>>
>>> procedure test1 is
>>>     NL : Line_count;
>>>     NC : Column_count;
>>> begin
>>>     init_screen;
>>>     Get_size (number_of_columns =>  NC, number_of_lines =>  NL);
>>>     put(integer(NL));
>>>     put_line("");
>> Skip_Line?
> Ok for skip_line;
>>>     put(integer(NC));

If these are operations in Ada.Text_IO, Skip_Line skips *input* lines. 
If you want to make blank *output* lines, use New_Line.

 From one who has made that mistake more than once :-)

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Anyone see a problem in 5.7 ncurses Ada?
  2011-03-10 14:43       ` Niklas Holsti
@ 2011-03-10 21:38         ` Jeffrey Carter
  0 siblings, 0 replies; 12+ messages in thread
From: Jeffrey Carter @ 2011-03-10 21:38 UTC (permalink / raw)


On 03/10/2011 07:43 AM, Niklas Holsti wrote:
>
> If these are operations in Ada.Text_IO, Skip_Line skips *input* lines. If you
> want to make blank *output* lines, use New_Line.

New_Line, of course. I guess it's time to take me out and shoot me.

>  From one who has made that mistake more than once :-)

Maybe I can live a little longer, then.

-- 
Jeff Carter
"We'll make Rock Ridge think it's a chicken
that got caught in a tractor's nuts!"
Blazing Saddles
87



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-03-10 21:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-09 18:55 Anyone see a problem in 5.7 ncurses Ada? localhost
2011-03-09 19:45 ` Anh Vo
2011-03-09 19:52   ` localhost
2011-03-09 20:00     ` Anh Vo
2011-03-09 20:02       ` localhost
2011-03-09 22:12     ` Emile8
2011-03-09 20:28 ` Emile8
2011-03-09 20:53   ` Jeffrey Carter
2011-03-09 21:42     ` Emile8
2011-03-10 14:43       ` Niklas Holsti
2011-03-10 21:38         ` Jeffrey Carter
2011-03-10  6:14   ` localhost

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox