ITEM: H3376L
I need help with programming in C
Question:
I am trying to use the curses.h under C, but I am not able to do
simple graphics on the terminal. I would be using the ASCII line
drawings and would like some help in setting up for the line drawings.
I have just moved from an SCO-Unix enviroment.
Response:
Response:
Called the customer, and we talked about font0 and font1
He did a 'tput font1', then 'tput box1' and saw the
graphics characters. This looks like it is on the right
track. Once in font1, we should be able to send the raw
characters
In the file curs01.h in /usr/include
the following characters are defined BX[] and BY[].
These characters contain the box characters.
You should be able to output them with a
character output routine from curses.
Response:
Customer typed in the program dobox.c that I got from HONE. It did
for him just what it did for the HONE customer. It gave him a character
box on the hp terminal, and no box on the 3151. I have the curiosity
that when I hold down the alt key and type 192 on one aixterm window
I get a funny looking C, but on a different window (same user, same
HFT, same TERM variable I get a lower left corner. The box program
works in both windows.
I tried this on models 410 and 310 of the 3151 and the box program
works just fine.
Response:
Found an item on ATSS indicating sgr0 value could be changed to
make the default mode the graphics mode
sgr0=\\E4&\\E>A
inside of terminfo definition for ibm3151
Or can simply use a shell script like this to output characters.
GRPH=`tput box1`
TL=`echo $GRPH | cut -c1`
VB=`echo $GRPH | cut -c2`
TR=`echo $GRPH | cut -c3`
HB=`echo $GRPH | cut -c4`
BR=`echo $GRPH | cut -c5`
BL=`echo $GRPH | cut -c6`
RT=`echo $GRPH | cut -c7`
BT=`echo $GRPH | cut -c8`
LT=`echo $GRPH | cut -c9`
CT=`echo $GRPH | cut -c10`
GPH_ON=`tput font1`
GPH_OFF=`tput font0`
echo "$GPH_ON"
echo "$TL$VB$VB$VB$VB$VB$VB$VB$VB$VB$TR"
echo "$HB $HB"
echo "$HB $HB"
echo "$HB $HB"
echo "$HB $HB"
echo "$HB $HB"
echo "$HB $HB"
echo "$HB $HB"
echo "$BL$VB$VB$VB$VB$VB$VB$VB$VB$VB$BR"
echo "$GPH_OFF"
Will draw a box.
Response:
The following program should solve hist problems.
I have faxed it to him.
/* mybox.c extend curses test program cc dobox.c -o dobox -lcur -lcurses*/
/* The gox will be 4 characters wide by 4 deep using all graphics characters.
lqqqqqqqqqqqqqqqqqqqqk
x | x
x-----+------------- x
x | x
x | x
mqqqqqqqqqqqqqqqqqqqqj
How do I use box characters without the box functions?
BX and BY are external defined variables with box characters
BX will use terminfo BOX1 charactes, BY terminfo BOX2 characters.
*/
\#include \
\#include \
/*
\#define A_ALTCHARSET 0x00800000
\# define attron(at) wattron(stdscr,at)
*/
main()
{char *pdata;
initscr();
refresh();
mvaddstr(1, 1, "Line one string: font_0");
refresh();
/* Use this routine to put the system in font 1 (graphics) */
putp (tparm(font_1));
/* This call will return the box characters */
/*
Alternate way to get the box characters
pdata = tparm(box_chars_1);
addch(pdata[6]);
addch(pdata[1]);
addch(pdata[5]);
addch(pdata[3]);
addch(pdata[4]);
addch(pdata[2]);
*/
/* Output box characters for top of box */
addch(BX[0]);
addch(BX[6]);
addch(BX[1]);
addch(BX[2]);
refresh();
system("sleep 1");
/* On some screens this next line will print graphics characters */
mvaddstr(2, 1, "Line two string: font_1");
refresh();
system("sleep 1");
putp (tparm(font_1));
refresh();
system("sleep 1");
/* Output box characters for line two of box */
addch(BX[9]);
addch(BX[10]);
addch(BX[1]);
addch(BX[7]);
refresh();
system("sleep 1");
/* Back to initial font */
putp (tparm(font_0));
refresh();
system("sleep 1");
mvaddstr(3, 1, "Yet another line at font 0");
refresh();
system("sleep 1");
putp (tparm(font_1));
refresh();
system("sleep 1");
/* Output box characters for line three of box */
addch(BX[3]);
addch(BX[3]);
addch(' ');
addch(BX[3]);
refresh();
system("sleep 1");
/* More of the box */
putp (tparm(font_0));
refresh();
mvaddstr(4, 1, "Line two string: font_0");
refresh();
system("sleep 1");
putp (tparm(font_1));
refresh();
system("sleep 1");
/* Output box characters for bottom of box */
addch(BX[5]);
addch(BX[8]);
addch(BX[1]);
addch(BX[4]);
refresh();
system("sleep 4");
putp (tparm(font_0));
refresh();
/* Output two more box characters in font 1 */
wclear(curscr);
wrefresh(curscr);
endwin();
Support Line: I need help with programming in C ITEM: H3376L
Dated: March 1994 Category: N/A
This HTML file was generated 99/06/24~13:30:47
Comments or suggestions?
Contact us