* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
static char sccsid
[] = "@(#)schedule.c 5.1 (Berkeley) %G%";
** An event of type 'type' is scheduled for time NOW + 'offset'
** into the first available slot. 'x', 'y', and 'z' are
** considered the attributes for this event.
** The address of the slot is returned.
struct event
*schedule(type
, offset
, x
, y
, z
)
register struct event
*e
;
date
= Now
.date
+ offset
;
for (i
= 0; i
< MAXEVENTS
; i
++)
printf("schedule: type %d @ %.2f slot %d parm %d %d %d\n",
syserr("Cannot schedule event %d parm %d %d %d", type
, x
, y
, z
);
** The event pointed to by 'e' is rescheduled to the current
register struct event
*e
;
date
= Now
.date
+ offset
;
printf("reschedule: type %d parm %d %d %d @ %.2f\n",
e
->evcode
, e
->x
, e
->y
, e
->systemname
, date
);
** The event at slot 'e' is deleted.
register struct event
*e
;
printf("unschedule: type %d @ %.2f parm %d %d %d\n",
e
->evcode
, e
->date
, e
->x
, e
->y
, e
->systemname
);
Now
.eventptr
[e
->evcode
& E_EVENT
] = 0;
** Abreviated schedule routine
** Parameters are the event index and a factor for the time
struct event
*xsched(ev1
, factor
, x
, y
, z
)
return (schedule(ev
, -Param
.eventdly
[ev
] * Param
.time
* log(franf()) / factor
, x
, y
, z
));
** Simplified reschedule routine
** Parameters are the event index, the initial date, and the
** division factor. Look at the code to see what really happens.
xresched(e1
, ev1
, factor
)
register struct event
*e
;
reschedule(e
, -Param
.eventdly
[ev
] * Param
.time
* log(franf()) / factor
);