summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Versace <chad.versace@linux.intel.com>2012-04-08 12:29:46 -0700
committerChad Versace <chad.versace@linux.intel.com>2012-04-08 12:37:35 -0700
commitc63562eed8be690193991d034be5d7ade61104eb (patch)
treee2f146ff5f34664183d5a841e8792d22f8cff8a8
parenta29571d73a9aae7c634934379eab62dfe2eb6e56 (diff)
api: Implement waffle_enum_to_string()
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
-rw-r--r--src/waffle/CMakeLists.txt1
-rw-r--r--src/waffle/api/waffle_enum.c45
2 files changed, 46 insertions, 0 deletions
diff --git a/src/waffle/CMakeLists.txt b/src/waffle/CMakeLists.txt
index 267256e..1b769de 100644
--- a/src/waffle/CMakeLists.txt
+++ b/src/waffle/CMakeLists.txt
@@ -8,6 +8,7 @@ set(waffle_sources
api/waffle_config.c
api/waffle_context.c
api/waffle_display.c
+ api/waffle_enum.c
api/waffle_error.c
api/waffle_gl_misc.c
api/waffle_init.c
diff --git a/src/waffle/api/waffle_enum.c b/src/waffle/api/waffle_enum.c
new file mode 100644
index 0000000..745f383
--- /dev/null
+++ b/src/waffle/api/waffle_enum.c
@@ -0,0 +1,45 @@
+// Copyright 2012 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include <waffle/waffle_enum.h>
+
+const char*
+waffle_enum_to_string(int32_t e)
+{
+ switch (e) {
+#define CASE(x) case x: return #x
+ CASE(WAFFLE_LIST_END);
+ CASE(WAFFLE_PLATFORM);
+ CASE(WAFFLE_PLATFORM_ANDROID);
+ CASE(WAFFLE_PLATFORM_COCOA);
+ CASE(WAFFLE_PLATFORM_GLX);
+ CASE(WAFFLE_PLATFORM_WAYLAND);
+ CASE(WAFFLE_PLATFORM_X11_EGL);
+ CASE(WAFFLE_OPENGL_API);
+ CASE(WAFFLE_OPENGL);
+ CASE(WAFFLE_OPENGL_ES1);
+ CASE(WAFFLE_OPENGL_ES2);
+ CASE(WAFFLE_RED_SIZE);
+ CASE(WAFFLE_GREEN_SIZE);
+ CASE(WAFFLE_BLUE_SIZE);
+ CASE(WAFFLE_ALPHA_SIZE);
+ CASE(WAFFLE_DEPTH_SIZE);
+ CASE(WAFFLE_STENCIL_SIZE);
+ CASE(WAFFLE_SAMPLE_BUFFERS);
+ CASE(WAFFLE_SAMPLES);
+ CASE(WAFFLE_DOUBLE_BUFFERED);
+ default: return 0;
+#undef CASE
+ }
+}