Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > switching to extended character set using curses & perl

Reply
Thread Tools

switching to extended character set using curses & perl

 
 
someone92@hotmail.com
Guest
Posts: n/a
 
      01-19-2005
Hi,
I'm writing a perl program that needs to draw lines and other special
characters on the screen. I'm using curses to design my user interface.
I'm been trying for a while to figure out how to change to the extended
character set using curses without any success. I'm using FreeBSD 4.10
(VT320 terminal)

I'm able to switch to ecs without curses this way
print ("\e(0");
print ("qqqqq"); #works really draw a line

but if I try to print an escape sequence using curses's addstr it will
be printed on screen, so it doesn't work. And it seems that perl's
curses module doesn't support addrawch (which could have been useful)

I also tried what I thought was the solution to my problem but I was
really suprised that it doesn't work :

Curses::initscr;
Curses::attrset(A_ALTCHARSET);
$c="qqqqqqqqqqq";
Curses::addstr ($c);
Curses::refresh;
Curses::endwin;

Curses doesn't seems to switch to ecs

I found this quotes on the newsgroups:
"The attrset(A_ALTCHARSET) will use terminfo capabilties to switch to
the alternate character set. To use this successfully, the terminfo
entry for your terminal must define 'smacs' (start alternate character
set), 'rmacs' (end alternate character set) capabilities. In addition,
the 'sgr' capability definition should implement the '%9' flag for
alternate character set."

is it true? I only found /etc/termcap on my FreeBSD system and nothing
about smacs and rmacs in it.

Anyone can help me ? thanks in advance

 
Reply With Quote
 
 
 
 
someone92@hotmail.com
Guest
Posts: n/a
 
      01-20-2005
I'm sorry I think I ment alternate character set not extended character
set. I also tried to modify my /etc/termcap file for each terminals I
use(vt320 & xterm) by adding this in the corresponding sections:

:as=^N:ae=^O:aE=\E(B\E)0:ac=``aaffggjjkkllmmnnoopp qqrr
ssttuuvvwwxxyyzz{{||}}~~..--++ ,,hhII00:

But still curses doesn't switch to alternate character set. Should I do
something special to update the /etc/termcap.db database ? if I use
"tset -S" I see that one of my terminal already have the as,ae,ac,aE
settings configured (vt320), my xterm (from putty) terminal's settings
are not updated when I change /etc/termcap

If someone has another solution than updating the termcap info and
still using curses that would be better since if I distribute the code
I don't want the users to have to mess with termcap.

Thanks

 
Reply With Quote
 
 
 
 
someone92@hotmail.com
Guest
Posts: n/a
 
      01-20-2005
I finally found a way to print an alternate character on screen with
perl & curses:

my $char=&Curses::ACS_LTEE;
$win->move($dy,$dx);
$win->hline($char,1);
But it's not very nice, I'm sure there's a better way to do this.

 
Reply With Quote
 
someone92@hotmail.com
Guest
Posts: n/a
 
      01-25-2005

I found the solution to my problem just in case someone would need the
information some day:

Curses::attrset(&Curses::A_ALTCHARSET); #switch to ACS
$win->addstr($y,$x,$ACSchar);

 
Reply With Quote
 
someone92@hotmail.com
Guest
Posts: n/a
 
      01-25-2005

I found the solution to my problem just in case someone would need the
information some day:

Curses::attrset(&Curses::A_ALTCHARSET); #switch to ACS
$win->addstr($y,$x,$ACSchar);

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Process Switching vs. Fast/CEF Switching? asdf Cisco 7 05-29-2007 05:26 PM
Re: Replacing curses (Was: Re: Problem with curses and UTF-8) Jean-Paul Calderone Python 2 02-09-2006 08:29 AM
Re: Question about Extended ASCII character set, and fstream C++ 1 10-21-2004 05:40 PM
Question about Extended ASCII character set, and fstream C++ 1 10-21-2004 09:30 AM
Extended Character Set - CDONTS Simon Harris ASP General 0 02-09-2004 05:36 PM



Advertisments