afc@shibaya.lonestar.org (Augustine Cano) (04/02/91)
Ah! the curses of curses... I've been trying to exorcise character attributes, but my Cabalistic code is not powerful enough. It is possible to display at least BOLD characters with a plain C program, as shown below. The following attributes are defined in /usr/include/curses.h: /* Various video attributes */ #define A_STANDOUT 0000200 #define _STANDOUT A_STANDOUT /* for compatibility with old curses */ #define A_UNDERLINE 0000400 #define A_REVERSE 0001000 #define A_BLINK 0002000 #define A_DIM 0004000 #define A_BOLD 0010000 #define A_ALTCHARSET 0100000 The following program attempts to display something in all of these attributes, with varying results: /************************************************************************/ #include <curses.h> main() { initscr(); attrset (A_NORMAL); mvprintw (8,5, "NORMAL"); attrset (A_STANDOUT); /* Doesn't work: displayed in REVERSE */ mvprintw (10,60, "STANDOUT"); attrset (A_UNDERLINE); /* OK */ mvprintw (12,20, "UNDERLINE"); attrset (A_REVERSE); /* OK */ mvprintw (14,30, "REVERSE"); attrset (A_BLINK); /* Doesn't work: displayed in REVERSE */ mvprintw (16,40, "BLINK"); attrset (A_DIM); /* OK */ mvprintw (18,10, "DIM"); attrset (A_BOLD); /* Doesn't work: displayed in REVERSE */ mvprintw (20,5, "BOLD"); attrset (A_NORMAL); refresh(); endwin(); exit(0); } /************************************************************************/ I don't know how STANDOUT should appear, but BOLD is significant because it works correctly in the non-curses program below: /************************************************************************/ #include <stdio.h> main() { /* * These escape sequences are documented in the Communications Management * manual, page A10. */ printf("NORMAL\n"); printf("\n%c[%dm%s%c[0m\n",27,1,"BOLD IS OK",27); printf("\n%c[%dm%s%c[0m\n",27,2,"DIM IS OK",27); printf("\n%c[%dm%s%c[0m\n",27,4,"UNDERLINE IS OK",27); printf("\n%c[%dm%s%c[0m\n",27,7,"REVERSE IS OK",27); printf("\n%c[%dm%s%c[0m\n",27,8,"CONCEALED DOESN'T WORK",27); /* * These are not documented in the Communications Management manual. * Only the last one works. */ printf("\n%c[%dm%s%c[0m\n",27,3,"NOTHING HAPPENS",27); printf("\n%c[%dm%s%c[0m\n",27,5,"NOTHING HAPPENS",27); printf("\n%c[%dm%s%c[0m\n",27,6,"NOTHING HAPPENS",27); printf("\n%c[%dm%s%c[0m\n",27,9,"CROSSED OUT",27); exit(0); } /************************************************************************/ I could believe that it is impossible to do blinking in the unix pc, but is there a way to display text in STANDOUT and BOLD attributes using curses? BTW, this is 3.51m with 3.51 Foundation set and 3.51 Develpment set. -- Augustine Cano INTERNET: afc@shibaya.lonestar.org UUCP: ...!{ernest,egsner}!shibaya!afc
lied@cbnewsc.att.com (Bob Lied) (04/03/91)
More likely than curses being broken is that the terminfo entry is less than all-inclusive. As someone already mentioned, there are better terminfo entries floating around. Also, you mentioned the Communication Management documentation. Note that the capabilities of the terminal emulator are not the same as the capabilities of the terminal. For instance, the vt100 emulator of ATE does not support some of the character attributes that the native UNIX PC does, no matter what you put in terminfo. And of course, the terminfo will change from machine to machine. So disassemble the terminfo and look closely. There might be bugs in curses, but for such basics as STANDOUT, it's probably the terminal description. Bob Lied att!ihlpf!lied
bruce@balilly (Bruce Lilly) (04/03/91)
In article <1991Apr1.231435.3609@shibaya.lonestar.org> afc@shibaya.lonestar.org (Augustine Cano) writes: > >attrset (A_STANDOUT); /* Doesn't work: displayed in REVERSE */ >attrset (A_BLINK); /* Doesn't work: displayed in REVERSE */ >attrset (A_BOLD); /* Doesn't work: displayed in REVERSE */ > >/************************************************************************/ > >I don't know how STANDOUT should appear, but BOLD is significant because >it works correctly in the non-curses program below: > >/************************************************************************/ > >printf("\n%c[%dm%s%c[0m\n",27,1,"BOLD IS OK",27); >printf("\n%c[%dm%s%c[0m\n",27,2,"DIM IS OK",27); >printf("\n%c[%dm%s%c[0m\n",27,4,"UNDERLINE IS OK",27); >printf("\n%c[%dm%s%c[0m\n",27,7,"REVERSE IS OK",27); >printf("\n%c[%dm%s%c[0m\n",27,8,"CONCEALED DOESN'T WORK",27); > >printf("\n%c[%dm%s%c[0m\n",27,3,"NOTHING HAPPENS",27); >printf("\n%c[%dm%s%c[0m\n",27,5,"NOTHING HAPPENS",27); >printf("\n%c[%dm%s%c[0m\n",27,6,"NOTHING HAPPENS",27); >printf("\n%c[%dm%s%c[0m\n",27,9,"CROSSED OUT",27); > >/************************************************************************/ > >I could believe that it is impossible to do blinking in the unix pc, but >is there a way to display text in STANDOUT and BOLD attributes using >curses? > >BTW, this is 3.51m with 3.51 Foundation set and 3.51 Develpment set. Check your terminfo settings: 7300|s4|S4|unixpc|pc7300|PC7300|unix_pc|AT&T UNIX PC Model 7300, am, km, cols#80, lh#2, lines#24, lw#8, nlab#8, pb#9600, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[=1C, clear=\E[2J\E[H, cr=\r, cub=\E[%p1%dD, cub1=\b, cud=\E[%p1%dB$<5*/>, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%2.2d;%p2%3.3dH$<6*/>, cuu=\E[%p1%dA$<5*/>, cuu1=\E[A, cvvis=\E[=0C, dim=\E[2m, dl=\E[%p1%dM$<5*/>, dl1=\E[M, ed=\E[0J, el=\E[0K, home=\E[H, il=\E[%p1%dL$<5*/>, il1=\E[L, ind=\n, invis=\E[9m, kBEG=\ENB, kCAN=\EOW, kCMD=\EOU, kCPY=\END, kCRT=\EON, kDC=\ENF, kDL=\ENE, kEND=\ENN, kEOL=\EOA, kEXT=\EOK, kFND=\EOX, kHLP=\EOM, kHOM=\ENM, kIC=\ENJ, kLFT=\ENK, kMOV=\ENC, kMSG=\EOL, kNXT=\ENH, kOPT=\EOR, kPRT=\EOZ, kPRV=\ENG, kRDO=\EOT, kRES=\EOQ, kRIT=\ENL, kRPL=\EOY, kSAV=\EOO, kSPD=\EOP, kUND=\EOS, kbeg=\E9, kbs=\b, kcan=\EOw, kcbt=\E[Z, kclo=\EOV, kclr=\E[J, kcmd=\EOu, kcpy=\ENd, kcrt=\EOn, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\ENf, kdl1=\ENe, kel=\EOa, kend=\E0, kext=\EOk, kf1=\EOc, kf2=\EOd, kf3=\EOe, kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, kfnd=\EOx, khlp=\EOm, khome=\E[H, kich1=\ENj, kind=\E[S, kmov=\ENc, kmrk=\ENi, kmsg=\EOl, knp=\E[U, knxt=\ENh, kopn=\EOv, kopt=\EOr, kpp=\E[V, kprt=\EOz, kprv=\ENg, krdo=\EOt, kref=\EOb, kres=\EOq, krfr=\ENa, kri=\E[T, krpl=\EOy, krst=\EOB, ksav=\EOo, kslt=\ENI, kspd=\EOp, kund=\EOs, nel=\EE, prot=\E[9m, rev=\E[7m, ri=\EM, rmacs=\E[10m, rmam=\E[0w, rmso=\E[0m$<4*/>, rmul=\E[0m, sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t^N%e^O%;$<7*/>, sgr0=\E[0;10m$<4*/>, smacs=\E[11m, smam=\E[=1w, smso=\E[1;7m$<4*/>, smul=\E[4m, Note especially the sgr string, as well as the individual bold, smso, etc. -- Bruce Lilly blilly!balilly!bruce@sonyd1.Broadcast.Sony.COM
dnichols@ceilidh.beartrack.com (DoN Nichols) (04/03/91)
In article <1991Apr1.231435.3609@shibaya.lonestar.org> afc@shibaya.lonestar.org (Augustine Cano) writes: > >Ah! the curses of curses... I've been trying to exorcise character >attributes, but my Cabalistic code is not powerful enough. It is >possible to display at least BOLD characters with a plain C program, >as shown below. [ ... ] > >printf("NORMAL\n"); >printf("\n%c[%dm%s%c[0m\n",27,1,"BOLD IS OK",27); >printf("\n%c[%dm%s%c[0m\n",27,2,"DIM IS OK",27); >printf("\n%c[%dm%s%c[0m\n",27,4,"UNDERLINE IS OK",27); >printf("\n%c[%dm%s%c[0m\n",27,7,"REVERSE IS OK",27); >printf("\n%c[%dm%s%c[0m\n",27,8,"CONCEALED DOESN'T WORK",27); It looks as though the terminfo file for the 3b1 is braindamaged, since the requests through curses don't work, but the explicit character sequences do. Terminfo should return the appropriate sequences to perform the requested functions. Check what they are returning against the sequences in your explicit example above. (I haven't checked these myself, but it could easily be the problem. You might compare them to the termcap info as well.) [ ... ] -- Donald Nichols (DoN.) | Voice (Days): (703) 664-1585 D&D Data | Voice (Eves): (703) 938-4564 Disclaimer: from here - None | Email: <dnichols@ceilidh.beartrack.com> --- Black Holes are where God is dividing by zero ---
john@chance.UUCP (John R. MacMillan) (04/05/91)
|The following attributes are defined in /usr/include/curses.h: The attributes in curses.h are ones that curses knows how to look for; there's no guarantee that any given terminal can actually do them. The capabilities for terminals are given by the terminfo(4) files. I tend to think of terminfo files as personal, customizable part of your environment. |attrset (A_STANDOUT); /* Doesn't work: displayed in REVERSE */ This is because the default ``standout'' mode on the s4 terminfo (in particular the ``smso'' capability) is reverse. Standout mode is just supposed to be something noticeable. It could be bold, reverse, underline, blinking, or some combination of the above. This is one reason I think terminfo files are personal; you want to pick a standout mode that you like, and doesn't look stupid when used by the tools you normally use (some programs expect standout to be reverse, and may look really funny if you set it for dim). |attrset (A_REVERSE); /* OK */ |mvprintw (14,30, "REVERSE"); |attrset (A_BLINK); /* Doesn't work: displayed in REVERSE */ This is because the s4 console can't blink, so the A_REVERSE from above is still in effect, I think. |attrset (A_BOLD); /* Doesn't work: displayed in REVERSE */ This again is dependent on the terminfo entry, in this case, the ``bold'' capability. |/* | * These escape sequences are documented in the Communications Management | * manual, page A10. | */ The whole set of screen escapes is documented in escape(7) in Volume 1 of the User's Manual. |I could believe that it is impossible to do blinking in the unix pc, but |is there a way to display text in STANDOUT and BOLD attributes using |curses? Yes, change your terminfo file for the s4 terminal. Useful man pages are infocmp(1M), terminfo(4), tic(1M), tput(1), and escape(7). In my manual set, these are all in Volume 1 of the User's Manual, the first 4 in a section at the end dealing with curses, and the last one in with the rest of the section 7 man pages. If you make the changes in a personal area, rather than the system one, you will have to set the environment variable TERMINFO to point to your area (mine is /u/john/lib/terminfo). Just for anyone who cares, this is my personal s4 terminfo description: # # Personalized entry for the console on an AT&T UNIX PC, with # most (all?) of the entries from the escape(7) man page. # # Uses km (has meta-key) because I use Ford's keyboard driver # Uses acsc, smacs, rmacs (alternate character set) based on # having a modified /usr/lib/wfont/BLD.ft loaded into slot one # (also affects sgr) # is2 (init string) clears to end of display; this isn't strictly # necessary # s4|S4|unixpc|unix_pc|3b1|3B1|7300|pc7300|PC7300|AT&T UNIX PC Model 7300, am, km, mir, msgr, xon, cols#80, it#8, lines#24, acsc=+h\,g.e0dis-f``aafigphrjjkkllmmnnooqqs_ttuuvvwwxx~~, bel=^G, bold=\E[1m, civis=\E[=1C, clear=\E[2J\E[H, cnorm=\E[=C, cr=\r, cub=\E[%p1%dD, cub1=\b, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, home=\E[H, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\n, indn=\E[%p1%dS, is2=\E[J\E[;10m, kBEG=\ENB, kCAN=\EOW, kCMD=\EOU, kCPY=\END, kCRT=\EON, kDC=\ENF, kDL=\ENE, kEND=\ENN, kEOL=\EOA, kEXT=\EOK, kFND=\EOX, kHLP=\EOM, kHOM=\ENM, kIC=\ENJ, kLFT=\ENK, kMOV=\ENC, kMSG=\EOL, kNXT=\ENH, kOPT=\EOR, kPRT=\EOZ, kPRV=\ENG, kRDO=\EOT, kRES=\EOQ, kRIT=\ENL, kRPL=\EOY, kSAV=\EOO, kSPD=\EOP, kUND=\EOS, kbeg=\E9, kbs=\b, kcan=\EOw, kclo=\EOV, kclr=\E[J, kcmd=\EOu, kcpy=\ENd, kcrt=\EOn, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\ENf, kdl1=\ENe, kel=\EOa, kend=\E0, kext=\EOk, kf1=\EOc, kf2=\EOd, kf3=\EOe, kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, kfnd=\EOx, khlp=\EOm, khome=\E[H, kich1=\ENj, kind=\E[S, kmov=\ENc, kmrk=\ENi, kmsg=\EOl, knp=\E[U, knxt=\ENh, kopn=\EOv, kopt=\EOr, kpp=\E[V, kprt=\EOz, kprv=\ENg, krdo=\EOt, kref=\EOb, kres=\EOq, krfr=\ENa, kri=\E[T, krpl=\EOy, krst=\EOB, ksav=\EOo, kslt=\ENI, kspd=\EOp, kund=\EOs, nel=\EE, rev=\E[7m, ri=\EM, rin=\E[%p1%dT, rmacs=\E[10m, rmso=\E[m, rmul=\E[m, sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p9%t;11%e;10%;m, sgr0=\E[;10m, smacs=\E[11m, smso=\E[7m, smul=\E[4m,