X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=Ada95%2Fsamples%2Fncurses2-attr_test.adb;h=20a653a7c94b57356836670ca859d8270c98111c;hp=d852bb7f2749f1e18650157ecc6a3dbc89b8c034;hb=5a9c046f10f72b47ad32801a8e54fe3d05aa8051;hpb=46722468f47c2b77b3987729b4bcf2321cccfd01 diff --git a/Ada95/samples/ncurses2-attr_test.adb b/Ada95/samples/ncurses2-attr_test.adb index d852bb7f..20a653a7 100644 --- a/Ada95/samples/ncurses2-attr_test.adb +++ b/Ada95/samples/ncurses2-attr_test.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 2000 Free Software Foundation, Inc. -- +-- Copyright (c) 2000-2006,2007 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno 2000 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.7 $ +-- $Date: 2007/03/31 23:45:22 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with ncurses2.util; use ncurses2.util; @@ -59,7 +60,6 @@ procedure ncurses2.attr_test is fg, bg : in out Color_Number; result : out Boolean); - function subset (super, sub : Character_Attribute_Set) return Boolean is begin if @@ -85,7 +85,6 @@ procedure ncurses2.attr_test is end if; end subset; - function intersect (b, a : Character_Attribute_Set) return Boolean is begin if @@ -222,7 +221,7 @@ procedure ncurses2.attr_test is elsif ncv > 0 and has_A_COLOR (Get_Background) then declare Color_Supported_Attributes : - Character_Attribute_Set := make_record (ncv); + constant Character_Attribute_Set := make_record (ncv); begin if intersect (Color_Supported_Attributes, attr) then Add (Str => " (NCV) "); @@ -236,18 +235,15 @@ procedure ncurses2.attr_test is procedure attr_getc (skip : out Integer; fg, bg : in out Color_Number; result : out Boolean) is - ch : Key_Code := Getchar; + ch : constant Key_Code := Getchar; nc : constant Color_Number := Color_Number (Number_Of_Colors); - curscr : Window; - pragma Import (C, curscr, "curscr"); - -- curscr is not implemented in the Ada binding begin result := True; if Ada.Characters.Handling.Is_Digit (Character'Val (ch)) then skip := ctoi (Code_To_Char (ch)); elsif ch = CTRL ('L') then Touch; - Touch (curscr); + Touch (Current_Window); Refresh; elsif Has_Colors then case ch is @@ -264,8 +260,6 @@ procedure ncurses2.attr_test is end if; end attr_getc; - - -- pairs could be defined as array ( Color_Number(0) .. colors - 1) of -- array (Color_Number(0).. colors - 1) of Boolean; pairs : array (Color_Pair'Range) of Boolean := (others => False); @@ -293,7 +287,7 @@ begin -- row := 2; -- weird, row is set to 0 without this. -- TODO delete the above line, it was a gdb quirk that confused me if Has_Colors then declare - pair : Color_Pair := + pair : constant Color_Pair := Color_Pair (fg * Color_Number (Number_Of_Colors) + bg); begin -- Go though each color pair. Assume that the number of