Skip to content

Commit

Permalink
include county names
Browse files Browse the repository at this point in the history
git-svn-id: file:///home/svn/nwr/trunk@15 103c2249-d0a5-da11-ade6-0050bffea3d9
  • Loading branch information
greg committed Feb 19, 2003
1 parent 519c19c commit b363b1a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ streamer_SOURCES = streamer.cpp
splitter_SOURCES = splitter.cpp

monitor_SOURCES = monitor.cpp eas_demod.cpp eas_decode.cpp

eas_decode.cpp: fips.inc

fips.inc: ../emwin/data/county.dump fips2inc.pl
perl fips2inc.pl ../emwin/data/county.dump >$@
20 changes: 19 additions & 1 deletion eas_decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,27 @@ static string getEventDesc(const string &event)
return d->desc;
}

struct County {
int fips;
const char *name;
};
static const County Counties[] = {
#include "fips.inc"
};

static int fipscompare(const void *p1, const void *p2)
{
return ((County *)p2)->fips - *(int *)p1;
}

static string getAreaDesc(const eas::Message::Area &area)
{
return string();
int fips = 1000 * area.state + area.county;
County *c = (County *)bsearch(&fips, Counties, sizeof(Counties)/sizeof(Counties[0]), sizeof(Counties[0]), fipscompare);
if (c == NULL) {
return string();
}
return c->name;
}

static string getSenderDesc(const string &sender)
Expand Down

0 comments on commit b363b1a

Please sign in to comment.