switching to extended character set using curses & perl

S

someone92

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
 
S

someone92

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=``aaffggjjkkllmmnnooppqqrr
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
 
S

someone92

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.
 
S

someone92

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);
 
S

someone92

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);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top