Functions | |
| int | glencode_set_param (PARAM *p) |
| int | pvsystem (const char *command) |
| int | pvXYAllocate (PARAM *p, int n) |
| int | pvSetXY (PARAM *p, int i, float x, float y) |
| int | pvInitInternal (PARAM *p) |
| int | pvInit (int ac, char **av, PARAM *p) |
| int | pvAccept (PARAM *p) |
| int | pvCreateThread (PARAM *p, int s) |
| int | pvGetInitialMask (PARAM *p) |
| int | pvMain (PARAM *p) |
| int | pvSetCleanup (PARAM *p, int(*cleanup)(void *), void *app_data) |
| char * | pvGetEvent (PARAM *p) |
| int | pvPollEvent (PARAM *p, char *event) |
| int | pvWait (PARAM *p, const char *pattern) |
| int | pvGlUpdate (PARAM *p, int id) |
| int | pvSleep (int milliseconds) |
| int | pvWarning (PARAM *p, const char *text) |
| int | pvMainFatal (PARAM *p, const char *text) |
| int | pvThreadFatal (PARAM *p, const char *text) |
| int | pvScreenHint (PARAM *p, int w, int h) |
|
|
|
|
|
see pvInit |
|
||||||||||||
|
see pvInit |
|
|
If it is necessary to cleanup your application when the main worker thread terminates you can set an exit handler that receives the data in app_data. Call this function in pvMain. See also pvMain. |
|
|
Get the initial mask the user wants to see p->initial_mask is a string identifying the initial mask |
|
||||||||||||
|
update OpenGL widget |
|
||||||||||||||||
|
(Test) pvInit must be called in main(). It interprets the command line switches that it knows. Afterwards you can interpret your command line switches. It is possible to set p.user to data of your choice. This data will be available in the worker threads. (Caution: the worker threads are only allowed to read the p.user data because it is shared among all clients) Then there must be a while(1) in which new clients are accepted. For each client a new thread is created.
int main(int ac, char **av)
{
PARAM p;
int s;
pvInit(ac,av,&p);
here you may interpret ac,av and set p.user to your data
while(1)
{
s = pvAccept(&p);
if(s != -1) pvCreateThread(&p,s);
}
return 0;
}
|
|
|
see pvInit Init for script languages |
|
|
pvMain is your main worker thread. It could look as follows. The main worker thread is never closed. It will be closed automatically when the client disconnects.
int pvMain(PARAM *p) { int ret;
here you can initialize your worker thread
pvSetCleanup(p,your_exit_handler,your_app_data); // if cleanup is necessary
pvResize(p,0,970,600); // this will resize your working area
ret = showMask1(p);
while(1)
{
switch(ret)
{
case 1:
ret = showMask1(p);
break;
case 2:
ret = showMask2(p);
break;
case 3:
ret = showMask3(p);
break;
default:
return 0;
}
}
}
|
|
||||||||||||
|
Output a fatal message and terminate the whole server. |
|
||||||||||||
|
This function will return the next event as soon as it is available. The maximum wait time is p->sleep in milliseconds (default 100). You can specify a different wait time on the commandline (-sleep=1000)
Example:
int showMask1(PARAM *p)
{
DATA d;
char event[MAX_EVENT_LENGTH];
int i;
char text[MAX_EVENT_LENGTH];
defineMask1(p);
readData1(&d); // from shared memory or out of database
showData1(p,&d);
while(1)
{
pvPollEvent(p,event);
switch(pvParseEvent(event, &i, text))
{
case NULL_EVENT:
readData1(&d); // from shared memory or out of database
showData1(p,&d);
break;
case BUTTON_EVENT:
...
break;
case TEXT_EVENT:
...
break;
default:
printf("UNKNOWN_EVENT id=\%d \%s\\n",i,text);
break;
}
}
}
|
|
||||||||||||||||
|
Output a screenHint for calculating the zoom factor Optimal screen width=w height=h . |
|
||||||||||||||||
|
If it is necessary to cleanup your application when the main worker thread terminates you can set an exit handler that receives the data in app_data. Call this function in pvMain. See also pvMain. |
|
||||||||||||||||||||
|
Set x,y array for script language |
|
|
Sleep for milliseconds. |
|
|
Same as system(command); but portable |
|
||||||||||||
|
Output a fatal message and terminate the worker thread. |
|
||||||||||||
|
waits for an event. |
|
||||||||||||
|
Output a warning message. |
|
||||||||||||
|
Allocate x,y array for script language |
1.4.6