commands Vector of procedure names. It must have the same number of entries as the vector luns.
Just_reg If present and nonzero, registers the unit numbers and callback procedures. Do not wait for any input. This is useful when this procedure is used with widgets.
luns (k) as its (only) argument. This procedure never returns; it just keeps handling callbacks when input is available.When used with the WAVE Widgets applications (i.e., when the Widget and Just_reg keywords are used), the callback procedures must have the following parameters:
top, data, nparams, id, lun, source
EX1
, with a different command line argument. The servers occasionally output a four-byte integer. This input is handled by the callback procedures SERVER1, SERVER2, SERVER3. The server is the following C program:
#include stdio.h #include string.h main(int argc, char *argv[])
{
int tag = atoi(argv[1]);
for (; ;) {
sleep(5);
write(1, &tag, sizeof(tag));
}
}
PRO SERVER1, lun
code = 0L
READU, lun, code
PRINT, 'SERVER1', code
END PRO SERVER2, lun
code = 0L
READU, lun, code
PRINT, 'SERVER2', code
END PRO SERVER3, lun
code = 0L
READU, lun, code
PRINT, 'SERVER3', code
END PRO EX1
SPAWN, 'EX1 1', Unit = lun1, /Sh
SPAWN, 'EX1 2', Unit = lun2, /Sh
SPAWN, 'EX1 3', Unit = lun3, /Sh
EXEC_ON_SELECT, [lun1, lun2, lun3], $ ['SERVER1', 'SERVER2', 'SERVER3']
END
PRO SERVER1, top, data, nparams, id, lun, $ source
code = 0L
READU, lun, code
PRINT, 'SERVER1', code, lun
END PRO SERVER2, top, data, nparams, id, lun, $ source
code = 0L
READU, lun, code
PRINT, 'SERVER2', code, lun
END PRO SERVER3, top, data, nparams, id, lun, source
code = 0L
READU, lun, code
PRINT, 'SERVER3', code, lun
END PRO MenuCB, wid, index
PRINT, 'Menu Item', index, ' selected.'
value = WwGetValue(wid)
PRINT, value
END PRO Ex2
SPAWN, 'EX1 1', unit = lun1, /sh
SPAWN, 'EX1 2', unit = lun2, /sh
SPAWN, 'EX1 3', unit = lun3, /sh
top = WwInit('ex2','Test',layout,/Vertical) button = WwButtonBox(layout, ['Fonts', $ 'Size','Icons'],'MenuCB') status = WwSetValue(top, /Display) EXEC_ON_SELECT, [lun1, lun2, lun3], $
['SERVER1','SERVER2','SERVER3'], /Widget, $ /Just_reg
WwLoop CLOSE, lun1, lun2, lun3 END