/* testcalendar.c
D. Swinehart, July 9, 1982 12:51 PM, Calendar test
L. Stewart, October 6, 1982 3:02 PM, names processes
L. Stewart, December 27, 1982 3:21 PM, flush nested declarations
L. Stewart, January 1, 1983 4:19 PM, flush AllocZero
L. Stewart, March 6, 1983 4:55 PM, flush Alloc
*/
#include <Env.h>
#include <Queue.h>
#include <pup.h>
#include <Lark.h>
extern GetAll();
extern GetFixed();
extern InitQueue();
extern InitNContext();
extern int localNet;
extern RequestRoute();
static struct Queue *ctxQ;
static int loopCtx;
static int loopSpace;
extern/*forward*/ Loop();
main()
{
char c;
int t[2];
ctxQ = GetFixed(2);
InitQueue(ctxQ);
InitPupLevel1(ctxQ, 12, defaultPupDataBytes);
loopSpace = GetFixed(300);
loopCtx = InitNContext("Loop", loopSpace, 300, &Loop);
Enqueue(ctxQ, loopCtx);
for (;;) {
CallContext(ctxQ->head);
if (chav()) {
c = getchar();
switch (c) {
case 'q': return; break;
case 't': ReadCalendar(t); Wf2("Time = (hi) %o, (lo) %o\r", t[1], t[0]); break;
default: putchar('.'); break;
};
};
};
};
static Loop()
{
int tmr;
int t[2];
RequestRoute(0); /* Initialize Routing tables */
settmr(2000, &tmr); while ((!tmrexp(&tmr)) && localNet == 0) Block();
InitCalendar(3); /* Get time of day set up */
for (;;) {
Block();
};
};