Import Log and Options classes from glcompbench.
diff --git a/src/log.cpp b/src/log.cpp
new file mode 100644
index 0000000..3d2bb4f
--- /dev/null
+++ b/src/log.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright © 2011 Linaro Limited
+ *
+ * This file is part of glcompbench.
+ *
+ * glcompbench is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * glcompbench is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with glcompbench. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Alexandros Frantzis <alexandros.frantzis@linaro.org>
+ * Jesse Barker <jesse.barker@linaro.org>
+ */
+
+#include <cstdio>
+#include <cstdarg>
+
+#include "options.h"
+#include "log.h"
+
+void
+Log::info(const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ vfprintf(stdout, fmt, ap);
+ va_end(ap);
+}
+
+void
+Log::debug(const char *fmt, ...)
+{
+ if (!Options::show_debug)
+ return;
+ va_list ap;
+ va_start(ap, fmt);
+ vfprintf(stdout, fmt, ap);
+ va_end(ap);
+}
+
+void
+Log::error(const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+}
+
diff --git a/src/log.h b/src/log.h
new file mode 100644
index 0000000..4c24d41
--- /dev/null
+++ b/src/log.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2011 Linaro Limited
+ *
+ * This file is part of glcompbench.
+ *
+ * glcompbench is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * glcompbench is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with glcompbench. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Alexandros Frantzis <alexandros.frantzis@linaro.org>
+ * Jesse Barker <jesse.barker@linaro.org>
+ */
+
+#ifndef LOG_H_
+#define LOG_H_
+
+class Log
+{
+public:
+ static void info(const char *fmt, ...);
+ static void debug(const char *fmt, ...);
+ static void error(const char *fmt, ...);
+};
+
+#endif /* LOG_H_ */
diff --git a/src/options.cpp b/src/options.cpp
new file mode 100644
index 0000000..8b2db5c
--- /dev/null
+++ b/src/options.cpp
@@ -0,0 +1,70 @@
+/*
+ * Copyright © 2011 Linaro Limited
+ *
+ * This file is part of glcompbench.
+ *
+ * glcompbench is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * glcompbench is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with glcompbench. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Alexandros Frantzis <alexandros.frantzis@linaro.org>
+ * Jesse Barker <jesse.barker@linaro.org>
+ */
+
+#include <cstring>
+#include <cstdlib>
+#include <cstdio>
+#include <getopt.h>
+
+#include "options.h"
+
+bool Options::show_debug = false;
+bool Options::show_help = false;
+
+static struct option long_options[] = {
+ {"debug", 0, 0, 0},
+ {"help", 0, 0, 0},
+ {0, 0, 0, 0}
+};
+
+void
+Options::print_help()
+{
+ printf("A benchmark for Open GL (ES) 2.0\n"
+ "\n"
+ "Options:\n"
+ " --debug Display debug messages\n"
+ " --help Display help\n");
+}
+
+void
+Options::parse_args(int argc, char **argv)
+{
+ while (1) {
+ int option_index = 0;
+ int c;
+ const char *optname;
+
+ c = getopt_long(argc, argv, "",
+ long_options, &option_index);
+ if (c == -1)
+ break;
+
+ optname = long_options[option_index].name;
+
+ if (!strcmp(optname, "debug"))
+ Options::show_debug = true;
+ else if (!strcmp(optname, "help"))
+ Options::show_help = true;
+ }
+}
diff --git a/src/options.h b/src/options.h
new file mode 100644
index 0000000..73bea23
--- /dev/null
+++ b/src/options.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2011 Linaro Limited
+ *
+ * This file is part of glcompbench.
+ *
+ * glcompbench is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * glcompbench is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with glcompbench. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Alexandros Frantzis <alexandros.frantzis@linaro.org>
+ * Jesse Barker <jesse.barker@linaro.org>
+ */
+
+#ifndef OPTIONS_H_
+#define OPTIONS_H_
+
+struct Options {
+ static void parse_args(int argc, char **argv);
+ static void print_help();
+
+ static bool show_debug;
+ static bool show_help;
+};
+
+#endif /* OPTIONS_H_ */