summaryrefslogtreecommitdiff
path: root/meme/meme.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2015-03-14 15:13:32 (GMT)
committerWerner Almesberger <werner@almesberger.net>2015-03-14 15:13:32 (GMT)
commit1b6ddad3bc38ee43bbed59d695acf538b7284feb (patch)
tree22aa08bad0f2ed6804e29a3a232cd0b47160ea2a /meme/meme.c
parent1f9086e6b4da68a49d00ab4a25624119b8a36d56 (diff)
downloadmisc-1b6ddad3bc38ee43bbed59d695acf538b7284feb.zip
misc-1b6ddad3bc38ee43bbed59d695acf538b7284feb.tar.gz
misc-1b6ddad3bc38ee43bbed59d695acf538b7284feb.tar.bz2
meme/: support multiple overlays
Diffstat (limited to 'meme/meme.c')
-rw-r--r--meme/meme.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/meme/meme.c b/meme/meme.c
index 5f41079..aab8736 100644
--- a/meme/meme.c
+++ b/meme/meme.c
@@ -23,6 +23,9 @@
#include "gui.h"
+#define N_OVERLAYS 3
+
+
static bool count_edge(const struct vertex *a, const struct vertex *b,
void *user)
{
@@ -51,7 +54,7 @@ static void slice_out(double x, double y, double z, bool last)
static void usage(const char *name)
{
fprintf(stderr,
-"usage: %s [-l logfile] [-o overlap.gp] [file.stl]\n"
+"usage: %s [-l logfile] [-o overlay.gp ...] [file.stl]\n"
" %s -s plane.gp [file.stl]\n",
name, name);
exit(1);
@@ -62,9 +65,9 @@ int main(int argc, char **argv)
{
int c;
const char *logfile = NULL;
- const char *overlay = NULL;
const char *slice = NULL;
- const struct overlay *over = NULL;
+ const struct overlay *overlays[N_OVERLAYS];
+ unsigned n_overlays = 0;
struct time t_load;
while ((c = getopt(argc, argv, "l:o:s:")) != EOF)
@@ -73,7 +76,12 @@ int main(int argc, char **argv)
logfile = optarg;
break;
case 'o':
- overlay = optarg;
+ if (n_overlays == N_OVERLAYS) {
+ fprintf(stderr, "too many overlays\n");
+ exit(1);
+ }
+ overlays[n_overlays] = overlay_load(optarg);
+ n_overlays++;
break;
case 's':
slice = optarg;
@@ -106,10 +114,7 @@ int main(int argc, char **argv)
exit(1);
}
- if (overlay)
- over = overlay_load(overlay);
-
- gui(logfile, over);
+ gui(logfile, overlays, n_overlays);
return 0;
}