X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fvfm.c;h=3d8f03ae56b97f27ef2c01fb1c8cbf0d1c195d6b;hb=1e06be73a426544652cdd7d73f001c962bac1a34;hp=7f2cb693301f06fc68894bf47b983a6d7efdcacb;hpb=ad01fea350354a7df11790a561e935a8bffd3636;p=pspp diff --git a/src/vfm.c b/src/vfm.c index 7f2cb69330..3d8f03ae56 100644 --- a/src/vfm.c +++ b/src/vfm.c @@ -80,7 +80,7 @@ struct case_sink *vfm_sink; static int compaction_necessary; /* Time at which vfm was last invoked. */ -time_t last_vfm_invocation; +static time_t last_vfm_invocation; /* Lag queue. */ int n_lag; /* Number of cases to lag. */ @@ -90,6 +90,7 @@ static struct ccase *lag_queue; /* Array of n_lag ccase * elements. */ static void internal_procedure (int (*proc_func) (struct ccase *, void *), void *aux); +static void update_last_vfm_invocation (void); static void create_trns_case (struct ccase *, struct dictionary *); static void open_active_file (void); static int write_case (struct write_case_data *wc_data); @@ -104,6 +105,15 @@ static void close_active_file (void); /* Public functions. */ +/* Returns the last time the data was read. */ +time_t +vfm_last_invocation (void) +{ + if (last_vfm_invocation == 0) + update_last_vfm_invocation (); + return last_vfm_invocation; +} + /* Reads the data from the input program and writes it to a new active file. For each case we read from the input program, we do the following @@ -136,6 +146,7 @@ procedure (int (*proc_func) (struct ccase *, void *), void *aux) && n_trns == 0) { /* Nothing to do. */ + update_last_vfm_invocation (); return; } @@ -162,7 +173,7 @@ internal_procedure (int (*proc_func) (struct ccase *, void *), void *aux) case_create (&wc_data.sink_case, dict_get_next_value_idx (default_dict)); wc_data.cases_written = 0; - last_vfm_invocation = time (NULL); + update_last_vfm_invocation (); if (vfm_source != NULL) vfm_source->class->read (vfm_source, @@ -175,6 +186,13 @@ internal_procedure (int (*proc_func) (struct ccase *, void *), void *aux) assert (--recursive_call == 0); } +/* Updates last_vfm_invocation. */ +static void +update_last_vfm_invocation (void) +{ + last_vfm_invocation = time (NULL); +} + /* Creates and returns a case, initializing it from the vectors that say which `value's need to be initialized just once, and which ones need to be re-initialized before every case. */