Previous Page TOC Next Page

Character User Interface (FMLI and ETI)

TAM Transition Library

Introduction


Character mode applications that run under the Terminal Access Method (TAM) on the UNIX PC can now run under ETI with a wide range of terminals. This appendix explains how to use the TAM transition library, the source of this portability. In addition, it explains how you can eventually rewrite your TAM application programs to run more efficiently under ETI without the TAM transition library.

Compiling and Running TAM Applications Under ETI


The TAM transition library consists of a header file tam.h and a set of library routines. The file tam.h translates between TAM routines and equivalent sets of low-level ETI routines. For example, the TAM function wcreate() is mapped to the conversion library function TAMwcreate(), which consists of a series of low-level calls, such as newwin() and subwin().

To use the TAM transition library, be sure to include the standard TAM header file tam.h in your application program. So at the beginning of your TAM application program, you should already have


Next, you recompile and link your application program, say tamprog.c, to form an executable, as follows:


Note the use of the -I option, which tells the compiler where to find the TAM header files. The two uses of the -l option link to requisite library subroutines, the TAM transition library and the low-level ETI library.

Alternatively, you might separately compile one or more TAM application files (say, tam1.c, tam2.c, and main.c) and later link them to form an executable program.


Note that the -I option is required for the compilation of any file that uses the TAM library.

Tips for Polishing TAM Application Programs Running under ETI


To enable the code in your TAM application program to run smoothly under ETI, you should do the following:


Eliminating the superfluous code in the first three cases reduces your program's size and execution time.

How the TAM Transition Library Works


The TAM Transition Library translates between TAM function calls and low-level ETI function calls. It also ensures that escape and control sequences entered at a terminal's keyboard are properly interpreted.

Translations from TAM Calls to ETI Calls


The following table summarizes the translation of TAM to low-level ETI (curses) functions. Eventually, if you want to rewrite your TAM applications to make ETI calls directly and to run more efficiently, you can use this table as a guide.

TAM Call

ETI Call

winit ()

Call initscr().

wexit ()

Call endwin() and exit().

iswind ()

Return FALSE.

wcreate ()

Call newwin() or new_panel().

wdelete ()

Call delwin() or del_panel().

wselect ()

Call touchwin() and wrefresh(), then update the list of windows to indicate the new ordering.

wgetsel ()

Call top_panel() or bottom_panel() with NULL pointer.

wgetstat ()

Call getyx(), getmaxyx(), or getbegyx().

wsetstat ()

Call del_panel(), then new_panel().

wputc ()

Call waddch().

wputs ()

Call waddstr().

wprintf ()

Call wprintw().

wslk ()

Create small window at bottom and use curses routines with wprintw().

wcmd ()

The character string passed by wcmd() is copied to the bottom of the screen.

wprompt ()

The character string passed by wprompt() is copied to the bottom of the screen.

wlabel ()

The character string is printed in the upper left corner of the specified window.

wrefresh ()

Call wrefresh(). If the window index is -1, all windows should be refreshed in the appropriate order.

wuser ()

This functionality is not necessary. Remove this from you code.

wgoto ()

Call wmove().

wgetpos ()

Call getyx().

wgetc ()

Call wgetch(). Character translation from ETI to ANSI may be required depending on the current keypad mode.

kcodemap ()

This functionality is not necessary. Remove this from your code.

keypad ()

Call keypad().

wsetmouse ()

This is a null operation.

wgetmouse ()

This is a null operation.

wreadmouse ()

This is a null operation.

wprexec ()

Call erase() and refresh().

wpostwait ()

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

track ()

Call wgetch().

initscr ()

Call initscr().

nl ()

The functionality of this routine is not supported by curses.

nonl

The functionality of this routine is not supported by curses.

cbreak ()

Call cbreak().

nocbreak ()

Call nocbreak().

echo ()

Call echo().

noecho ()

Call noech().

insch ()

Call insch().

getch ()

Call getch().

flushinp ()

Call flushinp().

attron ()

Call attron().

attroff ()

Call attroff().

savetty ()

Call savetty().

resetty ()

Call resetty().

addch ()

Call addch().

addstr ()

Call addstr().

beep ()

Call beep().

clear ()

Call clear().

clearok ()

This is a null operation.

clrtobot ()

Call clrtobot().

clrtoeol ()

Call clrtoeol().

delch ()

Call delch().

deleteln ()

Call deleteln().

erase ()

Call erase().

flash ()

Call flash().

getyx ()

Call wgetyx().

insertln ()

Call insertln().

leaveok ()

This is a null operation.

move ()

Call move().

mvaddch ()

Call move() and addch().

mvaddstr ()

Call move() and addstr().

mvinch ()

Call move() and inch().

nodelay ()

Call nodelay().

wndelay ()

Call nodelay().

refresh ()

Call refresh().

resetterm ()

Call resetterm().

baudrate ()

Call baudrate().

endwin ()

Call endwin().

fixterm ()

Call fixterm().

printw ()

Call printw().


Because the high-level TAM functions in the following 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 ETI, you cannot use other TAM high-level functions such as wtargeton().

The TAM Transition Keyboard Subsystem


Both TAM and ETI 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 ETI virtual key values.

The following table lists these equivalent virtual key values. Entering the escape sequence listed in the left column will generate the corresponding TAM virtual function key value given in the middle column. The right column lists the ETI equivalent of the TAM virtual key and is for reference only.


Some keyboards have one or more keys that emit escape sequences that are identical to the UNIX 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 describe above. Mechanisms in curses(3X) automatically handle timing conflicts between actual keyboard function keys and UNIX PC keyboard escape sequences.

Previous Page Page Top TOC Next Page