| 15 |
|
int ifd; /* input file descriptor (for select) */ |
| 16 |
|
} odev; /* our open device */ |
| 17 |
|
|
| 18 |
< |
/* dev_input() return flags */ |
| 19 |
< |
#define DEV_SHUTDOWN 01 /* user shutdown request */ |
| 20 |
< |
#define DEV_NEWVIEW 02 /* view change (new view in odev.v) */ |
| 21 |
< |
#define DEV_NEWSIZE 04 /* device resolution change */ |
| 22 |
< |
#define DEV_WAIT 010 /* pause computation and wait for input */ |
| 23 |
< |
#define DEV_RESUME 020 /* resume after pause */ |
| 24 |
< |
#define DEV_REDRAW 040 /* redraw from server */ |
| 25 |
< |
#define DEV_PUTVIEW 0100 /* print out current view */ |
| 26 |
< |
#define DEV_LASTVIEW 0200 /* restore previous view */ |
| 18 |
> |
/* user commands */ |
| 19 |
> |
#define DC_SETVIEW 0 /* set the view */ |
| 20 |
> |
#define DC_GETVIEW 1 /* print the current view */ |
| 21 |
> |
#define DC_LASTVIEW 2 /* restore previous view */ |
| 22 |
> |
#define DC_PAUSE 3 /* pause the current calculation */ |
| 23 |
> |
#define DC_RESUME 4 /* resume the calculation */ |
| 24 |
> |
#define DC_REDRAW 5 /* redraw from server */ |
| 25 |
> |
#define DC_QUIT 6 /* quit the program */ |
| 26 |
|
|
| 27 |
+ |
#define DC_NCMDS 7 /* number of commands */ |
| 28 |
|
|
| 29 |
+ |
/* dev_input() returns flags from above */ |
| 30 |
+ |
#define DFL(dc) (1<<(dc)) |
| 31 |
+ |
|
| 32 |
+ |
#define CTRL(c) ((c)-'@') |
| 33 |
+ |
/* commands entered in display window */ |
| 34 |
+ |
#define DV_INIT {'\0','v','l','p','\r',CTRL('R'),'q'} |
| 35 |
+ |
/* commands entered on stdin */ |
| 36 |
+ |
#define DC_INIT {"VIEW=","where","last","pause","resume","redraw",\ |
| 37 |
+ |
"quit"} |
| 38 |
+ |
|
| 39 |
+ |
|
| 40 |
|
/************************************************************************ |
| 41 |
|
* Driver routines (all are required): |
| 42 |
|
|
| 83 |
|
|
| 84 |
|
Called when odev struct file descriptor shows input is ready. |
| 85 |
|
Returns flags indicating actions to take in the control process. |
| 86 |
< |
If the DEV_NEWVIEW or DEV_NEWSIZE flag is returned, the odev |
| 86 |
> |
If the DC_VIEW or DC_RESIZE flag is returned, the odev |
| 87 |
|
structure must be updated beforehand. |
| 88 |
|
|
| 89 |
|
|