Документ взят из кэша поисковой машины. Адрес оригинального документа : http://hea-www.harvard.edu/RD/saotng/xpaif.html
Дата изменения: Unknown
Дата индексирования: Mon Oct 1 23:16:18 2012
Кодировка:

Поисковые слова: обвмадеойс нефептощи рпфплпч
Interfacing with Fortran and C programs

Interfacing with Fortran and C programs

In addition to the xpaset and xpaget commands, the XPA mechanism supports C and Fortran interfaces to SAOtng. Using these interfaces, you can open a connection to SAOtng and exchange data and commands. The C and Fortran calls are:

void *OpenXPA(char *name)
integer function openxpa (char name[])

Open a connection to the XPA program. The name of the SAOtng program is SAOtng or whatever name was used with the -title switch. This call starts an intermediate xpaserver program to mediate between your program and SAOtng (implemented this way so that you need not link X calls into your program).

void SetXPAValue(void *xpas,
char *paramlist, void *buf, int len)
subroutine setxpavaluec(int xpas,
char paramlist[], char buf[], int len)
subroutine setxpavaluei(int xpas,
char paramlist[], int buf[], int len)

Set the value of an XPA public access point. This is equivalent to the xpaset command:
    cat [buf] | xpaset [name] [paramlist]
The len variable specifies the size of buf in bytes. For most simple cases, buf can be set to NULL and len to 0. For example, to set the colormap to SLS, call:
    SetXPAValue(xpas, "colormap SLS", NULL, 0);

int GetXPAValue(void *xpas,
char *paramlist, void *buf, int len)
integer function getxpavaluec(int xpas,
char paramlist[], char buf[], int len)
integer function etxpavaluei(int xpas,
char paramlist[], int buf[], int len)

Get the value of an XPA public access point. This is equivalent to the xpaget command:
    xpaget [name] [paramlist] (into [buf])
It returns its data into buf and returns a byte count of the size of the returned data.

CloseXPA(void *xpas)
closexpa(int xpas)

Close the XPA connection. This causes the intermediate XPA server program to exit.

When adding the XPA interface to your program, you must link with the following libraries in saord/lib: libxpa, libutil, libparam. (Yes, we need to make a better separation of library routines to eliminate the need to link libparam!).

See the file saord/XPA/ftest.f for example code that interfaces with SAOtng from Fortran.


Last Updated June 14, 1997