tam(S) 6 January 1993 tam(S) Name tam - TAM transition libraries Syntax cc . . . -ltam -lcurses #include <tam.h> int addch(c) char c; int addstr(s) char *s; int adf_gttok (ptr, tbl) char *ptr; struct s_kwtbl *tbl; char *adf_gtwrd (sptr, dptr) char *sptr, *dptr; char *adf_gtxcd (sptr, dptr) char *sptr, *dptr; int attroff(attrs) chtype attrs; int attron(attrs) chtype attrs; int baudrate() int beep() int cbreak() int clear() int clearok(dum1, dum2) int dum1, dum2; int clrtobot() int clrtoeol() int delch() int deleteln() int echo() int endwin() int erase() int exhelp (hfile, htitle) char *hfile, *htitle; int fixterm() int flash() int flushinp() int form (form, op) form_t *form; int op; int getch() int getyx(win, r, c) int win, r, c; int initscr() int insch(ch) char ch; int insertln() int iswind() char *kcodemap (code) unsigned char code; int keypad (dummy, flag) int dummy, flag; leaveok(dum1, dum2) int dummy; int menu (menu, op) menu_t *menu; int op; int message (mtype, hfile, htitle, format [, arg ...] int mtype; char *hfile, *htitle, *format; int move(r, c) int r, c; int mvaddch(r, c, ch) int r, c; char ch; int mvaddstr(r, c, s) int r, c; char *s; int mvinch(r, c) int r, c; nl() int nocbreak() int nodelay(dummy, bool) int dummy, bool; int noecho() nonl() int pb_check (stream) FILE *stream; int pb_empty (stream) FILE *stream; int pb_gbuf (ptr, n, fn, stream) char *ptr; int n; int (*fn) (); FILE *stream; char *pb_gets (ptr, n, stream) char *ptr; int n; FILE *stream; char *pb_name() FILE *pb_open() int pb_puts (ptr, stream) char *ptr; FILE *stream; int pb_seek (stream) FILE *stream; int pb_weof (stream) FILE *stream; int printw (fmt[, arg1 ... argn]) char *fmt; int refresh() int resetterm() int resetty() int savetty() int track (w, trk, op, butptr, whyptr) int w, op, *butptr, *whyptr; track_t *trk; int wcmd (wn, cp) short wn; char *cp; int wcreate (row, col, height, width, flags) short row, col, height, width; unsigned short flags; int wdelete (wn) short wn; void wexit(ret) int ret; int wgetc (wn) short wn; int wgetmouse (wn, ms) short wn; struct umdata *ms; int wgetpos (wn, rowp, colp) short wn; int *rowp, *colp; int wgetsel() int wgetstat (wn, wstatp) short wn; WSTAT *wstatp; int wgoto (wn, row, col) short wn, row, col; void wicoff (wn, row, col, icp) short wn, row, col; struct icon *icp; void wicon (wn, row, col, icp) short wn, row, col; struct icon *icp; int wind (type, height, width, flags, pfont) int type, height, width; short flags; char *pfont[]; void winit() int wlabel (wn, cp) short wn; char *cp; int wndelay (wn, bool) int wn, bool; void wnl (wn, flag) short wn; int flag; int wpostwait() int wprexec() int wprintf (wn, fmt[, arg1 ... argn]) short wn; char *fmt; int wprompt (wn, cp) short wn; char *cp; int wputc (wn, c) short wn; char c; int wputs (wn, cp) short wn; char *cp; int wrastop (w, srcbase, srcwidth, dstbase, dstwidth, srcx, srcy, dstx, dsty, width, height, srcop, dstop, pattern) int w; unsigned short *srcbase, *dstbase, *pattern; unsigned short srcwidth, dswidth, width, height; unsigned short srcx, srcy, dstx, dsty; char srcop, dstop; int wreadmouse (wn, xp, yp, bp, rp) short wn; int *xp, *yp, *bp, *rp; int wrefresh (wn) short wn; int wselect (wn) short wn; int wsetmouse (wn, ms) short wn; struct umdata *ms; int wsetstat (wn, wstatp) short wn; WSTAT *wstatp; int wslk (wn, 0, slong1, slong2, sshort) short wn; char *slong1, *slong2, *sshort; int wslk (wn, kn, llabel, slabel) short wn, kn; char *llabel, *slabel; int wuser (wn, cp) short wn; char *cp; Description These routines allow you to run character mode applications that run under the Terminal Access Method (TAM) on any display device supported by the curses(S) library. Once you change a TAM program to remove machine-specific code, you can then recompile it including the standard TAM header file tam.h and link it with the tam and curses libraries. The TAM transition library translates between TAM function calls and curses functions. For example, the TAM function wcreate() is mapped to the conversion library function TAMwcreate(), which consists of a series of curses calls, such as newwin() and subwin(). To enable the code in your TAM application program to run smoothly under curses, you should do the following: + remove code that would be executed if a low-level iswind() function call returned a non-zero value, i.e., true. Under the TAM transition library, iswind() always returns false. + remove all TAM calls to mouse management routines and the calls wicon(), wicoff(), and wrastop(), because they will translate to null operations. + remove all machine-specific code, because the TAM transition library does not translate system calls specifically tailored to the UNIX Sys- tem PC or calls [such as ioctl(S)] that have no meaning under curses. These calls fail under the TAM transition library on all machines except the UNIX System PC. + note that all calls to track(S) map to the low-level function wgetc(). + remove all references to TAM calls that bear the same name as curses calls because calls that have the same names in both systems have dif- ferent effects. + remove all arbitrary ANSI escape sequences for display output. For example, the TAM transition library does not recognize the escape sequence used on the UNIX System PC in the command echo "\033[J", which clears the screen. Instead, you should use equivalent curses routines (here, clear()). Eliminating the superfluous code in the first three cases reduces your program's size and execution time. Functions The following table summarizes the translation of TAM function calls to curses functions. You can use this table as a guide if you want to rewrite your TAM application to make curses calls directly and run more efficiently. Routines marked with a dagger ([+]) are macros and don't return any value. _________________________________________________________________________ TAM Function curses(S) Equivalent _________________________________________________________________________ addch()[+] Calls addch(). addstr()[+] Calls addstr(). attron() Calls attron(). attroff() Calls attroff(). baudrate() Calls baudrate(). beep() Calls beep(). cbreak() Calls cbreak(). clear() Calls clear(). clearok()[+] Null operation. clrtobot() Calls clrtobot(). clrtoeol() Calls clrtoeol(). delch() Calls delch(). deleteln() Calls deleteln(). echo() Calls echo(). erase()[+] Calls erase(). endwin() Calls endwin(). fixterm() Calls fixterm(). flash()[+] Calls flash(). flushinp() Calls flushinp(). getch() Calls getch(). getyx()[+] Calls wgetyx(). initscr() Calls initscr(). insch() Calls insch(). insertln() Calls insertln(). iswind() Returns FALSE. kcodemap() This functionality is not necessary. Remove this from your code. keypad() Calls keypad(). leaveok()[+] Null operation. move()[+] Calls move(). mvaddch()[+] Calls move() and addch(). mvaddstr()[+] Calls move() and addstr(). mvinch() Calls move() and inch(). nl()[+] The functionality of this routine is not supported by curses. nocbreak() Calls nocbreak(). nodelay() Calls nodelay(). noecho() Calls noecho(). nonl()[+] The functionality of this routine is not supported by curses. printw() Calls printw(). refresh()[+] Calls refresh(). resetterm() Calls resetterm(). resetty() Calls resetty(). savetty() Calls savetty(). track() Calls wgetch(). wcmd() Copies the character string passed by wcmd() to the bottom of the screen. wcreate() Calls newwin() or newpanel(). wdelete() Calls delwin() or delpanel(). wexit() Calls endwin() and exit(). wgetsel() Calls toppanel() or bottompanel() with NULL pointer. wgetstat() Calls getyx(), getmaxyx(), or getbe- gyx(). wgetc() Calls wgetch(). Character transla- tion from curses to ANSI may be required, depending on the current keypad mode. wgetpos() Calls getyx(). wgoto() Calls wmove(). winit() Calls initscr(). wlabel() The character string is printed in the upper left corner of the speci- fied window. wndelay() Calls nodelay(). wselect() Calls touchwin() and wrefresh(), then updates the list of windows to indi- cate the new ordering. wsetstat() Calls delpanel(), then newpanel(). wputc() Calls waddch(). wputs() Calls waddstr(). wprintf() Calls wprintw(). wprompt() The character string passed by wprompt() is copied to the bottom of the screen. wrefresh() Calls wrefresh(). If the window index is -1, all windows should be refreshed in the appropriate order. wslk() Creates small window at bottom and uses curses routines with wprintw(). wuser() This functionality is not necessary. Remove this from your code. wsetmouse() This is a null operation. wgetmouse() This is a null operation. wreadmouse() This is a null operation. wprexec() Calls erase() and refresh(). wpostwait() Calls wrefresh() for each window in the window list. wnl() The functionality of this routine is not supported by curses. wicon() This is a null operation. wicoff() This is a null operation. wrastop() This is a null operation. Because the high-level TAM functions in the previous table make calls only to the low-level functions in the previous table, you can continue to use those high-level TAM functions in your application programs as well. However, with curses you cannot use other TAM high-level functions such as wtargeton(). Usable TAM high-level functions _________________________________________________________________________ form() menu() message() _________________________________________________________________________ pb_empty() pb_gets() adf_gttok() pb_open() pb_check() pb_seek() pb_name() pb_puts() pb_weof() pb_gbuf() adf_gtwrd() adf_gtxcd() wind() exhelp() Both TAM and curses use a set of virtual function keys that translate between an escape character sequence entered at the keyboard and a bit pattern inside the machine. Under the TAM transition library, the TAM virtual key values are translated into curses virtual key values. The following table lists these equivalent virtual key values. The escape sequence listed in the left column generates the corresponding TAM virtual function key value given in the middle column. The right column lists the curses equivalent of the TAM virtual key and is for reference only. _________________________________________________________________________ TAM Escape Virtual Key Value Sequence TAM curses _________________________________________________________________________ ESC-! s_F1 KEY_F(8) ESC-@ s_F2 KEY_F(9) ESC-# s_F3 KEY_F(10) ESC-$ s_F4 KEY_F(11) ESC-% s_F5 KEY_F(12) ESC-^ s_F6 KEY_F(13) ESC-& s_F7 KEY_F(14) ESC-* s_F8 KEY_F(15) ESC-f1 PF1 KEY_F(16) ESC-f2 PF2 KEY_F(17) ESC-f3 PF3 KEY_F(18) ESC-f4 PF4 KEY_F(19) ESC-f5 PF5 KEY_F(20) ESC-f6 PF6 KEY_F(21) ESC-f7 PF7 KEY_F(22) ESC-f8 PF8 KEY_F(23) ESC-f9 PF9 KEY_F(24) ESC-f0 PF10 KEY_F(25) ESC-f- PF11 KEY_F(26) ESC-f= PF12 KEY_F(27) ESC-1 F1 KEY_F(0) ESC-2 F2 KEY_F(C) ESC-3 F3 KEY_F(S) ESC-4 F4 KEY_F(S) ESC-5 F5 KEY_F(F) ESC-6 F6 KEY_F(M) ESC-7 F7 KEY_F(6) ESC-8 F8 KEY_F(7) ESC-bg Beg KEY_BEG ESC-BG s_Beg KEY_SBEG ESC-br Break KEY_BREAK ESC-bw Back KEY_LEFT ESC-BW s_Back KEY_SLEFT ESC-ce Clear KEY_CLEAR ESC-CE Clear KEY_CLEAR ESC-ci ClearLine KEY_EOL ESC-CI s_ClearLine KEY_SEOL ESC-cl Close KEY_CLOSE ESC-CL Close KEY_CLOSE ESC-cm Cmd KEY_COMMAND ESC-CM s_Cmd KEY_SCOMMAND ESC-cn Cancl KEY_CANCEL ESC-CN s_Cancl KEY_SCANCEL ESC-cp Copy KEY_COPY ESC-CP s_Copy KEY_SCOPY ESC-cr Creat KEY_CREATE ESC-CR s_Creat KEY_SCREATE ESC-dc DleteChar KEY_DC ESC-Del DleteChar KEY_DC ESC-DC s_DleteChar KEY_SDC ESC-dl Dlete KEY_DL ESC-DL s_Dlete KEY_SDL ESC-dn Down KEY_DOWN ESC-DN RollDn KEY_SF ESC-en End KEY_END ESC-EN s_End KEY_SEND ESC-ESC Esc none ESC-ex Exit KEY_EXIT ESC-EX s_Exit KEY_SEXIT ESC-fi Find KEY_FIND ESC-FI s_Find KEY_SFIND ESC-fw Forward KEY_RIGHT ESC-FW s_Forward KEY_SRIGHT ESC-hl Help KEY_HELP ESC-? Help KEY_HELP ESC-HL s_Help KEY_SHELP ESC-hm Home KEY_HOME ESC-HM s_Home KEY_SHOME ESC-im InputMode KEY_IC ESC-NJ s_InputMode KEY_SIC ESC-mk Mark KEY_MARK ESC-MK Slect KEY_SELECT ESC-ms Msg KEY_MESSAGE ESC-MS s_Msg KEY_SMESSAGE ESC-mv Move KEY_MOVE ESC-MV s_Move KEY_SMOVE ESC-nx Next KEY_NEXT ESC-NX s_Next KEY_SNEXT ESC-op Open KEY_OPEN ESC-OP Close KEY_CLOSE ESC-ot Opts KEY_OPTIONS ESC-OT s_Opts KEY_SOPTIONS ESC-pg Page KEY_NPAGE ESC-PG s_Page KEY_PPAGE ESC-pr Print KEY_PRINT ESC-PR s_Print KEY_SPRINT ESC-pv Prev KEY_PREVIOUS ESC-PV s_Prev KEY_SPREVIOUS ESC-rd RollDn KEY_SF ESC-RD RollDn KEY_SF ESC-re Ref KEY_REFERENCE ESC-RE Rstrt KEY_RESTART ESC-rf Rfrsh KEY_REFRESH ESC-RF Clear KEY_CLEAR ESC-rm Rsume KEY_RESUME ESC-RM s_Rsume KEY_SRSUME ESC-ro Redo KEY_REDO ESC-RO s_Redo KEY_SREDO ESC-rp Rplac KEY_REPLACE ESC-RP s_Rplac KEY_SREPLACE ESC-rs Rstrt KEY_REFERENCE ESC-RS Rstrt KEY_RESTART ESC-ru RollUp KEY-SR ESC-RU RollUp KEY_SR ESC-sl Slect KEY_SELECT ESC-SL Slect KEY_SELECT ESC-ss Suspd KEY_SUSPEND ESC-SS s_Suspd KEY_SSUSPEND ESC-sv Save KEY_SAVE ESC-SV s_Save KEY_SSAVE ESC-ud Undo KEY_UNDO ESC-UD s_Undo KEY_SUNDO ESC-up Up KEY_UP ESC-UP RollUp KEY_SR Some keyboards have one or more keys that emit escape sequences that are identical to the UNIX System PC keyboard sequences but do not match in terms of functionality. The function of an operationally incompatible key will always map to its terminfo specification. The TAM specific function implied by the same escape sequence will be accessible through the technique described above. Mechanisms in curses(S) automatically handle timing conflicts between actual keyboard function keys and UNIX System PC keyboard escape sequences. See also curses(S), field(S), fieldtype(S), form(S), item(S), menu(S), panel(S) Standards conformance tam is not part of any currently supported standard; it is an extension of AT&T System V provided by the Santa Cruz Operation.