From ddd77c29412866e8567aeff1951e6e010b3676bf Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 1 Jul 2013 11:29:40 -0700 Subject: [PATCH] test: Rename handle-events.c to common.c Previously, this C file defined one function (handle_events). Recently, it acquired a second function (create_context). In order to provide a common namespace, these functions are here renamed to: common_handle_events and common_create_context so the filename is renamed to match. Similarly, the HANDLE_EVENTS_GL_PREFIX macro is also renamed to COMMON_GL_PREFIX. --- test/{handle-events.c => common.c} | 23 ++++++++++++----------- test/glx-dlopen-dlsym.c | 8 ++++---- test/glx-dlopen-gpa.c | 8 ++++---- test/glx-link-call.c | 8 ++++---- test/glx-link-gpa.c | 8 ++++---- test/glx-link-gpaa.c | 8 ++++---- 6 files changed, 32 insertions(+), 31 deletions(-) rename test/{handle-events.c => common.c} (87%) diff --git a/test/handle-events.c b/test/common.c similarity index 87% rename from test/handle-events.c rename to test/common.c index a28e1e6..01ce383 100644 --- a/test/handle-events.c +++ b/test/common.c @@ -22,28 +22,28 @@ /* This is C code intended to be included (yes, included) by test * programs in the fips test suite. * - * It defines a function: + * It defines two functions for use by the test: * * static void - * handle_events(Display *dpy, Window window); - * - * which handles X events, responding by drawing a few frames using - * OpenGL. + * common_create_context (Display *dpy, GLXContext *ctx, XVisualInfo **vi); + * and: + * static void + * common_handle_events (Display *dpy, Window window); * * Before including this file, the test program must define a macro - * HANDLE_EVENTS_GL_PREFIX to some prefix. This macro can be empty (to + * COMMON_GL_PREFIX to some prefix. This macro can be empty (to * directly call functions in an OpenGL-library directly linked) or * can be some custom prefix to call through symbols defined in the * test program. */ -#ifndef HANDLE_EVENTS_GL_PREFIX -#error Code including handle-events.c must define HANDLE_EVENTS_GL_PREFIX +#ifndef COMMON_GL_PREFIX +#error Code including common.c must define COMMON_GL_PREFIX #endif #define concat_(a,b) a ## b #define concat(a,b) concat_(a,b) -#define _(func) concat(HANDLE_EVENTS_GL_PREFIX, func) +#define _(func) concat(COMMON_GL_PREFIX, func) static void set_2d_projection (int width, int height) @@ -62,7 +62,8 @@ paint_rgb_using_clear (double r, double g, double b) } static void -create_context (Display *dpy, GLXContext *ctx_ret, XVisualInfo **visual_info_ret) +common_create_context (Display *dpy, + GLXContext *ctx_ret, XVisualInfo **visual_info_ret) { int visual_attr[] = { GLX_RGBA, @@ -118,7 +119,7 @@ draw (Display *dpy, GLXContext ctx, Window window, int width, int height) } static void -handle_events(Display *dpy, GLXContext ctx, Window window) +common_handle_events(Display *dpy, GLXContext ctx, Window window) { XEvent xev; int width = 0; diff --git a/test/glx-dlopen-dlsym.c b/test/glx-dlopen-dlsym.c index a967798..7674915 100644 --- a/test/glx-dlopen-dlsym.c +++ b/test/glx-dlopen-dlsym.c @@ -48,8 +48,8 @@ void (*my_glXDestroyContext) (Display *, GLXContext); Bool (*my_glXMakeCurrent) (Display *, GLXDrawable, GLXContext); void (*my_glXSwapBuffers) (Display *, GLXDrawable); -#define HANDLE_EVENTS_GL_PREFIX my_ -#include "handle-events.c" +#define COMMON_GL_PREFIX my_ +#include "common.c" static void resolve_symbols (void) @@ -156,11 +156,11 @@ main (void) dpy = util_x11_init_display (); - create_context (dpy, &ctx, &visual_info); + common_create_context (dpy, &ctx, &visual_info); window = util_x11_init_window (dpy, visual_info); - handle_events (dpy, ctx, window); + common_handle_events (dpy, ctx, window); util_x11_fini_window (dpy, window); diff --git a/test/glx-dlopen-gpa.c b/test/glx-dlopen-gpa.c index 4971794..b9d1b1a 100644 --- a/test/glx-dlopen-gpa.c +++ b/test/glx-dlopen-gpa.c @@ -49,8 +49,8 @@ void (*my_glXDestroyContext) (Display *, GLXContext); Bool (*my_glXMakeCurrent) (Display *, GLXDrawable, GLXContext); void (*my_glXSwapBuffers) (Display *, GLXDrawable); -#define HANDLE_EVENTS_GL_PREFIX my_ -#include "handle-events.c" +#define COMMON_GL_PREFIX my_ +#include "common.c" static void resolve_symbols (void) @@ -153,11 +153,11 @@ main (void) dpy = util_x11_init_display (); - create_context (dpy, &ctx, &visual_info); + common_create_context (dpy, &ctx, &visual_info); window = util_x11_init_window (dpy, visual_info); - handle_events (dpy, ctx, window); + common_handle_events (dpy, ctx, window); util_x11_fini_window (dpy, window); diff --git a/test/glx-link-call.c b/test/glx-link-call.c index 46cb563..4684111 100644 --- a/test/glx-link-call.c +++ b/test/glx-link-call.c @@ -32,8 +32,8 @@ #include "util-x11.h" -#define HANDLE_EVENTS_GL_PREFIX -#include "handle-events.c" +#define COMMON_GL_PREFIX +#include "common.c" int main (void) @@ -45,11 +45,11 @@ main (void) dpy = util_x11_init_display (); - create_context (dpy, &ctx, &visual_info); + common_create_context (dpy, &ctx, &visual_info); window = util_x11_init_window (dpy, visual_info); - handle_events (dpy, ctx, window); + common_handle_events (dpy, ctx, window); util_x11_fini_window (dpy, window); diff --git a/test/glx-link-gpa.c b/test/glx-link-gpa.c index 8db8009..840a648 100644 --- a/test/glx-link-gpa.c +++ b/test/glx-link-gpa.c @@ -72,8 +72,8 @@ FIPS_GLXMAKECURRENT_FN my_glXMakeCurrent; typedef void (*FIPS_GLXSWAPBUFFERS_FN)(Display *, GLXDrawable); FIPS_GLXSWAPBUFFERS_FN my_glXSwapBuffers; -#define HANDLE_EVENTS_GL_PREFIX my_ -#include "handle-events.c" +#define COMMON_GL_PREFIX my_ +#include "common.c" static void resolve_symbols (void) @@ -157,11 +157,11 @@ main (void) dpy = util_x11_init_display (); - create_context (dpy, &ctx, &visual_info); + common_create_context (dpy, &ctx, &visual_info); window = util_x11_init_window (dpy, visual_info); - handle_events (dpy, ctx, window); + common_handle_events (dpy, ctx, window); util_x11_fini_window (dpy, window); diff --git a/test/glx-link-gpaa.c b/test/glx-link-gpaa.c index 682ee93..d25d295 100644 --- a/test/glx-link-gpaa.c +++ b/test/glx-link-gpaa.c @@ -72,8 +72,8 @@ FIPS_GLXMAKECURRENT_FN my_glXMakeCurrent; typedef void (*FIPS_GLXSWAPBUFFERS_FN)(Display *, GLXDrawable); FIPS_GLXSWAPBUFFERS_FN my_glXSwapBuffers; -#define HANDLE_EVENTS_GL_PREFIX my_ -#include "handle-events.c" +#define COMMON_GL_PREFIX my_ +#include "common.c" static void resolve_symbols (void) @@ -157,11 +157,11 @@ main (void) dpy = util_x11_init_display (); - create_context (dpy, &ctx, &visual_info); + common_create_context (dpy, &ctx, &visual_info); window = util_x11_init_window (dpy, visual_info); - handle_events (dpy, ctx, window); + common_handle_events (dpy, ctx, window); util_x11_fini_window (dpy, window); -- 2.43.0