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
You use these routines to run character-mode applications
under the Terminal Access Method
(TAM)
on any display device supported by the
curses
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(S-osr5)
functions. For example, the
TAM
function
wcreate(S-osr5)
is mapped to the conversion library function
TAMwcreate(),
which consists of a series of
curses
calls, such as
newwin(S-osr5)
and
subwin(S-osr5).
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(S-osr5)
function call returned a non-zero value, i.e.,
TRUE.
Under the
TAM
transition library,
iswind( )
always returns
FALSE.
remove all machine-specific code, because the
TAM
transition library does not translate
system calls specifically tailored to the
UNIX System PC
or calls (such as
ioctl(S-osr5))
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-osr5)
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 different 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 "nbsp;33[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-osr5) 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 new_panel().
wdelete()
Calls delwin() or del_panel().
wexit()
Calls endwin() and exit().
wgetsel()
Calls top_panel() or bottom_panel()
with NULL pointer.
wgetstat()
Calls getyx(), getmaxyx(), or getbegyx().
wgetc()
Calls wgetch().
Character translation 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 specified window.
wndelay()
Calls nodelay().
wselect()
Calls touchwin() and wrefresh(),
then updates the list of windows to
indicate the new ordering.
wsetstat()
Calls del_panel(), then new_panel().
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)
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_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-osr5)
automatically handle timing conflicts between
actual keyboard function keys and
UNIX System PC
keyboard escape sequences.
Return values
Routines that return an integer return
ERR on failure and an integer value other than
ERR, typically
OK, on successful completion,
unless otherwise noted in the routine descriptions.
Routines that return a pointer to an object return
NULL if an error occurs.