File: dxl.h

package info (click to toggle)
dx 1:4.4.0-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 51,684 kB
  • ctags: 48,796
  • sloc: ansic: 365,033; cpp: 156,603; sh: 13,395; java: 10,374; makefile: 2,377; awk: 444; yacc: 327; cs: 49
file content (327 lines) | stat: -rw-r--r-- 11,189 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
/***********************************************************************/
/* Open Visualization Data Explorer                                    */
/* (C) Copyright IBM Corp. 1989,1999                                   */
/* ALL RIGHTS RESERVED                                                 */
/* This code licensed under the                                        */
/*    "IBM PUBLIC LICENSE - Open Visualization Data Explorer"          */
/***********************************************************************/
/* 
 * (C) COPYRIGHT International Business Machines Corp. 1995
 * All Rights Reserved
 * Licensed Materials - Property of IBM
 * 
 * US Government Users Restricted Rights - Use, duplication or
 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 *
 */


#ifndef _DXL_H
#define _DXL_H

#ifdef OS2
#define INCL_DOS
#include <os2.h>
#define WM_DXL_HANDLE_PENDING_MESSAGE WM_USER+3000
#endif

#ifdef DXD_WIN
#define WM_DXL_HANDLE_PENDING_MESSAGE WM_USER+3000
#endif

#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif

typedef int DXLError;   /* Will be one of ERROR or OK */
#ifndef ERROR
#define ERROR 0
#endif
#ifndef OK
#define OK 1
#endif

/*
 * Connection specific structure.
 */
typedef struct DXLConnection DXLConnection;


/*
 * These are the routines that most applications would use to start DX and
 * establish a DXL connection.  string is the string used by dxl to start
 * the dx application, and the correct hostname and port number are appended
 * to this string as " -appPort 1234 -appHost hostname".  DXLStartDX
 * returns NULL and sets the error code on error.
 */
DXLConnection  *DXLStartDX(const char *string, const char *host);
void            DXLCloseConnection(DXLConnection *connection);
void            DXLSetSynchronization(DXLConnection *conn, const int onoff);

/*
 * This is used primarily for debugging to connect to a server (i.e. dxexec
 *  or dxui) that has already been started externally and is awaiting
 *  a connection.  This will cause a connection to be created between
 * the process at the given port on the given host.  If host is given
 * as NULL, then "localhost" is used.  port must be given as >= 0.
 * On error NULL is returned, otherwise a pointer to a DXLConnection
 * structure.
 */
DXLConnection *DXLConnectToRunningServer(int port, const char *host);

/*
 * This turns on/off message debugging. If message debugging is enabled,
 * then messages are printed on the terminal window as they are sent
 * and received.   The return value indicates the previous state of
 * message debugging. 
 */
int   	DXLSetMessageDebugging(DXLConnection *c, int on);

/*
 * Get the socket this is the used for communications.
 */
int DXLGetSocket(DXLConnection *conn);

/*
 * Determine if there are message that need to be handled.  If so, the
 * user should arrange to have DXLHandlePendingMessages() called.
 * Return 0 if no messages pending, non-zero otherwise.
 */
int DXLIsMessagePending(DXLConnection *conn);

/*
 * Parse a message that is waiting to be processed.  This results the
 * installed message handlers being called when appropriate  messages
 * are received.  This is called automatically if DXLInitializeXMainLoop()
 * is used.
 */
DXLError DXLHandlePendingMessages(DXLConnection *conn);
DXLError DXLWaitForEvent(DXLConnection *conn);

/*
 * Initialize the X11 window system so that calls to XtAppMainLoop() will
 * cause messages to be processed.
 */
#ifdef X_H
DXLError DXLInitializeXMainLoop(XtAppContext app, DXLConnection *conn);
DXLError DXLUninitializeXMainLoop(DXLConnection *conn);
#endif

/*
 * Install callback to be called back when the connection to DX is broken
 */
void
DXLSetBrokenConnectionCallback(DXLConnection *conn, void (*proc)(DXLConnection *, void *), void *data);

/*
 * Functions/typedefs for generic message handling 
 * See the DXLMessage module.
 */
typedef void (*DXLMessageHandler)(DXLConnection *conn,
                                        const char *msg, void *data);

/*
 * Message (packet) types
 */
enum DXLPacketType {
    PACK_INTERRUPT      = 1,
    PACK_MACRODEF       = 4,
    PACK_FOREGROUND     = 5,
    PACK_BACKGROUND     = 6,
    PACK_ERROR          = 7,
    PACK_MESSAGE        = 8,
    PACK_INFO           = 9,
    PACK_LINQUIRY       = 10,
    PACK_LRESPONSE      = 11,
    PACK_COMPLETE       = 19,
    PACK_LINK           = 22
};
typedef enum DXLPacketType DXLPacketTypeEnum;


/*
 * This routine sets the error handler, the routine called when an error
 * (usually a dxui generated error) occurs.
 * The default error handler prints the message and exits.
 */
DXLError DXLSetErrorHandler(DXLConnection *connection, DXLMessageHandler h,
                                   const void *data);

/*
 * Functions/typedefs for generic message handling
 * See the DXLMessage module.
 */
 
DXLError        DXLSetMessageHandler(DXLConnection *conn,
			DXLPacketTypeEnum type, const char *matchstr,
			DXLMessageHandler h, const void *data);
DXLError        DXLRemoveMessageHandler(DXLConnection *conn,
			DXLPacketTypeEnum type, const char *matchstr,
			DXLMessageHandler h);

/*
 * Functions/typedefs to receive values from the server.
 * See the DXLOutput module. 
 */
typedef void (*DXLValueHandler)(DXLConnection *conn, const char *name,
                                                const char *value, void *data);
DXLError DXLSetValueHandler(DXLConnection *c, const char *name,
                                        DXLValueHandler h, const void *data);
DXLError DXLRemoveValueHandler(DXLConnection *c, const char *name);

/*
 * Functions that are used to set values in the DX server's global dictionary.
 * See the DXLInput tool.
 */
DXLError        DXLSetValue(DXLConnection *conn,
                        const char *varname,
                        const char *value);
DXLError        DXLSetInteger(DXLConnection *conn,
                        const char *varname,
                        const int value);
DXLError        DXLSetScalar(DXLConnection *conn,
                        const char *varname,
                        const double value);
DXLError        DXLSetString(DXLConnection *conn,
                        const char *varname,
                        const char *value);

/*
 * These are higher level functions to control DX.
 */
DXLError        DXLLoadVisualProgram(DXLConnection *connection,
                        const char *file);

DXLError	DXLLoadMacroDirectory(DXLConnection *connection, const char *dir);

DXLError        exDXLLoadScript(DXLConnection *connection,
                        const char *file);
DXLError        exDXLBeginMacroDefinition(DXLConnection *connection,
                                          const char *mhdr);
DXLError        exDXLEndMacroDefinition(DXLConnection *connection);

/*
 * This is a function that can be used to send a message through dxl
 * and return a response to the message. It returns the length of the
 * respsonse if successfull, otherwise -1 and sets the error code (in errno).
 */
int             DXLQuery(DXLConnection *connection,
                         const char *msg, const int length, char *response);

#if !defined(DX_NATIVE_WINDOWS)
DXLError        uiDXLLoadConfig(DXLConnection *connection, const char *file);
DXLError        uiDXLSyncExecutive(DXLConnection *conn);
DXLError        uiDXLOpenVPE(DXLConnection *conn);
DXLError        uiDXLCloseVPE(DXLConnection *conn);
DXLError        uiDXLOpenSequencer(DXLConnection *conn);
DXLError        uiDXLCloseSequencer(DXLConnection *conn);
DXLError        uiDXLOpenAllImages(DXLConnection *conn);
DXLError        uiDXLCloseAllImages(DXLConnection *conn);

DXLError             uiDXLConnectToRunningServer(DXLConnection *connection,
                        const int port);
DXLError             uiDXLStartServer(DXLConnection *connection);
DXLError                uiDXLDisconnect(DXLConnection *conn);

/*
 * UI/Windowing system specific functions
 */
DXLError           uiDXLSaveVisualProgram(DXLConnection *connection,
			const char *file);
/* need save config */

DXLError           uiDXLOpenImageByLabel(DXLConnection *conn, char *label);
DXLError           uiDXLOpenImageByTitle(DXLConnection *conn, char *title);

DXLError           uiDXLCloseImageByLabel(DXLConnection *conn, char *label);
DXLError           uiDXLCloseImageByTitle(DXLConnection *conn, char *title);

DXLError           uiDXLOpenAllColorMapEditors(DXLConnection *conn);
DXLError           uiDXLOpenColorMapEditorByLabel(DXLConnection *conn, char *label);
DXLError           uiDXLOpenColorMapEditorByTitle(DXLConnection *conn, char *title);

DXLError           uiDXLCloseAllColorMapEditors(DXLConnection *conn);
DXLError           uiDXLCloseColorMapEditorByLabel(DXLConnection *conn, char *label);
DXLError           uiDXLCloseColorMapEditorByTitle(DXLConnection *conn, char *title);

/* this doesn't need to exist - we have close all, close by title
 *  and close by label.  what would a generic close do?
 */
#if 0 
/* DXLError           uiDXLCloseColorMapEditors(DXLConnection *conn); */
#endif

/*
 * Effectively "reset" the server when we are dxui-connected.  
 * The UI will stop execution, flush the cache and reload all the 
 * referenced variables.  
 */
DXLError uiDXLResetServer(DXLConnection *conn);

/*
 * This routine allows DXLink apps to switch between h/w & s/w rendering
 * when connected to the ui
 * hwrender == 0 : s/w else h/w rendering
 */
DXLError        uiDXLSetRenderMode(DXLConnection *conn, char *title, 
			int hwrender);

#endif /* !DX_NATIVE_WINDOWS */

/*
 * Initialize the Presentation manager window system so that...
 */
#ifdef OS2
DXLError DXLInitializePMMainLoop(/* HWND PMAppWindow, DXLConnection *conn */);
#endif


DXLError        DXLSync(DXLConnection *conn);


DXLError        DXLGetExecutionStatus(DXLConnection *conn, int *state);

DXLError        DXLExecuteOnce(DXLConnection *conn);
DXLError        DXLExecuteOnChange(DXLConnection *conn);

DXLError        exDXLExecuteOnceNamed(DXLConnection *conn, char *name);
DXLError        exDXLExecuteOnceNamedWithArgs(DXLConnection *conn, char *name, ...);
DXLError        exDXLExecuteOnceNamedWithArgsV(DXLConnection *conn, char *name, char **args);
DXLError        exDXLExecuteOnChangeNamed(DXLConnection *conn, char *name);
DXLError 	exDXLExecuteOnChangeNamedWithArgs(DXLConnection *conn, char *name, ...);
DXLError 	exDXLExecuteOnChangeNamedWithArgsV(DXLConnection *conn, char *name, char **args);

DXLError        DXLEndExecution(DXLConnection *conn);
DXLError        DXLEndExecuteOnChange(DXLConnection *conn);


typedef enum {
    SeqPlayForward,
    SeqPlayBackward,
    SeqPause,
    SeqStep,
    SeqStop,
    SeqPalindromeOn,
    SeqPalindromeOff,
    SeqLoopOn,
    SeqLoopOff
} DXLSequencerCtlEnum;
DXLError DXLSequencerCtl(DXLConnection *conn, DXLSequencerCtlEnum action);


DXLError        DXLExitDX(DXLConnection *conn);

/*
 * This is a function that can be used to send a mesage through dxl.
 * It returns OK if successfull, otherwise ERROR and sets the
 * error code (in errno).
 */
DXLError        DXLSend(DXLConnection *connection, const char *msg);



#if defined(__cplusplus) || defined(c_plusplus)
}
#endif

#endif