Defines | |
#define | mt_AvStrfmt(a, b, c) AvStrfmt(b,c) |
see AvStrfmt() | |
Functions | |
int | mt_AvInit (APPvar *app, char *name, int status, long idle) |
Initialize the AV protocol. | |
void | mt_AvExit (APPvar *app) |
close an AV session opened with AvInit() | |
INT16 * | mt_AvStatus (APPvar *app) |
returns features supported by AV server. | |
char * | mt_AvServer (APPvar *app) |
returns the name of the AV server | |
int | mt_AvWaitfor (APPvar *app, int, INT16 *, long) |
Wait for a given message. | |
char * | AvStrfmt (int mode, char *src) |
Quote or unquote filenames (utility for VA-protocol, Drag 'n drop, . |
#define mt_AvStrfmt | ( | a, | |||
b, | |||||
c | ) | AvStrfmt(b,c) |
see AvStrfmt()
char* AvStrfmt | ( | int | mode, | |
char * | src | |||
) |
Quote or unquote filenames (utility for VA-protocol, Drag 'n drop, .
..)
mode | action to perform :
| |
src | string that contains the filename(s). This string will not be modified. |
QUOTING: if "src" contains at least one space character " ", quotes will be add at the begin and at the end of the string.
ex: [filename\0] --> [filename\0] (no changed) ex: [filename with spaces\0] --> ['filename with spaces'\0]
UNQUOTING: the returned string will contain the filenames without quotes. The NULL character is used to separate filenames. 2 successives NULL-char are used to end the list
ex: [filename1 'file name 2' filename3] --> [filename1\0file name 2\0filename3\0\0]
void mt_AvExit | ( | APPvar * | app | ) |
close an AV session opened with AvInit()
app | application descriptor. |
int mt_AvInit | ( | APPvar * | app, | |
char * | name, | |||
int | status, | |||
long | idle | |||
) |
Initialize the AV protocol.
app | application descriptor | |
name | name of the client application (normaly, our application) in AES format (a 8-capitalized character eventually completed with space character), | |
status | bitfield defining the supported features by the client application:
| |
idle | timeout for the server reply (units: ms). the value "1000" is a good choice. |
To identifiate the AV server, mt_AvInit() uses the environ variable AVSERVER. If this variable is not defined, AvInit() tries the following processes: 'AVSERVER', 'THING', 'GEMINI' then the desktop application.
mt_AvInit() declares to the server the actions supported by the client (our application). The AV client states table displayed below gives the differents possible value. Among these values, the A_QUOTE value is very important. It means that the client supportes quoted filename : when a filename contains a space character, the complete string is surrounded by a quote character. For example, the string "The World" is quoted: "'The World'". Use mt_AvStrfmt() function to quote or unquote the strings.
On return, mt_AvInit() returns the AV server AES pid (or negative error) and app->avid contains this pid.
char* mt_AvServer | ( | APPvar * | app | ) |
returns the name of the AV server
app | application descriptor, |
INT16* mt_AvStatus | ( | APPvar * | app | ) |
returns features supported by AV server.
app | application descriptor |
int mt_AvWaitfor | ( | APPvar * | app, | |
int | msg, | |||
INT16 * | buf, | |||
long | idle | |||
) |
Wait for a given message.
app | application descriptor | |
msg | message to wait for, | |
buf | 8-word buffer, | |
idle | time idle, |
Importante remark : AvWaitfor() does not make use of EvntWindom(), just evnt_multi().
Example :
// ask to server to launch an application and wait the answer int exec_prog( char *prg, char *cmd) { ApplWrite( app.avid, AV_STARTPROG, prg, cmd, 0); return AvWaitfor( VA_PROGSTARTED, evnt.buf, 1000); }