On 21 May 2012 11:08, Pauli Nieminen <span dir="ltr">&lt;<a href="mailto:pauli.nieminen@linux.intel.com" target="_blank">pauli.nieminen@linux.intel.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
piglit-dispatch-init.c needs some piglit util functions but it may not<br>
include piglit-dispatch.h to keep direct linking to egl and glX possible<br>
if we aren&#39;t using waffle.<br></blockquote><div><br>Can you go into more detail about what would go wrong if we had piglit-dispatch-init.c include piglit-dispatch.h?  I have been thinking of piglit-dispatch.h as the public interface to the piglit-dispatch mechanism, and since piglit-dispatch-init.c&#39;s role is to initialize the piglit-dispatch mechanism, it seems sensible for it to include piglit-dispatch.h directly rather than move a bunch of piglit-dispatch stuff into a file whose name doesn&#39;t sound related to piglit-dispatch.<br>
<br>If there&#39;s no way to avoid splitting out these files, maybe we could consider renaming piglit-util-core.h to something like piglit-dispatch-minimal.h or piglit-dispatch-core.h, to clarify that its purpose is to declare a core subset of the piglit-dispatch functionality, not a core subset of piglit-util functionality.<br>
 </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
The core header is minimum set of interfaces required by dispatch init.<br>
<br>
Signed-off-by: Pauli Nieminen &lt;<a href="mailto:pauli.nieminen@linux.intel.com">pauli.nieminen@linux.intel.com</a>&gt;<br>
---<br>
 tests/util/piglit-dispatch-init.c |    4 +-<br>
 tests/util/piglit-dispatch.h      |   49 +-------------------<br>
 tests/util/piglit-util-core.h     |   92 +++++++++++++++++++++++++++++++++++++<br>
 tests/util/piglit-util.h          |   33 +-------------<br>
 4 files changed, 98 insertions(+), 80 deletions(-)<br>
 create mode 100644 tests/util/piglit-util-core.h<br>
<br>
diff --git a/tests/util/piglit-dispatch-init.c b/tests/util/piglit-dispatch-init.c<br>
index 2a4bcf6..dbe9842 100644<br>
--- a/tests/util/piglit-dispatch-init.c<br>
+++ b/tests/util/piglit-dispatch-init.c<br>
@@ -22,7 +22,9 @@<br>
<br>
 #define _GNU_SOURCE<br>
 #include &lt;dlfcn.h&gt;<br>
-#include &quot;piglit-util.h&quot;<br>
+#include &quot;piglit-util-core.h&quot;<br>
+#include &lt;stdio.h&gt;<br>
+#include &lt;string.h&gt;<br>
<br>
 #if defined(_WIN32)<br>
<br>
diff --git a/tests/util/piglit-dispatch.h b/tests/util/piglit-dispatch.h<br>
index 002b8c0..adc01e4 100644<br>
--- a/tests/util/piglit-dispatch.h<br>
+++ b/tests/util/piglit-dispatch.h<br>
@@ -56,36 +56,12 @@<br>
 #include &lt;stdint.h&gt;<br>
 #include &lt;stddef.h&gt;<br>
<br>
+#include &quot;piglit-util-core.h&quot;<br>
+<br>
 #ifdef __cplusplus<br>
 extern &quot;C&quot; {<br>
 #endif<br>
<br>
-#ifndef _WIN32<br>
-<br>
-/* APIENTRY and GLAPIENTRY are not used on Linux or Mac. */<br>
-#ifndef APIENTRY<br>
-#define APIENTRY<br>
-#endif<br>
-#ifndef GLAPIENTRY<br>
-#define GLAPIENTRY<br>
-#endif<br>
-<br>
-#else<br>
-<br>
-#ifndef APIENTRY<br>
-#define APIENTRY __stdcall<br>
-#endif<br>
-<br>
-#ifndef GLAPIENTRY<br>
-#define GLAPIENTRY APIENTRY<br>
-#endif<br>
-<br>
-#ifndef GLAPI<br>
-#define GLAPI extern<br>
-#endif<br>
-<br>
-#endif<br>
-<br>
 typedef unsigned int GLenum;<br>
 typedef unsigned int GLbitfield;<br>
 typedef unsigned int GLuint;<br>
@@ -131,27 +107,6 @@ typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severit<br>
<br>
 typedef void (APIENTRY *piglit_dispatch_function_ptr)(void);<br>
<br>
-typedef piglit_dispatch_function_ptr (*piglit_get_core_proc_address_function_ptr)(const char *, int);<br>
-<br>
-typedef piglit_dispatch_function_ptr (*piglit_get_ext_proc_address_function_ptr)(const char *);<br>
-<br>
-typedef piglit_dispatch_function_ptr (*piglit_dispatch_resolver_ptr)();<br>
-<br>
-typedef void (*piglit_error_function_ptr)(const char *);<br>
-<br>
-typedef enum {<br>
-       PIGLIT_DISPATCH_GL,<br>
-       PIGLIT_DISPATCH_GL_FWD,<br>
-       PIGLIT_DISPATCH_ES1,<br>
-       PIGLIT_DISPATCH_ES2<br>
-} piglit_dispatch_api;<br>
-<br>
-void piglit_dispatch_init(piglit_dispatch_api api,<br>
-                         piglit_get_core_proc_address_function_ptr get_core_proc,<br>
-                         piglit_get_ext_proc_address_function_ptr get_ext_proc,<br>
-                         piglit_error_function_ptr unsupported_proc,<br>
-                         piglit_error_function_ptr failure_proc);<br>
-<br>
 piglit_dispatch_function_ptr<br>
 piglit_dispatch_resolve_function(const char *name);<br>
<br>
diff --git a/tests/util/piglit-util-core.h b/tests/util/piglit-util-core.h<br>
new file mode 100644<br>
index 0000000..46dd1c8<br>
--- /dev/null<br>
+++ b/tests/util/piglit-util-core.h<br>
@@ -0,0 +1,92 @@<br>
+<br>
+#pragma once<br>
+<br>
+#ifdef __cplusplus<br>
+extern &quot;C&quot; {<br>
+#endif<br>
+<br>
+#if defined(_WIN32)<br>
+#include &lt;windows.h&gt;<br>
+#endif<br>
+<br>
+#if defined(_MSC_VER)<br>
+typedef signed char int8_t;<br>
+typedef __int16 int16_t;<br>
+typedef __int32 int32_t;<br>
+typedef __int64 int64_t;<br>
+typedef unsigned __int8 uint8_t;<br>
+typedef unsigned __int16 uint16_t;<br>
+typedef unsigned __int32 uint32_t;<br>
+typedef unsigned __int64 uint64_t;<br>
+#ifndef __cplusplus<br>
+#define bool BOOL<br>
+#define true 1<br>
+#define false 0<br>
+#endif<br>
+#define log2(x) (log(x) / log(2))<br>
+#else<br>
+#include &lt;stdint.h&gt;<br>
+#include &lt;stdbool.h&gt;<br>
+#endif<br>
+<br>
+enum piglit_result {<br>
+       PIGLIT_PASS,<br>
+       PIGLIT_FAIL,<br>
+       PIGLIT_SKIP,<br>
+       PIGLIT_WARN<br>
+};<br>
+<br>
+void piglit_report_result(enum piglit_result result);<br>
+<br>
+#ifndef _WIN32<br>
+<br>
+/* APIENTRY and GLAPIENTRY are not used on Linux or Mac. */<br>
+#ifndef APIENTRY<br>
+#define APIENTRY<br>
+#endif<br>
+#ifndef GLAPIENTRY<br>
+#define GLAPIENTRY<br>
+#endif<br>
+<br>
+#else<br>
+<br>
+#ifndef APIENTRY<br>
+#define APIENTRY __stdcall<br>
+#endif<br>
+<br>
+#ifndef GLAPIENTRY<br>
+#define GLAPIENTRY APIENTRY<br>
+#endif<br>
+<br>
+#ifndef GLAPI<br>
+#define GLAPI extern<br>
+#endif<br>
+<br>
+#endif<br>
+<br>
+typedef enum {<br>
+       PIGLIT_DISPATCH_GL,<br>
+       PIGLIT_DISPATCH_GL_FWD,<br>
+       PIGLIT_DISPATCH_ES1,<br>
+       PIGLIT_DISPATCH_ES2<br>
+} piglit_dispatch_api;<br>
+<br>
+typedef void (APIENTRY *piglit_dispatch_function_ptr)(void);<br>
+<br>
+typedef piglit_dispatch_function_ptr (*piglit_get_core_proc_address_function_ptr)(const char *, int);<br>
+<br>
+typedef piglit_dispatch_function_ptr (*piglit_get_ext_proc_address_function_ptr)(const char *);<br>
+<br>
+typedef piglit_dispatch_function_ptr (*piglit_dispatch_resolver_ptr)();<br>
+<br>
+typedef void (*piglit_error_function_ptr)(const char *);<br>
+<br>
+void piglit_dispatch_init(piglit_dispatch_api api,<br>
+                         piglit_get_core_proc_address_function_ptr get_core_proc,<br>
+                         piglit_get_ext_proc_address_function_ptr get_ext_proc,<br>
+                         piglit_error_function_ptr unsupported_proc,<br>
+                         piglit_error_function_ptr failure_proc);<br>
+<br>
+#ifdef __cplusplus<br>
+}<br>
+#endif<br>
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h<br>
index 51c3220..6db440a 100755<br>
--- a/tests/util/piglit-util.h<br>
+++ b/tests/util/piglit-util.h<br>
@@ -30,30 +30,7 @@ extern &quot;C&quot; {<br>
 #endif<br>
<br>
 #include &quot;config.h&quot;<br>
-<br>
-#if defined(_WIN32)<br>
-#include &lt;windows.h&gt;<br>
-#endif<br>
-<br>
-#if defined(_MSC_VER)<br>
-typedef signed char int8_t;<br>
-typedef __int16 int16_t;<br>
-typedef __int32 int32_t;<br>
-typedef __int64 int64_t;<br>
-typedef unsigned __int8 uint8_t;<br>
-typedef unsigned __int16 uint16_t;<br>
-typedef unsigned __int32 uint32_t;<br>
-typedef unsigned __int64 uint64_t;<br>
-#ifndef __cplusplus<br>
-#define bool BOOL<br>
-#define true 1<br>
-#define false 0<br>
-#endif<br>
-#define log2(x) (log(x) / log(2))<br>
-#else<br>
-#include &lt;stdint.h&gt;<br>
-#include &lt;stdbool.h&gt;<br>
-#endif<br>
+#include &quot;piglit-util-core.h&quot;<br>
<br>
 #include &lt;assert.h&gt;<br>
 #include &lt;string.h&gt;<br>
@@ -108,13 +85,6 @@ int asprintf(char **strp, const char *fmt, ...)<br>
<br>
 #define piglit_get_proc_address(x) piglit_dispatch_resolve_function(x)<br>
<br>
-enum piglit_result {<br>
-       PIGLIT_PASS,<br>
-       PIGLIT_FAIL,<br>
-       PIGLIT_SKIP,<br>
-       PIGLIT_WARN<br>
-};<br>
-<br>
 #include &quot;piglit-framework.h&quot;<br>
 #include &quot;piglit-shader.h&quot;<br>
 #include &quot;piglit-transform-feedback.h&quot;<br>
@@ -203,7 +173,6 @@ void piglit_reset_gl_error(void);<br>
<br>
 int FindLine(const char *program, int position);<br>
 void piglit_merge_result(enum piglit_result *all, enum piglit_result subtest);<br>
-void piglit_report_result(enum piglit_result result);<br>
 void piglit_require_gl_version(int required_version_times_10);<br>
 void piglit_require_extension(const char *name);<br>
 void piglit_require_not_extension(const char *name);<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.5.4<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</font></span></blockquote></div><br>