/* ================================================== */
+static void
+invoke_parameter_change_handlers(struct timeval *raw, struct timeval *cooked,
+ double dfreq, double doffset,
+ int is_step_change)
+{
+ ChangeListEntry *ptr;
+
+ for (ptr = change_list.next; ptr != &change_list; ptr = ptr->next) {
+ (ptr->handler)(raw, cooked, dfreq, doffset, is_step_change, ptr->anything);
+ }
+}
+
+/* ================================================== */
+
void
LCL_AddDispersionNotifyHandler(LCL_DispersionNotifyHandler handler, void *anything)
{
void
LCL_SetAbsoluteFrequency(double afreq_ppm)
{
- ChangeListEntry *ptr;
struct timeval raw, cooked;
double dfreq;
LCL_CookTime(&raw, &cooked, NULL);
/* Dispatch to all handlers */
- for (ptr = change_list.next; ptr != &change_list; ptr = ptr->next) {
- (ptr->handler)(&raw, &cooked, dfreq, 0.0, 0, ptr->anything);
- }
+ invoke_parameter_change_handlers(&raw, &cooked, dfreq, 0.0, 0);
current_freq_ppm = afreq_ppm;
void
LCL_AccumulateDeltaFrequency(double dfreq)
{
- ChangeListEntry *ptr;
struct timeval raw, cooked;
double old_freq_ppm;
LCL_CookTime(&raw, &cooked, NULL);
/* Dispatch to all handlers */
- for (ptr = change_list.next; ptr != &change_list; ptr = ptr->next) {
- (ptr->handler)(&raw, &cooked, dfreq, 0.0, 0, ptr->anything);
- }
-
+ invoke_parameter_change_handlers(&raw, &cooked, dfreq, 0.0, 0);
}
/* ================================================== */
void
LCL_AccumulateOffset(double offset, double corr_rate)
{
- ChangeListEntry *ptr;
struct timeval raw, cooked;
/* In this case, the cooked time to be passed to the notify clients
(*drv_accrue_offset)(offset, corr_rate);
/* Dispatch to all handlers */
- for (ptr = change_list.next; ptr != &change_list; ptr = ptr->next) {
- (ptr->handler)(&raw, &cooked, 0.0, offset, 0, ptr->anything);
- }
-
+ invoke_parameter_change_handlers(&raw, &cooked, 0.0, offset, 0);
}
/* ================================================== */
void
LCL_ApplyStepOffset(double offset)
{
- ChangeListEntry *ptr;
struct timeval raw, cooked;
/* In this case, the cooked time to be passed to the notify clients
(*drv_apply_step_offset)(offset);
/* Dispatch to all handlers */
- for (ptr = change_list.next; ptr != &change_list; ptr = ptr->next) {
- (ptr->handler)(&raw, &cooked, 0.0, offset, 1, ptr->anything);
- }
-
+ invoke_parameter_change_handlers(&raw, &cooked, 0.0, offset, 1);
}
/* ================================================== */
LCL_NotifyExternalTimeStep(struct timeval *raw, struct timeval *cooked,
double offset, double dispersion)
{
- ChangeListEntry *ptr;
-
/* Dispatch to all handlers */
- for (ptr = change_list.next; ptr != &change_list; ptr = ptr->next) {
- (ptr->handler)(raw, cooked, 0.0, offset, 1, ptr->anything);
- }
+ invoke_parameter_change_handlers(raw, cooked, 0.0, offset, 1);
lcl_InvokeDispersionNotifyHandlers(dispersion);
}