Move events and samples into a 'struct divecomputer'

For now we only have one fixed divecomputer associated with each dive,
so this doesn't really change any current semantics.  But it will make
it easier for us to associate a dive with multiple dive computers.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Linus Torvalds 2012-11-23 16:51:27 -10:00 committed by Dirk Hohndel
parent a9786564c2
commit 25b4fee655
9 changed files with 144 additions and 144 deletions

19
dive.h
View file

@ -237,6 +237,13 @@ struct event {
char name[];
};
struct divecomputer {
int samples, alloc_samples;
struct sample *sample;
struct event *events;
};
#define MAX_CYLINDERS (8)
#define MAX_WEIGHTSYSTEMS (4)
#define W_IDX_PRIMARY 0
@ -279,9 +286,9 @@ struct dive {
weightsystem_t weightsystem[MAX_WEIGHTSYSTEMS];
char *suit;
int sac, otu;
struct event *events;
int samples, alloc_samples;
struct sample *sample;
/* Eventually we'll do multiple dive computers */
struct divecomputer dc;
};
/* Pa = N/m^2 - so we determine the weight (in N) of the mass of 10m
@ -422,8 +429,8 @@ extern struct dive *alloc_dive(void);
extern void record_dive(struct dive *dive);
extern void delete_dive(struct dive *dive);
extern struct sample *prepare_sample(struct dive *dive);
extern void finish_sample(struct dive *dive);
extern struct sample *prepare_sample(struct divecomputer *dc);
extern void finish_sample(struct divecomputer *dc);
extern void report_dives(gboolean imported, gboolean prefer_imported);
extern struct dive *fixup_dive(struct dive *dive);
@ -432,7 +439,7 @@ extern struct dive *try_to_merge(struct dive *a, struct dive *b, gboolean prefer
extern void renumber_dives(int nr);
extern void add_event(struct dive *dive, int time, int type, int flags, int value, const char *name);
extern void add_event(struct divecomputer *dc, int time, int type, int flags, int value, const char *name);
/* UI related protopypes */