comp.lang.ada
 help / color / mirror / Atom feed
* modifying color of "Ada.Text_IO.Put"
@ 2000-12-21 19:54 Stefan Kombrink
  2000-12-21 21:58 ` Adrian Knoth
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Stefan Kombrink @ 2000-12-21 19:54 UTC (permalink / raw)


Hi there,

  in C and other programming languages it's simply possible to change
the background and foreground color of text plotted on screen. But GNAT
doesn't seem to offer procedures to handle that.

Moving the cursor may work with "Set_Col" and "Set_Line", but i need
routines to change color as well!

Could anyone remember a small, simple easy-to-use package (OS
independent) or should it even be possible by using standard GNAT
packages?

I'm lucky for every single answer,
  thank you very much >8^)


Stefan K.




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

* Re: modifying color of "Ada.Text_IO.Put"
  2000-12-21 19:54 modifying color of "Ada.Text_IO.Put" Stefan Kombrink
@ 2000-12-21 21:58 ` Adrian Knoth
  2000-12-21 23:44 ` Juergen Pfeifer
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Adrian Knoth @ 2000-12-21 21:58 UTC (permalink / raw)


Stefan Kombrink <katakombi@gmx.net> wrote:

> Hi there,

Hi!

> Moving the cursor may work with "Set_Col" and "Set_Line", but i need
> routines to change color as well!

There was a thread in thur.comp.software where I posted a solution
and Lutz wrote some comments. Deja.com may help you.

> Could anyone remember a small, simple easy-to-use package (OS
> independent) or should it even be possible by using standard GNAT
> packages?

I think we're talking about ANSI-compatible behaviour of terminals
or emulutions. So the following ASCII-stuff should work:

Ada.Text_IO.Put (ASCII.ESC & "[33m");

Colors are:

# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white

(taken from /etc/DIR_COLORS :)



-- 
mail: adi@thur.de  adi.thur.de/weihnachtsmann.html  PGP: v2-key via keyserver

thistaglinewasproducedbypkzip



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

* Re: modifying color of "Ada.Text_IO.Put"
  2000-12-21 19:54 modifying color of "Ada.Text_IO.Put" Stefan Kombrink
  2000-12-21 21:58 ` Adrian Knoth
@ 2000-12-21 23:44 ` Juergen Pfeifer
  2000-12-21 23:57 ` Ted Dennison
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Juergen Pfeifer @ 2000-12-21 23:44 UTC (permalink / raw)


>   in C and other programming languages it's simply possible to change
> the background and foreground color of text plotted on screen. But GNAT
> doesn't seem to offer procedures to handle that.
> 
Pardon me, but can you give me the C-language statement that sets the
color of a charactor on the screen? I'm doing C for 20 years and never
heard about that feature of the language;-) But perhaps you mean that
for C or other languages their exist conveniant libraries to do that.

> Moving the cursor may work with "Set_Col" and "Set_Line", but i need
> routines to change color as well!
> 
> Could anyone remember a small, simple easy-to-use package (OS
> independent) or should it even be possible by using standard GNAT
> packages?
> 
IMHO even in C you hardly find a library that does that kind of
thing in an OS independent way. On most UNIXes and similar OS
you'll find a library called curses (or ncurses on free OSes) which
deals with screen manipulation in a terminal independent way.
If you look into the sources of ncurses
(ftp://ftp.gnu.org/pub/gnu/ncurses)
you'll find there a quite complete Ada95 binding for this library.
Modern curses implementations (lile ncurses) support also colors.
The Ada95 binding for ncurses as BSD style license, so you are
quite free to use it for whatever you want.

Jürgen



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

* Re: modifying color of "Ada.Text_IO.Put"
  2000-12-21 19:54 modifying color of "Ada.Text_IO.Put" Stefan Kombrink
  2000-12-21 21:58 ` Adrian Knoth
  2000-12-21 23:44 ` Juergen Pfeifer
@ 2000-12-21 23:57 ` Ted Dennison
  2000-12-22  0:01 ` Marin David Condic
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Ted Dennison @ 2000-12-21 23:57 UTC (permalink / raw)


In article <3A425FFC.3831ACE2@gmx.net>,
  Stefan Kombrink <katakombi@gmx.net> wrote:
> Hi there,
>
>   in C and other programming languages it's simply possible to change
> the background and foreground color of text plotted on screen. But GNAT
> doesn't seem to offer procedures to handle that.

Uhhh, ok; I'll bite. How is it possible to do that in C?

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com
http://www.deja.com/



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

* Re: modifying color of "Ada.Text_IO.Put"
  2000-12-21 19:54 modifying color of "Ada.Text_IO.Put" Stefan Kombrink
                   ` (2 preceding siblings ...)
  2000-12-21 23:57 ` Ted Dennison
@ 2000-12-22  0:01 ` Marin David Condic
  2000-12-22 11:26 ` Lutz Donnerhacke
  2000-12-22 12:33 ` Thank you very much Stefan Kombrink
  5 siblings, 0 replies; 10+ messages in thread
From: Marin David Condic @ 2000-12-22  0:01 UTC (permalink / raw)


This is going to be very machine/OS dependent and is therefore not part of
the language standard. If you specify the equipment you are using, someone
may have a package to help you out with it. Note that this is also true of
C and other programming languages. You are probably confusing compiler
specific packages or OS services with what is provided by a language
standard. What works in C provided by Microsoft for the Windows OS using a
DOS window is not going to be identical to what works using C provided by
GCC on a Sun using X Windows. This is really important to understand if you
want to write programs that will work in more than one environment.

MDC


Stefan Kombrink wrote:

> Hi there,
>
>   in C and other programming languages it's simply possible to change
> the background and foreground color of text plotted on screen. But GNAT
> doesn't seem to offer procedures to handle that.
>
> Moving the cursor may work with "Set_Col" and "Set_Line", but i need
> routines to change color as well!
>
> Could anyone remember a small, simple easy-to-use package (OS
> independent) or should it even be possible by using standard GNAT
> packages?
>
> I'm lucky for every single answer,
>   thank you very much >8^)
>
> Stefan K.

--
======================================================================
Marin David Condic - Quadrus Corporation - http://www.quadruscorp.com/
Send Replies To: m c o n d i c @ q u a d r u s c o r p . c o m
Visit my web site at:  http://www.mcondic.com/

    "Giving money and power to Government is like giving whiskey
    and car keys to teenage boys."

        --   P. J. O'Rourke
======================================================================





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

* Re: modifying color of "Ada.Text_IO.Put"
  2000-12-21 19:54 modifying color of "Ada.Text_IO.Put" Stefan Kombrink
                   ` (3 preceding siblings ...)
  2000-12-22  0:01 ` Marin David Condic
@ 2000-12-22 11:26 ` Lutz Donnerhacke
  2000-12-22 12:33 ` Thank you very much Stefan Kombrink
  5 siblings, 0 replies; 10+ messages in thread
From: Lutz Donnerhacke @ 2000-12-22 11:26 UTC (permalink / raw)


* Stefan Kombrink wrote:
>  in C and other programming languages it's simply possible to change
>the background and foreground color of text plotted on screen.

No. There is no standard library call to do this. (or do I miss something?)
But there are additional libraries to do it in a portable way, i.e. curses.

>But GNAT doesn't seem to offer procedures to handle that.

Use the additional library [n]curses (www.gnu.org/.../curses/).
A Ada95 binding is included.

>Moving the cursor may work with "Set_Col" and "Set_Line", but i need

It failed miserably on my terminal. It can not move backwards.

-- 
	      http://www.tm.oneiros.de/calendar/2001/index.html



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

* Thank you very much
  2000-12-21 19:54 modifying color of "Ada.Text_IO.Put" Stefan Kombrink
                   ` (4 preceding siblings ...)
  2000-12-22 11:26 ` Lutz Donnerhacke
@ 2000-12-22 12:33 ` Stefan Kombrink
  2000-12-22 13:16   ` Marin David Condic
  2000-12-23  0:51   ` Ted Dennison
  5 siblings, 2 replies; 10+ messages in thread
From: Stefan Kombrink @ 2000-12-22 12:33 UTC (permalink / raw)


so well,

  got flamed for my unprecise statement, colorific text output would be
part of predefined language environment >8^).

Of course I meant that in C it's easily possible with e.g. curses, but
GNAT doesn't offer a library to do that.

Sending this ANSI sequences worked well for me so far, but how system
independent is that solution?
I remember that there was an ANSI driver for DOS as well, but nobody use
it
(you could demur that nobody's using DOS either!).

Thanks to all guys who got me short and simple documentation of ANSI term
std.

   i wish you all a merry chrismas and a happy new year,
        keep on using one of best programming language ever developed


Stefan Kombrink >8^)




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

* Re: Thank you very much
  2000-12-22 12:33 ` Thank you very much Stefan Kombrink
@ 2000-12-22 13:16   ` Marin David Condic
  2000-12-22 20:21     ` Juergen Pfeifer
  2000-12-23  0:51   ` Ted Dennison
  1 sibling, 1 reply; 10+ messages in thread
From: Marin David Condic @ 2000-12-22 13:16 UTC (permalink / raw)


Stefan Kombrink wrote:

> Sending this ANSI sequences worked well for me so far, but how system
> independent is that solution?
> I remember that there was an ANSI driver for DOS as well, but nobody use
> it
> (you could demur that nobody's using DOS either!).

The ANSI sequences are obviously not the last word in terminal commands, but
they are fairly common. An ANSI terminal emulation is usually available for
most machines.

I seem to recall a package called AdaCurses that might do what you want done.
A quick search of the net revealed:
http://at.rpmfind.net/opsys/linux/RPM/contrib/libc5/i386/i386/AdaCurses-4.2-1.i386.html

You may also want to look at http://www.adapower.com/ where there are
pointers to lots of other resources that you might be able to take advantage
of.

MDC
--
======================================================================
Marin David Condic - Quadrus Corporation - http://www.quadruscorp.com/
Send Replies To: m c o n d i c @ q u a d r u s c o r p . c o m
Visit my web site at:  http://www.mcondic.com/

    "Giving money and power to Government is like giving whiskey
    and car keys to teenage boys."

        --   P. J. O'Rourke
======================================================================





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

* Re: Thank you very much
  2000-12-22 13:16   ` Marin David Condic
@ 2000-12-22 20:21     ` Juergen Pfeifer
  0 siblings, 0 replies; 10+ messages in thread
From: Juergen Pfeifer @ 2000-12-22 20:21 UTC (permalink / raw)


Please note that if you're looking for a solution on Linux (Intel) you
should
visit http://www.gnuada.org/rpms313p.html#NCURSES
This contains the binding for ncurses 5.x, which is the current version.
There are the sources as well as the GNAT-3.13p compiled objects.

If you want to use the binding on non-Linux platforms, you should get the
ncurses sources from ftp://ftp.gnu.org/pub/gnu/ncurses which contains the
sources for the binding. You have then to compile it yourself.

> I seem to recall a package called AdaCurses that might do what you want
done.
> A quick search of the net revealed:
>
http://at.rpmfind.net/opsys/linux/RPM/contrib/libc5/i386/i386/AdaCurses-4.2-
1.i386.html
>
> You may also want to look at http://www.adapower.com/ where there are
> pointers to lots of other resources that you might be able to take
advantage
> of.
>





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

* Re: Thank you very much
  2000-12-22 12:33 ` Thank you very much Stefan Kombrink
  2000-12-22 13:16   ` Marin David Condic
@ 2000-12-23  0:51   ` Ted Dennison
  1 sibling, 0 replies; 10+ messages in thread
From: Ted Dennison @ 2000-12-23  0:51 UTC (permalink / raw)


In article <3A434A03.3891B642@gmx.net>,
  Stefan Kombrink <katakombi@gmx.net> wrote:

> Of course I meant that in C it's easily possible with e.g. curses, but
> GNAT doesn't offer a library to do that.

curses is not part of the C standard (just a by-product of using it
*rimshot* :-O ).

There is a "curses" library that is available with some C
implementations. Some of those C compilers are delivered with bindings
to this library, while some are not. Ada bindings to curses are
available too. In a pinch, if your compiler (C or Ada) doesn't come with
bindings to an available library, there's nothing stopping you from
writing it yourself. This issue has nothing to do with Ada.

> Sending this ANSI sequences worked well for me so far, but how system
> independent is that solution?
> I remember that there was an ANSI driver for DOS as well, but nobody
> use it (you could demur that nobody's using DOS either!).
>

How system-independent do you want it? Not all systems even support
colored text displays.

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com
http://www.deja.com/



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

end of thread, other threads:[~2000-12-23  0:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-21 19:54 modifying color of "Ada.Text_IO.Put" Stefan Kombrink
2000-12-21 21:58 ` Adrian Knoth
2000-12-21 23:44 ` Juergen Pfeifer
2000-12-21 23:57 ` Ted Dennison
2000-12-22  0:01 ` Marin David Condic
2000-12-22 11:26 ` Lutz Donnerhacke
2000-12-22 12:33 ` Thank you very much Stefan Kombrink
2000-12-22 13:16   ` Marin David Condic
2000-12-22 20:21     ` Juergen Pfeifer
2000-12-23  0:51   ` Ted Dennison

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