diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-07-02 07:03:03 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-07-02 07:03:03 -0700 |
commit | f554c2d16cb5816b6b1a97b0349488bc70b512b0 (patch) | |
tree | 60811b1d64c2f37378ed20147f829cf74849d1dd /load-git.c | |
parent | 1d59b028c91ab7943cfece4a113948c61110dfc3 (diff) | |
parent | 0a0a6f07d5dbb2c24184d22c3c2cedf89ffdc7ac (diff) | |
download | subsurface-f554c2d16cb5816b6b1a97b0349488bc70b512b0.tar.gz |
Merge branch 'taxonomy'
Diffstat (limited to 'load-git.c')
-rw-r--r-- | load-git.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/load-git.c b/load-git.c index 0610cd0d8..7cfad325f 100644 --- a/load-git.c +++ b/load-git.c @@ -300,6 +300,22 @@ static void parse_site_gps(char *line, struct membuffer *str, void *_ds) ds->longitude = parse_degrees(line, &line); } +static void parse_site_geo(char *line, struct membuffer *str, void *_ds) +{ + fprintf(stderr, "line |%s| str |%s|\n", line, mb_cstring(str)); + struct dive_site *ds = _ds; + if (ds->taxonomy.category == NULL) + ds->taxonomy.category = alloc_taxonomy(); + int nr = ds->taxonomy.nr; + if (nr < NR_CATEGORIES) { + struct taxonomy *t = &ds->taxonomy.category[nr]; + t->value = strdup(mb_cstring(str)); + sscanf(line, "cat %d origin %d \"", &t->category, &t->origin); + fprintf(stderr, "found category %d origin %d value |%s|\n", t->category, t->origin, t->value); + ds->taxonomy.nr++; + } +} + /* Parse key=val parts of samples and cylinders etc */ static char *parse_keyvalue_entry(void (*fn)(void *, const char *, const char *), void *fndata, char *line) { @@ -906,7 +922,7 @@ static void dive_parser(char *line, struct membuffer *str, void *_dive) struct keyword_action site_action[] = { #undef D #define D(x) { #x, parse_site_ ## x } - D(description), D(gps), D(name), D(notes) + D(description), D(geo), D(gps), D(name), D(notes) }; static void site_parser(char *line, struct membuffer *str, void *_ds) |