Switched the test code over to use the common functions in the test library.
authorSam Lantinga <slouken@libsdl.org>
Mon, 31 Dec 2012 10:26:38 -0800
changeset 6785c094c438c0a6
parent 6784 8fd20f04d5d9
child 6786 7174fb08017a
Switched the test code over to use the common functions in the test library.
test/Makefile.in
test/common.c
test/common.h
test/configure
test/configure.in
test/testdraw2.c
test/testgl2.c
test/testgles.c
test/testime.c
test/testintersections.c
test/testrelative.c
test/testrendercopyex.c
test/testrendertarget.c
test/testscale.c
test/testsprite2.c
test/testwm2.c
     1.1 --- a/test/Makefile.in	Mon Dec 31 10:14:38 2012 -0800
     1.2 +++ b/test/Makefile.in	Mon Dec 31 10:26:38 2012 -0800
     1.3 @@ -84,13 +84,13 @@
     1.4  testatomic$(EXE): $(srcdir)/testatomic.c
     1.5  	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
     1.6  
     1.7 -testintersections$(EXE): $(srcdir)/testintersections.c $(srcdir)/common.c
     1.8 +testintersections$(EXE): $(srcdir)/testintersections.c
     1.9  	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
    1.10  
    1.11 -testrelative$(EXE): $(srcdir)/testrelative.c $(srcdir)/common.c
    1.12 +testrelative$(EXE): $(srcdir)/testrelative.c
    1.13  	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
    1.14  
    1.15 -testdraw2$(EXE): $(srcdir)/testdraw2.c $(srcdir)/common.c
    1.16 +testdraw2$(EXE): $(srcdir)/testdraw2.c
    1.17  	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
    1.18  
    1.19  testerror$(EXE): $(srcdir)/testerror.c
    1.20 @@ -105,10 +105,10 @@
    1.21  testgesture$(EXE): $(srcdir)/testgesture.c
    1.22  	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@
    1.23   
    1.24 -testgl2$(EXE): $(srcdir)/testgl2.c $(srcdir)/common.c
    1.25 +testgl2$(EXE): $(srcdir)/testgl2.c
    1.26  	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @GLLIB@ @MATHLIB@
    1.27  
    1.28 -testgles$(EXE): $(srcdir)/testgles.c $(srcdir)/common.c
    1.29 +testgles$(EXE): $(srcdir)/testgles.c
    1.30  	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @GLLIB@ @MATHLIB@
    1.31  
    1.32  testhaptic$(EXE): $(srcdir)/testhaptic.c
    1.33 @@ -123,10 +123,10 @@
    1.34  testiconv$(EXE): $(srcdir)/testiconv.c
    1.35  	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
    1.36  
    1.37 -testime$(EXE): $(srcdir)/testime.c $(srcdir)/common.c
    1.38 +testime$(EXE): $(srcdir)/testime.c
    1.39  	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @SDL_TTF_LIB@
    1.40  
    1.41 -testjoystick$(EXE): $(srcdir)/testjoystick.c $(srcdir)/common.c
    1.42 +testjoystick$(EXE): $(srcdir)/testjoystick.c
    1.43  	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
    1.44  
    1.45  testkeys$(EXE): $(srcdir)/testkeys.c
    1.46 @@ -167,10 +167,10 @@
    1.47  testpower$(EXE): $(srcdir)/testpower.c
    1.48  	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
    1.49  
    1.50 -testrendertarget$(EXE): $(srcdir)/testrendertarget.c $(srcdir)/common.c
    1.51 +testrendertarget$(EXE): $(srcdir)/testrendertarget.c
    1.52  	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
    1.53  
    1.54 -testscale$(EXE): $(srcdir)/testscale.c $(srcdir)/common.c
    1.55 +testscale$(EXE): $(srcdir)/testscale.c
    1.56  	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
    1.57  
    1.58  testsem$(EXE): $(srcdir)/testsem.c
    1.59 @@ -182,8 +182,8 @@
    1.60  testshape$(EXE): $(srcdir)/testshape.c
    1.61  	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
    1.62  
    1.63 -testsprite2$(EXE): $(srcdir)/testsprite2.c $(srcdir)/common.c
    1.64 -	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@
    1.65 +testsprite2$(EXE): $(srcdir)/testsprite2.c
    1.66 +	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
    1.67  
    1.68  testspriteminimal$(EXE): $(srcdir)/testspriteminimal.c
    1.69  	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@
    1.70 @@ -197,13 +197,13 @@
    1.71  testver$(EXE): $(srcdir)/testver.c
    1.72  	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
    1.73  
    1.74 -testwm2$(EXE): $(srcdir)/testwm2.c $(srcdir)/common.c
    1.75 +testwm2$(EXE): $(srcdir)/testwm2.c
    1.76  	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
    1.77  
    1.78  torturethread$(EXE): $(srcdir)/torturethread.c
    1.79  	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
    1.80  
    1.81 -testrendercopyex$(EXE): $(srcdir)/testrendercopyex.c $(srcdir)/common.c
    1.82 +testrendercopyex$(EXE): $(srcdir)/testrendercopyex.c
    1.83  	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@
    1.84  
    1.85  testmessage$(EXE): $(srcdir)/testmessage.c
     2.1 --- a/test/common.c	Mon Dec 31 10:14:38 2012 -0800
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,1256 +0,0 @@
     2.4 -/*
     2.5 -  Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
     2.6 -
     2.7 -  This software is provided 'as-is', without any express or implied
     2.8 -  warranty.  In no event will the authors be held liable for any damages
     2.9 -  arising from the use of this software.
    2.10 -
    2.11 -  Permission is granted to anyone to use this software for any purpose,
    2.12 -  including commercial applications, and to alter it and redistribute it
    2.13 -  freely.
    2.14 -*/
    2.15 -
    2.16 -/* A simple test program framework */
    2.17 -
    2.18 -#include <stdio.h>
    2.19 -
    2.20 -#include "common.h"
    2.21 -
    2.22 -#define VIDEO_USAGE \
    2.23 -"[--video driver] [--renderer driver] [--info all|video|modes|render|event] [--log all|error|system|audio|video|render|input] [--display N] [--fullscreen | --windows N] [--title title] [--icon icon.bmp] [--center | --position X,Y] [--geometry WxH] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab]"
    2.24 -
    2.25 -#define AUDIO_USAGE \
    2.26 -"[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]"
    2.27 -
    2.28 -CommonState *
    2.29 -CommonCreateState(char **argv, Uint32 flags)
    2.30 -{
    2.31 -    CommonState *state = SDL_calloc(1, sizeof(*state));
    2.32 -    if (!state) {
    2.33 -        SDL_OutOfMemory();
    2.34 -        return NULL;
    2.35 -    }
    2.36 -
    2.37 -    /* Initialize some defaults */
    2.38 -    state->argv = argv;
    2.39 -    state->flags = flags;
    2.40 -#ifdef __NDS__
    2.41 -    state->window_title = "";
    2.42 -#else
    2.43 -    state->window_title = argv[0];
    2.44 -#endif
    2.45 -    state->window_flags = 0;
    2.46 -    state->window_x = SDL_WINDOWPOS_UNDEFINED;
    2.47 -    state->window_y = SDL_WINDOWPOS_UNDEFINED;
    2.48 -    state->window_w = DEFAULT_WINDOW_WIDTH;
    2.49 -    state->window_h = DEFAULT_WINDOW_HEIGHT;
    2.50 -    state->num_windows = 1;
    2.51 -    state->audiospec.freq = 22050;
    2.52 -    state->audiospec.format = AUDIO_S16;
    2.53 -    state->audiospec.channels = 2;
    2.54 -    state->audiospec.samples = 2048;
    2.55 -
    2.56 -    /* Set some very sane GL defaults */
    2.57 -    state->gl_red_size = 3;
    2.58 -    state->gl_green_size = 3;
    2.59 -    state->gl_blue_size = 2;
    2.60 -    state->gl_alpha_size = 0;
    2.61 -    state->gl_buffer_size = 0;
    2.62 -    state->gl_depth_size = 16;
    2.63 -    state->gl_stencil_size = 0;
    2.64 -    state->gl_double_buffer = 1;
    2.65 -    state->gl_accum_red_size = 0;
    2.66 -    state->gl_accum_green_size = 0;
    2.67 -    state->gl_accum_blue_size = 0;
    2.68 -    state->gl_accum_alpha_size = 0;
    2.69 -    state->gl_stereo = 0;
    2.70 -    state->gl_multisamplebuffers = 0;
    2.71 -    state->gl_multisamplesamples = 0;
    2.72 -    state->gl_retained_backing = 1;
    2.73 -    state->gl_accelerated = -1;
    2.74 -
    2.75 -    return state;
    2.76 -}
    2.77 -
    2.78 -int
    2.79 -CommonArg(CommonState * state, int index)
    2.80 -{
    2.81 -    char **argv = state->argv;
    2.82 -
    2.83 -#ifdef __NDS__
    2.84 -    return 0;
    2.85 -#endif
    2.86 -
    2.87 -    if (SDL_strcasecmp(argv[index], "--video") == 0) {
    2.88 -        ++index;
    2.89 -        if (!argv[index]) {
    2.90 -            return -1;
    2.91 -        }
    2.92 -        state->videodriver = argv[index];
    2.93 -        return 2;
    2.94 -    }
    2.95 -    if (SDL_strcasecmp(argv[index], "--renderer") == 0) {
    2.96 -        ++index;
    2.97 -        if (!argv[index]) {
    2.98 -            return -1;
    2.99 -        }
   2.100 -        state->renderdriver = argv[index];
   2.101 -        return 2;
   2.102 -    }
   2.103 -    if (SDL_strcasecmp(argv[index], "--info") == 0) {
   2.104 -        ++index;
   2.105 -        if (!argv[index]) {
   2.106 -            return -1;
   2.107 -        }
   2.108 -        if (SDL_strcasecmp(argv[index], "all") == 0) {
   2.109 -            state->verbose |=
   2.110 -                (VERBOSE_VIDEO | VERBOSE_MODES | VERBOSE_RENDER |
   2.111 -                 VERBOSE_EVENT);
   2.112 -            return 2;
   2.113 -        }
   2.114 -        if (SDL_strcasecmp(argv[index], "video") == 0) {
   2.115 -            state->verbose |= VERBOSE_VIDEO;
   2.116 -            return 2;
   2.117 -        }
   2.118 -        if (SDL_strcasecmp(argv[index], "modes") == 0) {
   2.119 -            state->verbose |= VERBOSE_MODES;
   2.120 -            return 2;
   2.121 -        }
   2.122 -        if (SDL_strcasecmp(argv[index], "render") == 0) {
   2.123 -            state->verbose |= VERBOSE_RENDER;
   2.124 -            return 2;
   2.125 -        }
   2.126 -        if (SDL_strcasecmp(argv[index], "event") == 0) {
   2.127 -            state->verbose |= VERBOSE_EVENT;
   2.128 -            return 2;
   2.129 -        }
   2.130 -        return -1;
   2.131 -    }
   2.132 -    if (SDL_strcasecmp(argv[index], "--log") == 0) {
   2.133 -        ++index;
   2.134 -        if (!argv[index]) {
   2.135 -            return -1;
   2.136 -        }
   2.137 -        if (SDL_strcasecmp(argv[index], "all") == 0) {
   2.138 -            SDL_LogSetAllPriority(SDL_LOG_PRIORITY_VERBOSE);
   2.139 -            return 2;
   2.140 -        }
   2.141 -        if (SDL_strcasecmp(argv[index], "error") == 0) {
   2.142 -            SDL_LogSetPriority(SDL_LOG_CATEGORY_ERROR, SDL_LOG_PRIORITY_VERBOSE);
   2.143 -            return 2;
   2.144 -        }
   2.145 -        if (SDL_strcasecmp(argv[index], "system") == 0) {
   2.146 -            SDL_LogSetPriority(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_VERBOSE);
   2.147 -            return 2;
   2.148 -        }
   2.149 -        if (SDL_strcasecmp(argv[index], "audio") == 0) {
   2.150 -            SDL_LogSetPriority(SDL_LOG_CATEGORY_AUDIO, SDL_LOG_PRIORITY_VERBOSE);
   2.151 -            return 2;
   2.152 -        }
   2.153 -        if (SDL_strcasecmp(argv[index], "video") == 0) {
   2.154 -            SDL_LogSetPriority(SDL_LOG_CATEGORY_VIDEO, SDL_LOG_PRIORITY_VERBOSE);
   2.155 -            return 2;
   2.156 -        }
   2.157 -        if (SDL_strcasecmp(argv[index], "render") == 0) {
   2.158 -            SDL_LogSetPriority(SDL_LOG_CATEGORY_RENDER, SDL_LOG_PRIORITY_VERBOSE);
   2.159 -            return 2;
   2.160 -        }
   2.161 -        if (SDL_strcasecmp(argv[index], "input") == 0) {
   2.162 -            SDL_LogSetPriority(SDL_LOG_CATEGORY_INPUT, SDL_LOG_PRIORITY_VERBOSE);
   2.163 -            return 2;
   2.164 -        }
   2.165 -        return -1;
   2.166 -    }
   2.167 -    if (SDL_strcasecmp(argv[index], "--display") == 0) {
   2.168 -        ++index;
   2.169 -        if (!argv[index]) {
   2.170 -            return -1;
   2.171 -        }
   2.172 -        state->display = SDL_atoi(argv[index]);
   2.173 -        if (SDL_WINDOWPOS_ISUNDEFINED(state->window_x)) {
   2.174 -            state->window_x = SDL_WINDOWPOS_UNDEFINED_DISPLAY(state->display);
   2.175 -            state->window_y = SDL_WINDOWPOS_UNDEFINED_DISPLAY(state->display);
   2.176 -        }
   2.177 -        if (SDL_WINDOWPOS_ISCENTERED(state->window_x)) {
   2.178 -            state->window_x = SDL_WINDOWPOS_CENTERED_DISPLAY(state->display);
   2.179 -            state->window_y = SDL_WINDOWPOS_CENTERED_DISPLAY(state->display);
   2.180 -        }
   2.181 -        return 2;
   2.182 -    }
   2.183 -    if (SDL_strcasecmp(argv[index], "--fullscreen") == 0) {
   2.184 -        state->window_flags |= SDL_WINDOW_FULLSCREEN;
   2.185 -        state->num_windows = 1;
   2.186 -        return 1;
   2.187 -    }
   2.188 -    if (SDL_strcasecmp(argv[index], "--fullscreen-desktop") == 0) {
   2.189 -        state->window_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
   2.190 -        state->num_windows = 1;
   2.191 -        return 1;
   2.192 -    }
   2.193 -    if (SDL_strcasecmp(argv[index], "--windows") == 0) {
   2.194 -        ++index;
   2.195 -        if (!argv[index] || !SDL_isdigit(*argv[index])) {
   2.196 -            return -1;
   2.197 -        }
   2.198 -        if (!(state->window_flags & SDL_WINDOW_FULLSCREEN)) {
   2.199 -            state->num_windows = SDL_atoi(argv[index]);
   2.200 -        }
   2.201 -        return 2;
   2.202 -    }
   2.203 -    if (SDL_strcasecmp(argv[index], "--title") == 0) {
   2.204 -        ++index;
   2.205 -        if (!argv[index]) {
   2.206 -            return -1;
   2.207 -        }
   2.208 -        state->window_title = argv[index];
   2.209 -        return 2;
   2.210 -    }
   2.211 -    if (SDL_strcasecmp(argv[index], "--icon") == 0) {
   2.212 -        ++index;
   2.213 -        if (!argv[index]) {
   2.214 -            return -1;
   2.215 -        }
   2.216 -        state->window_icon = argv[index];
   2.217 -        return 2;
   2.218 -    }
   2.219 -    if (SDL_strcasecmp(argv[index], "--center") == 0) {
   2.220 -        state->window_x = SDL_WINDOWPOS_CENTERED;
   2.221 -        state->window_y = SDL_WINDOWPOS_CENTERED;
   2.222 -        return 1;
   2.223 -    }
   2.224 -    if (SDL_strcasecmp(argv[index], "--position") == 0) {
   2.225 -        char *x, *y;
   2.226 -        ++index;
   2.227 -        if (!argv[index]) {
   2.228 -            return -1;
   2.229 -        }
   2.230 -        x = argv[index];
   2.231 -        y = argv[index];
   2.232 -        while (*y && *y != ',') {
   2.233 -            ++y;
   2.234 -        }
   2.235 -        if (!*y) {
   2.236 -            return -1;
   2.237 -        }
   2.238 -        *y++ = '\0';
   2.239 -        state->window_x = SDL_atoi(x);
   2.240 -        state->window_y = SDL_atoi(y);
   2.241 -        return 2;
   2.242 -    }
   2.243 -    if (SDL_strcasecmp(argv[index], "--geometry") == 0) {
   2.244 -        char *w, *h;
   2.245 -        ++index;
   2.246 -        if (!argv[index]) {
   2.247 -            return -1;
   2.248 -        }
   2.249 -        w = argv[index];
   2.250 -        h = argv[index];
   2.251 -        while (*h && *h != 'x') {
   2.252 -            ++h;
   2.253 -        }
   2.254 -        if (!*h) {
   2.255 -            return -1;
   2.256 -        }
   2.257 -        *h++ = '\0';
   2.258 -        state->window_w = SDL_atoi(w);
   2.259 -        state->window_h = SDL_atoi(h);
   2.260 -        return 2;
   2.261 -    }
   2.262 -    if (SDL_strcasecmp(argv[index], "--depth") == 0) {
   2.263 -        ++index;
   2.264 -        if (!argv[index]) {
   2.265 -            return -1;
   2.266 -        }
   2.267 -        state->depth = SDL_atoi(argv[index]);
   2.268 -        return 2;
   2.269 -    }
   2.270 -    if (SDL_strcasecmp(argv[index], "--refresh") == 0) {
   2.271 -        ++index;
   2.272 -        if (!argv[index]) {
   2.273 -            return -1;
   2.274 -        }
   2.275 -        state->refresh_rate = SDL_atoi(argv[index]);
   2.276 -        return 2;
   2.277 -    }
   2.278 -    if (SDL_strcasecmp(argv[index], "--vsync") == 0) {
   2.279 -        state->render_flags |= SDL_RENDERER_PRESENTVSYNC;
   2.280 -        return 1;
   2.281 -    }
   2.282 -    if (SDL_strcasecmp(argv[index], "--noframe") == 0) {
   2.283 -        state->window_flags |= SDL_WINDOW_BORDERLESS;
   2.284 -        return 1;
   2.285 -    }
   2.286 -    if (SDL_strcasecmp(argv[index], "--resize") == 0) {
   2.287 -        state->window_flags |= SDL_WINDOW_RESIZABLE;
   2.288 -        return 1;
   2.289 -    }
   2.290 -    if (SDL_strcasecmp(argv[index], "--minimize") == 0) {
   2.291 -        state->window_flags |= SDL_WINDOW_MINIMIZED;
   2.292 -        return 1;
   2.293 -    }
   2.294 -    if (SDL_strcasecmp(argv[index], "--maximize") == 0) {
   2.295 -        state->window_flags |= SDL_WINDOW_MAXIMIZED;
   2.296 -        return 1;
   2.297 -    }
   2.298 -    if (SDL_strcasecmp(argv[index], "--grab") == 0) {
   2.299 -        state->window_flags |= SDL_WINDOW_INPUT_GRABBED;
   2.300 -        return 1;
   2.301 -    }
   2.302 -    if (SDL_strcasecmp(argv[index], "--rate") == 0) {
   2.303 -        ++index;
   2.304 -        if (!argv[index]) {
   2.305 -            return -1;
   2.306 -        }
   2.307 -        state->audiospec.freq = SDL_atoi(argv[index]);
   2.308 -        return 2;
   2.309 -    }
   2.310 -    if (SDL_strcasecmp(argv[index], "--format") == 0) {
   2.311 -        ++index;
   2.312 -        if (!argv[index]) {
   2.313 -            return -1;
   2.314 -        }
   2.315 -        if (SDL_strcasecmp(argv[index], "U8") == 0) {
   2.316 -            state->audiospec.format = AUDIO_U8;
   2.317 -            return 2;
   2.318 -        }
   2.319 -        if (SDL_strcasecmp(argv[index], "S8") == 0) {
   2.320 -            state->audiospec.format = AUDIO_S8;
   2.321 -            return 2;
   2.322 -        }
   2.323 -        if (SDL_strcasecmp(argv[index], "U16") == 0) {
   2.324 -            state->audiospec.format = AUDIO_U16;
   2.325 -            return 2;
   2.326 -        }
   2.327 -        if (SDL_strcasecmp(argv[index], "U16LE") == 0) {
   2.328 -            state->audiospec.format = AUDIO_U16LSB;
   2.329 -            return 2;
   2.330 -        }
   2.331 -        if (SDL_strcasecmp(argv[index], "U16BE") == 0) {
   2.332 -            state->audiospec.format = AUDIO_U16MSB;
   2.333 -            return 2;
   2.334 -        }
   2.335 -        if (SDL_strcasecmp(argv[index], "S16") == 0) {
   2.336 -            state->audiospec.format = AUDIO_S16;
   2.337 -            return 2;
   2.338 -        }
   2.339 -        if (SDL_strcasecmp(argv[index], "S16LE") == 0) {
   2.340 -            state->audiospec.format = AUDIO_S16LSB;
   2.341 -            return 2;
   2.342 -        }
   2.343 -        if (SDL_strcasecmp(argv[index], "S16BE") == 0) {
   2.344 -            state->audiospec.format = AUDIO_S16MSB;
   2.345 -            return 2;
   2.346 -        }
   2.347 -        return -1;
   2.348 -    }
   2.349 -    if (SDL_strcasecmp(argv[index], "--channels") == 0) {
   2.350 -        ++index;
   2.351 -        if (!argv[index]) {
   2.352 -            return -1;
   2.353 -        }
   2.354 -        state->audiospec.channels = (Uint8) SDL_atoi(argv[index]);
   2.355 -        return 2;
   2.356 -    }
   2.357 -    if (SDL_strcasecmp(argv[index], "--samples") == 0) {
   2.358 -        ++index;
   2.359 -        if (!argv[index]) {
   2.360 -            return -1;
   2.361 -        }
   2.362 -        state->audiospec.samples = (Uint16) SDL_atoi(argv[index]);
   2.363 -        return 2;
   2.364 -    }
   2.365 -    if ((SDL_strcasecmp(argv[index], "-h") == 0)
   2.366 -        || (SDL_strcasecmp(argv[index], "--help") == 0)) {
   2.367 -        /* Print the usage message */
   2.368 -        return -1;
   2.369 -    }
   2.370 -    if (SDL_strcmp(argv[index], "-NSDocumentRevisionsDebugMode") == 0) {
   2.371 -	/* Debug flag sent by Xcode */
   2.372 -        return 2;
   2.373 -    }
   2.374 -    return 0;
   2.375 -}
   2.376 -
   2.377 -const char *
   2.378 -CommonUsage(CommonState * state)
   2.379 -{
   2.380 -    switch (state->flags & (SDL_INIT_VIDEO | SDL_INIT_AUDIO)) {
   2.381 -    case SDL_INIT_VIDEO:
   2.382 -        return VIDEO_USAGE;
   2.383 -    case SDL_INIT_AUDIO:
   2.384 -        return AUDIO_USAGE;
   2.385 -    case (SDL_INIT_VIDEO | SDL_INIT_AUDIO):
   2.386 -        return VIDEO_USAGE " " AUDIO_USAGE;
   2.387 -    default:
   2.388 -        return "";
   2.389 -    }
   2.390 -}
   2.391 -
   2.392 -static void
   2.393 -PrintRendererFlag(Uint32 flag)
   2.394 -{
   2.395 -    switch (flag) {
   2.396 -    case SDL_RENDERER_PRESENTVSYNC:
   2.397 -        fprintf(stderr, "PresentVSync");
   2.398 -        break;
   2.399 -    case SDL_RENDERER_ACCELERATED:
   2.400 -        fprintf(stderr, "Accelerated");
   2.401 -        break;
   2.402 -    default:
   2.403 -        fprintf(stderr, "0x%8.8x", flag);
   2.404 -        break;
   2.405 -    }
   2.406 -}
   2.407 -
   2.408 -static void
   2.409 -PrintPixelFormat(Uint32 format)
   2.410 -{
   2.411 -    switch (format) {
   2.412 -    case SDL_PIXELFORMAT_UNKNOWN:
   2.413 -        fprintf(stderr, "Unknwon");
   2.414 -        break;
   2.415 -    case SDL_PIXELFORMAT_INDEX1LSB:
   2.416 -        fprintf(stderr, "Index1LSB");
   2.417 -        break;
   2.418 -    case SDL_PIXELFORMAT_INDEX1MSB:
   2.419 -        fprintf(stderr, "Index1MSB");
   2.420 -        break;
   2.421 -    case SDL_PIXELFORMAT_INDEX4LSB:
   2.422 -        fprintf(stderr, "Index4LSB");
   2.423 -        break;
   2.424 -    case SDL_PIXELFORMAT_INDEX4MSB:
   2.425 -        fprintf(stderr, "Index4MSB");
   2.426 -        break;
   2.427 -    case SDL_PIXELFORMAT_INDEX8:
   2.428 -        fprintf(stderr, "Index8");
   2.429 -        break;
   2.430 -    case SDL_PIXELFORMAT_RGB332:
   2.431 -        fprintf(stderr, "RGB332");
   2.432 -        break;
   2.433 -    case SDL_PIXELFORMAT_RGB444:
   2.434 -        fprintf(stderr, "RGB444");
   2.435 -        break;
   2.436 -    case SDL_PIXELFORMAT_RGB555:
   2.437 -        fprintf(stderr, "RGB555");
   2.438 -        break;
   2.439 -    case SDL_PIXELFORMAT_BGR555:
   2.440 -        fprintf(stderr, "BGR555");
   2.441 -        break;
   2.442 -    case SDL_PIXELFORMAT_ARGB4444:
   2.443 -        fprintf(stderr, "ARGB4444");
   2.444 -        break;
   2.445 -    case SDL_PIXELFORMAT_ABGR4444:
   2.446 -        fprintf(stderr, "ABGR4444");
   2.447 -        break;
   2.448 -    case SDL_PIXELFORMAT_ARGB1555:
   2.449 -        fprintf(stderr, "ARGB1555");
   2.450 -        break;
   2.451 -    case SDL_PIXELFORMAT_ABGR1555:
   2.452 -        fprintf(stderr, "ABGR1555");
   2.453 -        break;
   2.454 -    case SDL_PIXELFORMAT_RGB565:
   2.455 -        fprintf(stderr, "RGB565");
   2.456 -        break;
   2.457 -    case SDL_PIXELFORMAT_BGR565:
   2.458 -        fprintf(stderr, "BGR565");
   2.459 -        break;
   2.460 -    case SDL_PIXELFORMAT_RGB24:
   2.461 -        fprintf(stderr, "RGB24");
   2.462 -        break;
   2.463 -    case SDL_PIXELFORMAT_BGR24:
   2.464 -        fprintf(stderr, "BGR24");
   2.465 -        break;
   2.466 -    case SDL_PIXELFORMAT_RGB888:
   2.467 -        fprintf(stderr, "RGB888");
   2.468 -        break;
   2.469 -    case SDL_PIXELFORMAT_BGR888:
   2.470 -        fprintf(stderr, "BGR888");
   2.471 -        break;
   2.472 -    case SDL_PIXELFORMAT_ARGB8888:
   2.473 -        fprintf(stderr, "ARGB8888");
   2.474 -        break;
   2.475 -    case SDL_PIXELFORMAT_RGBA8888:
   2.476 -        fprintf(stderr, "RGBA8888");
   2.477 -        break;
   2.478 -    case SDL_PIXELFORMAT_ABGR8888:
   2.479 -        fprintf(stderr, "ABGR8888");
   2.480 -        break;
   2.481 -    case SDL_PIXELFORMAT_BGRA8888:
   2.482 -        fprintf(stderr, "BGRA8888");
   2.483 -        break;
   2.484 -    case SDL_PIXELFORMAT_ARGB2101010:
   2.485 -        fprintf(stderr, "ARGB2101010");
   2.486 -        break;
   2.487 -    case SDL_PIXELFORMAT_YV12:
   2.488 -        fprintf(stderr, "YV12");
   2.489 -        break;
   2.490 -    case SDL_PIXELFORMAT_IYUV:
   2.491 -        fprintf(stderr, "IYUV");
   2.492 -        break;
   2.493 -    case SDL_PIXELFORMAT_YUY2:
   2.494 -        fprintf(stderr, "YUY2");
   2.495 -        break;
   2.496 -    case SDL_PIXELFORMAT_UYVY:
   2.497 -        fprintf(stderr, "UYVY");
   2.498 -        break;
   2.499 -    case SDL_PIXELFORMAT_YVYU:
   2.500 -        fprintf(stderr, "YVYU");
   2.501 -        break;
   2.502 -    default:
   2.503 -        fprintf(stderr, "0x%8.8x", format);
   2.504 -        break;
   2.505 -    }
   2.506 -}
   2.507 -
   2.508 -static void
   2.509 -PrintRenderer(SDL_RendererInfo * info)
   2.510 -{
   2.511 -    int i, count;
   2.512 -
   2.513 -    fprintf(stderr, "  Renderer %s:\n", info->name);
   2.514 -
   2.515 -    fprintf(stderr, "    Flags: 0x%8.8X", info->flags);
   2.516 -    fprintf(stderr, " (");
   2.517 -    count = 0;
   2.518 -    for (i = 0; i < sizeof(info->flags) * 8; ++i) {
   2.519 -        Uint32 flag = (1 << i);
   2.520 -        if (info->flags & flag) {
   2.521 -            if (count > 0) {
   2.522 -                fprintf(stderr, " | ");
   2.523 -            }
   2.524 -            PrintRendererFlag(flag);
   2.525 -            ++count;
   2.526 -        }
   2.527 -    }
   2.528 -    fprintf(stderr, ")\n");
   2.529 -
   2.530 -    fprintf(stderr, "    Texture formats (%d): ", info->num_texture_formats);
   2.531 -    for (i = 0; i < (int) info->num_texture_formats; ++i) {
   2.532 -        if (i > 0) {
   2.533 -            fprintf(stderr, ", ");
   2.534 -        }
   2.535 -        PrintPixelFormat(info->texture_formats[i]);
   2.536 -    }
   2.537 -    fprintf(stderr, "\n");
   2.538 -
   2.539 -    if (info->max_texture_width || info->max_texture_height) {
   2.540 -        fprintf(stderr, "    Max Texture Size: %dx%d\n",
   2.541 -                info->max_texture_width, info->max_texture_height);
   2.542 -    }
   2.543 -}
   2.544 -
   2.545 -static SDL_Surface *
   2.546 -LoadIcon(const char *file)
   2.547 -{
   2.548 -    SDL_Surface *icon;
   2.549 -
   2.550 -    /* Load the icon surface */
   2.551 -    icon = SDL_LoadBMP(file);
   2.552 -    if (icon == NULL) {
   2.553 -        fprintf(stderr, "Couldn't load %s: %s\n", file, SDL_GetError());
   2.554 -        return (NULL);
   2.555 -    }
   2.556 -
   2.557 -    if (icon->format->palette) {
   2.558 -        /* Set the colorkey */
   2.559 -        SDL_SetColorKey(icon, 1, *((Uint8 *) icon->pixels));
   2.560 -    }
   2.561 -
   2.562 -    return (icon);
   2.563 -}
   2.564 -
   2.565 -SDL_bool
   2.566 -CommonInit(CommonState * state)
   2.567 -{
   2.568 -    int i, j, m, n, w, h;
   2.569 -    SDL_DisplayMode fullscreen_mode;
   2.570 -
   2.571 -    if (state->flags & SDL_INIT_VIDEO) {
   2.572 -        if (state->verbose & VERBOSE_VIDEO) {
   2.573 -            n = SDL_GetNumVideoDrivers();
   2.574 -            if (n == 0) {
   2.575 -                fprintf(stderr, "No built-in video drivers\n");
   2.576 -            } else {
   2.577 -                fprintf(stderr, "Built-in video drivers:");
   2.578 -                for (i = 0; i < n; ++i) {
   2.579 -                    if (i > 0) {
   2.580 -                        fprintf(stderr, ",");
   2.581 -                    }
   2.582 -                    fprintf(stderr, " %s", SDL_GetVideoDriver(i));
   2.583 -                }
   2.584 -                fprintf(stderr, "\n");
   2.585 -            }
   2.586 -        }
   2.587 -        if (SDL_VideoInit(state->videodriver) < 0) {
   2.588 -            fprintf(stderr, "Couldn't initialize video driver: %s\n",
   2.589 -                    SDL_GetError());
   2.590 -            return SDL_FALSE;
   2.591 -        }
   2.592 -        if (state->verbose & VERBOSE_VIDEO) {
   2.593 -            fprintf(stderr, "Video driver: %s\n",
   2.594 -                    SDL_GetCurrentVideoDriver());
   2.595 -        }
   2.596 -
   2.597 -        /* Upload GL settings */
   2.598 -        SDL_GL_SetAttribute(SDL_GL_RED_SIZE, state->gl_red_size);
   2.599 -        SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, state->gl_green_size);
   2.600 -        SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, state->gl_blue_size);
   2.601 -        SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, state->gl_alpha_size);
   2.602 -        SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, state->gl_double_buffer);
   2.603 -        SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, state->gl_buffer_size);
   2.604 -        SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, state->gl_depth_size);
   2.605 -        SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, state->gl_stencil_size);
   2.606 -        SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE, state->gl_accum_red_size);
   2.607 -        SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE, state->gl_accum_green_size);
   2.608 -        SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE, state->gl_accum_blue_size);
   2.609 -        SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, state->gl_accum_alpha_size);
   2.610 -        SDL_GL_SetAttribute(SDL_GL_STEREO, state->gl_stereo);
   2.611 -        SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, state->gl_multisamplebuffers);
   2.612 -        SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, state->gl_multisamplesamples);
   2.613 -        if (state->gl_accelerated >= 0) {
   2.614 -            SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL,
   2.615 -                                state->gl_accelerated);
   2.616 -        }
   2.617 -        SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, state->gl_retained_backing);
   2.618 -        if (state->gl_major_version) {
   2.619 -            SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, state->gl_major_version);
   2.620 -            SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, state->gl_minor_version);
   2.621 -        }
   2.622 -
   2.623 -        if (state->verbose & VERBOSE_MODES) {
   2.624 -            SDL_Rect bounds;
   2.625 -            SDL_DisplayMode mode;
   2.626 -            int bpp;
   2.627 -            Uint32 Rmask, Gmask, Bmask, Amask;
   2.628 -
   2.629 -            n = SDL_GetNumVideoDisplays();
   2.630 -            fprintf(stderr, "Number of displays: %d\n", n);
   2.631 -            for (i = 0; i < n; ++i) {
   2.632 -                fprintf(stderr, "Display %d:\n", i);
   2.633 -
   2.634 -                SDL_zero(bounds);
   2.635 -                SDL_GetDisplayBounds(i, &bounds);
   2.636 -                fprintf(stderr, "Bounds: %dx%d at %d,%d\n", bounds.w, bounds.h, bounds.x, bounds.y);
   2.637 -
   2.638 -                SDL_GetDesktopDisplayMode(i, &mode);
   2.639 -                SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask,
   2.640 -                                           &Bmask, &Amask);
   2.641 -                fprintf(stderr,
   2.642 -                        "  Current mode: %dx%d@%dHz, %d bits-per-pixel (%s)\n",
   2.643 -                        mode.w, mode.h, mode.refresh_rate, bpp,
   2.644 -                        SDL_GetPixelFormatName(mode.format));
   2.645 -                if (Rmask || Gmask || Bmask) {
   2.646 -                    fprintf(stderr, "      Red Mask   = 0x%.8x\n", Rmask);
   2.647 -                    fprintf(stderr, "      Green Mask = 0x%.8x\n", Gmask);
   2.648 -                    fprintf(stderr, "      Blue Mask  = 0x%.8x\n", Bmask);
   2.649 -                    if (Amask)
   2.650 -                        fprintf(stderr, "      Alpha Mask = 0x%.8x\n", Amask);
   2.651 -                }
   2.652 -
   2.653 -                /* Print available fullscreen video modes */
   2.654 -                m = SDL_GetNumDisplayModes(i);
   2.655 -                if (m == 0) {
   2.656 -                    fprintf(stderr, "No available fullscreen video modes\n");
   2.657 -                } else {
   2.658 -                    fprintf(stderr, "  Fullscreen video modes:\n");
   2.659 -                    for (j = 0; j < m; ++j) {
   2.660 -                        SDL_GetDisplayMode(i, j, &mode);
   2.661 -                        SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask,
   2.662 -                                                   &Gmask, &Bmask, &Amask);
   2.663 -                        fprintf(stderr,
   2.664 -                                "    Mode %d: %dx%d@%dHz, %d bits-per-pixel (%s)\n",
   2.665 -                                j, mode.w, mode.h, mode.refresh_rate, bpp,
   2.666 -                                SDL_GetPixelFormatName(mode.format));
   2.667 -                        if (Rmask || Gmask || Bmask) {
   2.668 -                            fprintf(stderr, "        Red Mask   = 0x%.8x\n",
   2.669 -                                    Rmask);
   2.670 -                            fprintf(stderr, "        Green Mask = 0x%.8x\n",
   2.671 -                                    Gmask);
   2.672 -                            fprintf(stderr, "        Blue Mask  = 0x%.8x\n",
   2.673 -                                    Bmask);
   2.674 -                            if (Amask)
   2.675 -                                fprintf(stderr,
   2.676 -                                        "        Alpha Mask = 0x%.8x\n",
   2.677 -                                        Amask);
   2.678 -                        }
   2.679 -                    }
   2.680 -                }
   2.681 -            }
   2.682 -        }
   2.683 -
   2.684 -        if (state->verbose & VERBOSE_RENDER) {
   2.685 -            SDL_RendererInfo info;
   2.686 -
   2.687 -            n = SDL_GetNumRenderDrivers();
   2.688 -            if (n == 0) {
   2.689 -                fprintf(stderr, "No built-in render drivers\n");
   2.690 -            } else {
   2.691 -                fprintf(stderr, "Built-in render drivers:\n");
   2.692 -                for (i = 0; i < n; ++i) {
   2.693 -                    SDL_GetRenderDriverInfo(i, &info);
   2.694 -                    PrintRenderer(&info);
   2.695 -                }
   2.696 -            }
   2.697 -        }
   2.698 -
   2.699 -        SDL_zero(fullscreen_mode);
   2.700 -        switch (state->depth) {
   2.701 -        case 8:
   2.702 -            fullscreen_mode.format = SDL_PIXELFORMAT_INDEX8;
   2.703 -            break;
   2.704 -        case 15:
   2.705 -            fullscreen_mode.format = SDL_PIXELFORMAT_RGB555;
   2.706 -            break;
   2.707 -        case 16:
   2.708 -            fullscreen_mode.format = SDL_PIXELFORMAT_RGB565;
   2.709 -            break;
   2.710 -        case 24:
   2.711 -            fullscreen_mode.format = SDL_PIXELFORMAT_RGB24;
   2.712 -            break;
   2.713 -        default:
   2.714 -            fullscreen_mode.format = SDL_PIXELFORMAT_RGB888;
   2.715 -            break;
   2.716 -        }
   2.717 -        fullscreen_mode.refresh_rate = state->refresh_rate;
   2.718 -
   2.719 -        state->windows =
   2.720 -            (SDL_Window **) SDL_malloc(state->num_windows *
   2.721 -                                        sizeof(*state->windows));
   2.722 -        state->renderers =
   2.723 -            (SDL_Renderer **) SDL_malloc(state->num_windows *
   2.724 -                                        sizeof(*state->renderers));
   2.725 -        if (!state->windows || !state->renderers) {
   2.726 -            fprintf(stderr, "Out of memory!\n");
   2.727 -            return SDL_FALSE;
   2.728 -        }
   2.729 -        for (i = 0; i < state->num_windows; ++i) {
   2.730 -            char title[1024];
   2.731 -
   2.732 -            if (state->num_windows > 1) {
   2.733 -                SDL_snprintf(title, SDL_arraysize(title), "%s %d",
   2.734 -                             state->window_title, i + 1);
   2.735 -            } else {
   2.736 -                SDL_strlcpy(title, state->window_title, SDL_arraysize(title));
   2.737 -            }
   2.738 -            state->windows[i] =
   2.739 -                SDL_CreateWindow(title, state->window_x, state->window_y,
   2.740 -                                 state->window_w, state->window_h,
   2.741 -                                 state->window_flags);
   2.742 -            if (!state->windows[i]) {
   2.743 -                fprintf(stderr, "Couldn't create window: %s\n",
   2.744 -                        SDL_GetError());
   2.745 -                return SDL_FALSE;
   2.746 -            }
   2.747 -            SDL_GetWindowSize(state->windows[i], &w, &h);
   2.748 -            if (!(state->window_flags & SDL_WINDOW_RESIZABLE) &&
   2.749 -                (w != state->window_w || h != state->window_h)) {
   2.750 -                printf("Window requested size %dx%d, got %dx%d\n", state->window_w, state->window_h, w, h);
   2.751 -                state->window_w = w;
   2.752 -                state->window_h = h;
   2.753 -            }
   2.754 -            if (SDL_SetWindowDisplayMode(state->windows[i], &fullscreen_mode) < 0) {
   2.755 -                fprintf(stderr, "Can't set up fullscreen display mode: %s\n",
   2.756 -                        SDL_GetError());
   2.757 -                return SDL_FALSE;
   2.758 -            }
   2.759 -
   2.760 -            if (state->window_icon) {
   2.761 -                SDL_Surface *icon = LoadIcon(state->window_icon);
   2.762 -                if (icon) {
   2.763 -                    SDL_SetWindowIcon(state->windows[i], icon);
   2.764 -                    SDL_FreeSurface(icon);
   2.765 -                }
   2.766 -            }
   2.767 -
   2.768 -            SDL_ShowWindow(state->windows[i]);
   2.769 -
   2.770 -            state->renderers[i] = NULL;
   2.771 -
   2.772 -            if (!state->skip_renderer
   2.773 -                && (state->renderdriver
   2.774 -                    || !(state->window_flags & SDL_WINDOW_OPENGL))) {
   2.775 -                m = -1;
   2.776 -                if (state->renderdriver) {
   2.777 -                    SDL_RendererInfo info;
   2.778 -                    n = SDL_GetNumRenderDrivers();
   2.779 -                    for (j = 0; j < n; ++j) {
   2.780 -                        SDL_GetRenderDriverInfo(j, &info);
   2.781 -                        if (SDL_strcasecmp(info.name, state->renderdriver) ==
   2.782 -                            0) {
   2.783 -                            m = j;
   2.784 -                            break;
   2.785 -                        }
   2.786 -                    }
   2.787 -                    if (m == n) {
   2.788 -                        fprintf(stderr,
   2.789 -                                "Couldn't find render driver named %s",
   2.790 -                                state->renderdriver);
   2.791 -                        return SDL_FALSE;
   2.792 -                    }
   2.793 -                }
   2.794 -                state->renderers[i] = SDL_CreateRenderer(state->windows[i],
   2.795 -                                            m, state->render_flags);
   2.796 -                if (!state->renderers[i]) {
   2.797 -                    fprintf(stderr, "Couldn't create renderer: %s\n",
   2.798 -                            SDL_GetError());
   2.799 -                    return SDL_FALSE;
   2.800 -                }
   2.801 -                if (state->verbose & VERBOSE_RENDER) {
   2.802 -                    SDL_RendererInfo info;
   2.803 -
   2.804 -                    fprintf(stderr, "Current renderer:\n");
   2.805 -                    SDL_GetRendererInfo(state->renderers[i], &info);
   2.806 -                    PrintRenderer(&info);
   2.807 -                }
   2.808 -            }
   2.809 -        }
   2.810 -    }
   2.811 -
   2.812 -    if (state->flags & SDL_INIT_AUDIO) {
   2.813 -        if (state->verbose & VERBOSE_AUDIO) {
   2.814 -            n = SDL_GetNumAudioDrivers();
   2.815 -            if (n == 0) {
   2.816 -                fprintf(stderr, "No built-in audio drivers\n");
   2.817 -            } else {
   2.818 -                fprintf(stderr, "Built-in audio drivers:");
   2.819 -                for (i = 0; i < n; ++i) {
   2.820 -                    if (i > 0) {
   2.821 -                        fprintf(stderr, ",");
   2.822 -                    }
   2.823 -                    fprintf(stderr, " %s", SDL_GetAudioDriver(i));
   2.824 -                }
   2.825 -                fprintf(stderr, "\n");
   2.826 -            }
   2.827 -        }
   2.828 -        if (SDL_AudioInit(state->audiodriver) < 0) {
   2.829 -            fprintf(stderr, "Couldn't initialize audio driver: %s\n",
   2.830 -                    SDL_GetError());
   2.831 -            return SDL_FALSE;
   2.832 -        }
   2.833 -        if (state->verbose & VERBOSE_VIDEO) {
   2.834 -            fprintf(stderr, "Audio driver: %s\n",
   2.835 -                    SDL_GetCurrentAudioDriver());
   2.836 -        }
   2.837 -
   2.838 -        if (SDL_OpenAudio(&state->audiospec, NULL) < 0) {
   2.839 -            fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
   2.840 -            return SDL_FALSE;
   2.841 -        }
   2.842 -    }
   2.843 -
   2.844 -    return SDL_TRUE;
   2.845 -}
   2.846 -
   2.847 -static void
   2.848 -PrintEvent(SDL_Event * event)
   2.849 -{
   2.850 -    if (event->type == SDL_MOUSEMOTION) {
   2.851 -        /* Mouse motion is really spammy */
   2.852 -        //return;
   2.853 -    }
   2.854 -
   2.855 -    fprintf(stderr, "SDL EVENT: ");
   2.856 -    switch (event->type) {
   2.857 -    case SDL_WINDOWEVENT:
   2.858 -        switch (event->window.event) {
   2.859 -        case SDL_WINDOWEVENT_SHOWN:
   2.860 -            fprintf(stderr, "Window %d shown", event->window.windowID);
   2.861 -            break;
   2.862 -        case SDL_WINDOWEVENT_HIDDEN:
   2.863 -            fprintf(stderr, "Window %d hidden", event->window.windowID);
   2.864 -            break;
   2.865 -        case SDL_WINDOWEVENT_EXPOSED:
   2.866 -            fprintf(stderr, "Window %d exposed", event->window.windowID);
   2.867 -            break;
   2.868 -        case SDL_WINDOWEVENT_MOVED:
   2.869 -            fprintf(stderr, "Window %d moved to %d,%d",
   2.870 -                    event->window.windowID, event->window.data1,
   2.871 -                    event->window.data2);
   2.872 -            break;
   2.873 -        case SDL_WINDOWEVENT_RESIZED:
   2.874 -            fprintf(stderr, "Window %d resized to %dx%d",
   2.875 -                    event->window.windowID, event->window.data1,
   2.876 -                    event->window.data2);
   2.877 -            break;
   2.878 -        case SDL_WINDOWEVENT_SIZE_CHANGED:
   2.879 -            fprintf(stderr, "Window %d changed size to %dx%d",
   2.880 -                    event->window.windowID, event->window.data1,
   2.881 -                    event->window.data2);
   2.882 -            break;
   2.883 -        case SDL_WINDOWEVENT_MINIMIZED:
   2.884 -            fprintf(stderr, "Window %d minimized", event->window.windowID);
   2.885 -            break;
   2.886 -        case SDL_WINDOWEVENT_MAXIMIZED:
   2.887 -            fprintf(stderr, "Window %d maximized", event->window.windowID);
   2.888 -            break;
   2.889 -        case SDL_WINDOWEVENT_RESTORED:
   2.890 -            fprintf(stderr, "Window %d restored", event->window.windowID);
   2.891 -            break;
   2.892 -        case SDL_WINDOWEVENT_ENTER:
   2.893 -            fprintf(stderr, "Mouse entered window %d",
   2.894 -                    event->window.windowID);
   2.895 -            break;
   2.896 -        case SDL_WINDOWEVENT_LEAVE:
   2.897 -            fprintf(stderr, "Mouse left window %d", event->window.windowID);
   2.898 -            break;
   2.899 -        case SDL_WINDOWEVENT_FOCUS_GAINED:
   2.900 -            fprintf(stderr, "Window %d gained keyboard focus",
   2.901 -                    event->window.windowID);
   2.902 -            break;
   2.903 -        case SDL_WINDOWEVENT_FOCUS_LOST:
   2.904 -            fprintf(stderr, "Window %d lost keyboard focus",
   2.905 -                    event->window.windowID);
   2.906 -            break;
   2.907 -        case SDL_WINDOWEVENT_CLOSE:
   2.908 -            fprintf(stderr, "Window %d closed", event->window.windowID);
   2.909 -            break;
   2.910 -        default:
   2.911 -            fprintf(stderr, "Window %d got unknown event %d",
   2.912 -                    event->window.windowID, event->window.event);
   2.913 -            break;
   2.914 -        }
   2.915 -        break;
   2.916 -    case SDL_KEYDOWN:
   2.917 -        fprintf(stderr,
   2.918 -                "Keyboard: key pressed  in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s",
   2.919 -                event->key.windowID,
   2.920 -                event->key.keysym.scancode,
   2.921 -                SDL_GetScancodeName(event->key.keysym.scancode),
   2.922 -                event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym));
   2.923 -        break;
   2.924 -    case SDL_KEYUP:
   2.925 -        fprintf(stderr,
   2.926 -                "Keyboard: key released in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s",
   2.927 -                event->key.windowID,
   2.928 -                event->key.keysym.scancode,
   2.929 -                SDL_GetScancodeName(event->key.keysym.scancode),
   2.930 -                event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym));
   2.931 -        break;
   2.932 -    case SDL_TEXTINPUT:
   2.933 -        fprintf(stderr, "Keyboard: text input \"%s\" in window %d",
   2.934 -                event->text.text, event->text.windowID);
   2.935 -        break;
   2.936 -    case SDL_MOUSEMOTION:
   2.937 -        fprintf(stderr, "Mouse: moved to %d,%d (%d,%d) in window %d",
   2.938 -                event->motion.x, event->motion.y,
   2.939 -                event->motion.xrel, event->motion.yrel,
   2.940 -                event->motion.windowID);
   2.941 -        break;
   2.942 -    case SDL_MOUSEBUTTONDOWN:
   2.943 -        fprintf(stderr, "Mouse: button %d pressed at %d,%d in window %d",
   2.944 -                event->button.button, event->button.x, event->button.y,
   2.945 -                event->button.windowID);
   2.946 -        break;
   2.947 -    case SDL_MOUSEBUTTONUP:
   2.948 -        fprintf(stderr, "Mouse: button %d released at %d,%d in window %d",
   2.949 -                event->button.button, event->button.x, event->button.y,
   2.950 -                event->button.windowID);
   2.951 -        break;
   2.952 -    case SDL_MOUSEWHEEL:
   2.953 -        fprintf(stderr,
   2.954 -                "Mouse: wheel scrolled %d in x and %d in y in window %d",
   2.955 -                event->wheel.x, event->wheel.y, event->wheel.windowID);
   2.956 -        break;
   2.957 -    case SDL_JOYBALLMOTION:
   2.958 -        fprintf(stderr, "Joystick %d: ball %d moved by %d,%d",
   2.959 -                event->jball.which, event->jball.ball, event->jball.xrel,
   2.960 -                event->jball.yrel);
   2.961 -        break;
   2.962 -    case SDL_JOYHATMOTION:
   2.963 -        fprintf(stderr, "Joystick %d: hat %d moved to ", event->jhat.which,
   2.964 -                event->jhat.hat);
   2.965 -        switch (event->jhat.value) {
   2.966 -        case SDL_HAT_CENTERED:
   2.967 -            fprintf(stderr, "CENTER");
   2.968 -            break;
   2.969 -        case SDL_HAT_UP:
   2.970 -            fprintf(stderr, "UP");
   2.971 -            break;
   2.972 -        case SDL_HAT_RIGHTUP:
   2.973 -            fprintf(stderr, "RIGHTUP");
   2.974 -            break;
   2.975 -        case SDL_HAT_RIGHT:
   2.976 -            fprintf(stderr, "RIGHT");
   2.977 -            break;
   2.978 -        case SDL_HAT_RIGHTDOWN:
   2.979 -            fprintf(stderr, "RIGHTDOWN");
   2.980 -            break;
   2.981 -        case SDL_HAT_DOWN:
   2.982 -            fprintf(stderr, "DOWN");
   2.983 -            break;
   2.984 -        case SDL_HAT_LEFTDOWN:
   2.985 -            fprintf(stderr, "LEFTDOWN");
   2.986 -            break;
   2.987 -        case SDL_HAT_LEFT:
   2.988 -            fprintf(stderr, "LEFT");
   2.989 -            break;
   2.990 -        case SDL_HAT_LEFTUP:
   2.991 -            fprintf(stderr, "LEFTUP");
   2.992 -            break;
   2.993 -        default:
   2.994 -            fprintf(stderr, "UNKNOWN");
   2.995 -            break;
   2.996 -        }
   2.997 -        break;
   2.998 -    case SDL_JOYBUTTONDOWN:
   2.999 -        fprintf(stderr, "Joystick %d: button %d pressed",
  2.1000 -                event->jbutton.which, event->jbutton.button);
  2.1001 -        break;
  2.1002 -    case SDL_JOYBUTTONUP:
  2.1003 -        fprintf(stderr, "Joystick %d: button %d released",
  2.1004 -                event->jbutton.which, event->jbutton.button);
  2.1005 -        break;
  2.1006 -    case SDL_CLIPBOARDUPDATE:
  2.1007 -        fprintf(stderr, "Clipboard updated");
  2.1008 -        break;
  2.1009 -    case SDL_QUIT:
  2.1010 -        fprintf(stderr, "Quit requested");
  2.1011 -        break;
  2.1012 -    case SDL_USEREVENT:
  2.1013 -        fprintf(stderr, "User event %d", event->user.code);
  2.1014 -        break;
  2.1015 -    default:
  2.1016 -        fprintf(stderr, "Unknown event %d", event->type);
  2.1017 -        break;
  2.1018 -    }
  2.1019 -    fprintf(stderr, "\n");
  2.1020 -}
  2.1021 -
  2.1022 -static void
  2.1023 -ScreenShot(SDL_Renderer *renderer)
  2.1024 -{
  2.1025 -    SDL_Rect viewport;
  2.1026 -    SDL_Surface *surface;
  2.1027 -
  2.1028 -    if (!renderer) {
  2.1029 -        return;
  2.1030 -    }
  2.1031 -
  2.1032 -    SDL_RenderGetViewport(renderer, &viewport);
  2.1033 -    surface = SDL_CreateRGBSurface(0, viewport.w, viewport.h, 24,
  2.1034 -#if SDL_BYTEORDER == SDL_LIL_ENDIAN
  2.1035 -                    0x00FF0000, 0x0000FF00, 0x000000FF,
  2.1036 -#else
  2.1037 -                    0x000000FF, 0x0000FF00, 0x00FF0000,
  2.1038 -#endif
  2.1039 -                    0x00000000);
  2.1040 -    if (!surface) {
  2.1041 -        fprintf(stderr, "Couldn't create surface: %s\n", SDL_GetError());
  2.1042 -        return;
  2.1043 -    }
  2.1044 -
  2.1045 -    if (SDL_RenderReadPixels(renderer, NULL, surface->format->format,
  2.1046 -                             surface->pixels, surface->pitch) < 0) {
  2.1047 -        fprintf(stderr, "Couldn't read screen: %s\n", SDL_GetError());
  2.1048 -        return;
  2.1049 -    }
  2.1050 -
  2.1051 -    if (SDL_SaveBMP(surface, "screenshot.bmp") < 0) {
  2.1052 -        fprintf(stderr, "Couldn't save screenshot.bmp: %s\n", SDL_GetError());
  2.1053 -        return;
  2.1054 -    }
  2.1055 -}
  2.1056 -
  2.1057 -void
  2.1058 -CommonEvent(CommonState * state, SDL_Event * event, int *done)
  2.1059 -{
  2.1060 -    int i;
  2.1061 -
  2.1062 -    if (state->verbose & VERBOSE_EVENT) {
  2.1063 -        PrintEvent(event);
  2.1064 -    }
  2.1065 -
  2.1066 -    switch (event->type) {
  2.1067 -    case SDL_WINDOWEVENT:
  2.1068 -        switch (event->window.event) {
  2.1069 -        case SDL_WINDOWEVENT_SIZE_CHANGED:
  2.1070 -            {
  2.1071 -                SDL_Window *window = SDL_GetWindowFromID(event->window.windowID);
  2.1072 -                if (window) {
  2.1073 -                    for (i = 0; i < state->num_windows; ++i) {
  2.1074 -                        if (window == state->windows[i] &&
  2.1075 -                            (state->window_flags & SDL_WINDOW_RESIZABLE)) {
  2.1076 -                            SDL_Rect viewport;
  2.1077 -
  2.1078 -                            viewport.x = 0;
  2.1079 -                            viewport.y = 0;
  2.1080 -                            SDL_GetWindowSize(window, &viewport.w, &viewport.h);
  2.1081 -                            SDL_RenderSetViewport(state->renderers[i], &viewport);
  2.1082 -                        }
  2.1083 -                    }
  2.1084 -                }
  2.1085 -            }
  2.1086 -            break;
  2.1087 -        case SDL_WINDOWEVENT_CLOSE:
  2.1088 -			{
  2.1089 -                SDL_Window *window = SDL_GetWindowFromID(event->window.windowID);
  2.1090 -                if (window) {
  2.1091 -					SDL_DestroyWindow(window);
  2.1092 -				}
  2.1093 -			}
  2.1094 -            break;
  2.1095 -        }
  2.1096 -        break;
  2.1097 -    case SDL_KEYDOWN:
  2.1098 -        switch (event->key.keysym.sym) {
  2.1099 -            /* Add hotkeys here */
  2.1100 -        case SDLK_PRINTSCREEN: {
  2.1101 -                SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
  2.1102 -                if (window) {
  2.1103 -                    for (i = 0; i < state->num_windows; ++i) {
  2.1104 -                        if (window == state->windows[i]) {
  2.1105 -                            ScreenShot(state->renderers[i]);
  2.1106 -                        }
  2.1107 -                    }
  2.1108 -                }
  2.1109 -            }
  2.1110 -            break;
  2.1111 -        case SDLK_EQUALS:
  2.1112 -            if (event->key.keysym.mod & KMOD_CTRL) {
  2.1113 -                /* Ctrt-+ double the size of the window */
  2.1114 -                SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
  2.1115 -                if (window) {
  2.1116 -                    int w, h;
  2.1117 -                    SDL_GetWindowSize(window, &w, &h);
  2.1118 -                    SDL_SetWindowSize(window, w*2, h*2);
  2.1119 -                }
  2.1120 -            }
  2.1121 -            break;
  2.1122 -        case SDLK_MINUS:
  2.1123 -            if (event->key.keysym.mod & KMOD_CTRL) {
  2.1124 -                /* Ctrt-- double the size of the window */
  2.1125 -                SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
  2.1126 -                if (window) {
  2.1127 -                    int w, h;
  2.1128 -                    SDL_GetWindowSize(window, &w, &h);
  2.1129 -                    SDL_SetWindowSize(window, w/2, h/2);
  2.1130 -                }
  2.1131 -            }
  2.1132 -            break;
  2.1133 -        case SDLK_c:
  2.1134 -            if (event->key.keysym.mod & KMOD_CTRL) {
  2.1135 -                /* Ctrl-C copy awesome text! */
  2.1136 -                SDL_SetClipboardText("SDL rocks!\nYou know it!");
  2.1137 -                printf("Copied text to clipboard\n");
  2.1138 -            }
  2.1139 -            break;
  2.1140 -        case SDLK_v:
  2.1141 -            if (event->key.keysym.mod & KMOD_CTRL) {
  2.1142 -                /* Ctrl-V paste awesome text! */
  2.1143 -                char *text = SDL_GetClipboardText();
  2.1144 -                if (*text) {
  2.1145 -                    printf("Clipboard: %s\n", text);
  2.1146 -                } else {
  2.1147 -                    printf("Clipboard is empty\n");
  2.1148 -                }
  2.1149 -                SDL_free(text);
  2.1150 -            }
  2.1151 -            break;
  2.1152 -        case SDLK_g:
  2.1153 -            if (event->key.keysym.mod & KMOD_CTRL) {
  2.1154 -                /* Ctrl-G toggle grab */
  2.1155 -                SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
  2.1156 -                if (window) {
  2.1157 -                    SDL_SetWindowGrab(window, !SDL_GetWindowGrab(window));
  2.1158 -                }
  2.1159 -            }
  2.1160 -            break;
  2.1161 -        case SDLK_m:
  2.1162 -            if (event->key.keysym.mod & KMOD_CTRL) {
  2.1163 -                /* Ctrl-M maximize */
  2.1164 -                SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
  2.1165 -                if (window) {
  2.1166 -                    Uint32 flags = SDL_GetWindowFlags(window);
  2.1167 -                    if (flags & SDL_WINDOW_MAXIMIZED) {
  2.1168 -                        SDL_RestoreWindow(window);
  2.1169 -                    } else {
  2.1170 -                        SDL_MaximizeWindow(window);
  2.1171 -                    }
  2.1172 -                }
  2.1173 -            }
  2.1174 -            break;
  2.1175 -        case SDLK_r:
  2.1176 -            if (event->key.keysym.mod & KMOD_CTRL) {
  2.1177 -                /* Ctrl-R toggle mouse relative mode */
  2.1178 -                SDL_SetRelativeMouseMode(!SDL_GetRelativeMouseMode());
  2.1179 -            }
  2.1180 -            break;
  2.1181 -        case SDLK_z:
  2.1182 -            if (event->key.keysym.mod & KMOD_CTRL) {
  2.1183 -                /* Ctrl-Z minimize */
  2.1184 -                SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
  2.1185 -                if (window) {
  2.1186 -                    SDL_MinimizeWindow(window);
  2.1187 -                }
  2.1188 -            }
  2.1189 -            break;
  2.1190 -        case SDLK_RETURN:
  2.1191 -            if (event->key.keysym.mod & KMOD_CTRL) {
  2.1192 -                /* Ctrl-Enter toggle fullscreen */
  2.1193 -                SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
  2.1194 -                if (window) {
  2.1195 -                    Uint32 flags = SDL_GetWindowFlags(window);
  2.1196 -                    if (flags & SDL_WINDOW_FULLSCREEN) {
  2.1197 -                        SDL_SetWindowFullscreen(window, SDL_FALSE);
  2.1198 -                    } else {
  2.1199 -                        SDL_SetWindowFullscreen(window, SDL_TRUE);
  2.1200 -                    }
  2.1201 -                }
  2.1202 -            }
  2.1203 -            break;
  2.1204 -        case SDLK_b:
  2.1205 -            if (event->key.keysym.mod & KMOD_CTRL) {
  2.1206 -                /* Ctrl-B toggle window border */
  2.1207 -                SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
  2.1208 -                if (window) {
  2.1209 -                    const Uint32 flags = SDL_GetWindowFlags(window);
  2.1210 -                    const SDL_bool b = ((flags & SDL_WINDOW_BORDERLESS) != 0);
  2.1211 -                    SDL_SetWindowBordered(window, b);
  2.1212 -                }
  2.1213 -            }
  2.1214 -            break;
  2.1215 -        case SDLK_1:
  2.1216 -            if (event->key.keysym.mod & KMOD_CTRL) {
  2.1217 -                SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
  2.1218 -                SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Test Message", "You're awesome!", window);
  2.1219 -            }
  2.1220 -            break;
  2.1221 -        case SDLK_ESCAPE:
  2.1222 -            *done = 1;
  2.1223 -            break;
  2.1224 -        default:
  2.1225 -            break;
  2.1226 -        }
  2.1227 -        break;
  2.1228 -    case SDL_QUIT:
  2.1229 -        *done = 1;
  2.1230 -        break;
  2.1231 -    }
  2.1232 -}
  2.1233 -
  2.1234 -void
  2.1235 -CommonQuit(CommonState * state)
  2.1236 -{
  2.1237 -    int i;
  2.1238 -
  2.1239 -    if (state->windows) {
  2.1240 -        SDL_free(state->windows);
  2.1241 -    }
  2.1242 -    if (state->renderers) {
  2.1243 -        for (i = 0; i < state->num_windows; ++i) {
  2.1244 -            if (state->renderers[i]) {
  2.1245 -                SDL_DestroyRenderer(state->renderers[i]);
  2.1246 -            }
  2.1247 -        }
  2.1248 -        SDL_free(state->renderers);
  2.1249 -    }
  2.1250 -    if (state->flags & SDL_INIT_VIDEO) {
  2.1251 -        SDL_VideoQuit();
  2.1252 -    }
  2.1253 -    if (state->flags & SDL_INIT_AUDIO) {
  2.1254 -        SDL_AudioQuit();
  2.1255 -    }
  2.1256 -    SDL_free(state);
  2.1257 -}
  2.1258 -
  2.1259 -/* vi: set ts=4 sw=4 expandtab: */
     3.1 --- a/test/common.h	Mon Dec 31 10:14:38 2012 -0800
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,92 +0,0 @@
     3.4 -/*
     3.5 -  Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
     3.6 -
     3.7 -  This software is provided 'as-is', without any express or implied
     3.8 -  warranty.  In no event will the authors be held liable for any damages
     3.9 -  arising from the use of this software.
    3.10 -
    3.11 -  Permission is granted to anyone to use this software for any purpose,
    3.12 -  including commercial applications, and to alter it and redistribute it
    3.13 -  freely.
    3.14 -*/
    3.15 -
    3.16 -/* A simple test program framework */
    3.17 -
    3.18 -#include "SDL.h"
    3.19 -
    3.20 -#ifdef __NDS__
    3.21 -#define DEFAULT_WINDOW_WIDTH  256
    3.22 -#define DEFAULT_WINDOW_HEIGHT (2*192)
    3.23 -#else
    3.24 -#define DEFAULT_WINDOW_WIDTH  640
    3.25 -#define DEFAULT_WINDOW_HEIGHT 480
    3.26 -#endif
    3.27 -
    3.28 -#define VERBOSE_VIDEO   0x00000001
    3.29 -#define VERBOSE_MODES   0x00000002
    3.30 -#define VERBOSE_RENDER  0x00000004
    3.31 -#define VERBOSE_EVENT   0x00000008
    3.32 -#define VERBOSE_AUDIO   0x00000010
    3.33 -
    3.34 -typedef struct
    3.35 -{
    3.36 -    /* SDL init flags */
    3.37 -    char **argv;
    3.38 -    Uint32 flags;
    3.39 -    Uint32 verbose;
    3.40 -
    3.41 -    /* Video info */
    3.42 -    const char *videodriver;
    3.43 -    int display;
    3.44 -    const char *window_title;
    3.45 -    const char *window_icon;
    3.46 -    Uint32 window_flags;
    3.47 -    int window_x;
    3.48 -    int window_y;
    3.49 -    int window_w;
    3.50 -    int window_h;
    3.51 -    int depth;
    3.52 -    int refresh_rate;
    3.53 -    int num_windows;
    3.54 -    SDL_Window **windows;
    3.55 -
    3.56 -    /* Renderer info */
    3.57 -    const char *renderdriver;
    3.58 -    Uint32 render_flags;
    3.59 -    SDL_bool skip_renderer;
    3.60 -    SDL_Renderer **renderers;
    3.61 -
    3.62 -    /* Audio info */
    3.63 -    const char *audiodriver;
    3.64 -    SDL_AudioSpec audiospec;
    3.65 -
    3.66 -    /* GL settings */
    3.67 -    int gl_red_size;
    3.68 -    int gl_green_size;
    3.69 -    int gl_blue_size;
    3.70 -    int gl_alpha_size;
    3.71 -    int gl_buffer_size;
    3.72 -    int gl_depth_size;
    3.73 -    int gl_stencil_size;
    3.74 -    int gl_double_buffer;
    3.75 -    int gl_accum_red_size;
    3.76 -    int gl_accum_green_size;
    3.77 -    int gl_accum_blue_size;
    3.78 -    int gl_accum_alpha_size;
    3.79 -    int gl_stereo;
    3.80 -    int gl_multisamplebuffers;
    3.81 -    int gl_multisamplesamples;
    3.82 -    int gl_retained_backing;
    3.83 -    int gl_accelerated;
    3.84 -    int gl_major_version;
    3.85 -    int gl_minor_version;
    3.86 -} CommonState;
    3.87 -
    3.88 -extern CommonState *CommonCreateState(char **argv, Uint32 flags);
    3.89 -extern int CommonArg(CommonState * state, int index);
    3.90 -extern const char *CommonUsage(CommonState * state);
    3.91 -extern SDL_bool CommonInit(CommonState * state);
    3.92 -extern void CommonEvent(CommonState * state, SDL_Event * event, int *done);
    3.93 -extern void CommonQuit(CommonState * state);
    3.94 -
    3.95 -/* vi: set ts=4 sw=4 expandtab: */
     4.1 --- a/test/configure	Mon Dec 31 10:14:38 2012 -0800
     4.2 +++ b/test/configure	Mon Dec 31 10:26:38 2012 -0800
     4.3 @@ -1,11 +1,9 @@
     4.4  #! /bin/sh
     4.5  # Guess values for system-dependent variables and create Makefiles.
     4.6 -# Generated by GNU Autoconf 2.68.
     4.7 +# Generated by GNU Autoconf 2.69.
     4.8  #
     4.9  #
    4.10 -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
    4.11 -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
    4.12 -# Foundation, Inc.
    4.13 +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
    4.14  #
    4.15  #
    4.16  # This configure script is free software; the Free Software Foundation
    4.17 @@ -134,6 +132,31 @@
    4.18  # CDPATH.
    4.19  (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
    4.20  
    4.21 +# Use a proper internal environment variable to ensure we don't fall
    4.22 +  # into an infinite loop, continuously re-executing ourselves.
    4.23 +  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
    4.24 +    _as_can_reexec=no; export _as_can_reexec;
    4.25 +    # We cannot yet assume a decent shell, so we have to provide a
    4.26 +# neutralization value for shells without unset; and this also
    4.27 +# works around shells that cannot unset nonexistent variables.
    4.28 +# Preserve -v and -x to the replacement shell.
    4.29 +BASH_ENV=/dev/null
    4.30 +ENV=/dev/null
    4.31 +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
    4.32 +case $- in # ((((
    4.33 +  *v*x* | *x*v* ) as_opts=-vx ;;
    4.34 +  *v* ) as_opts=-v ;;
    4.35 +  *x* ) as_opts=-x ;;
    4.36 +  * ) as_opts= ;;
    4.37 +esac
    4.38 +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
    4.39 +# Admittedly, this is quite paranoid, since all the known shells bail
    4.40 +# out after a failed `exec'.
    4.41 +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
    4.42 +as_fn_exit 255
    4.43 +  fi
    4.44 +  # We don't want this to propagate to other subprocesses.
    4.45 +          { _as_can_reexec=; unset _as_can_reexec;}
    4.46  if test "x$CONFIG_SHELL" = x; then
    4.47    as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
    4.48    emulate sh
    4.49 @@ -167,7 +190,8 @@
    4.50  else
    4.51    exitcode=1; echo positional parameters were not saved.
    4.52  fi
    4.53 -test x\$exitcode = x0 || exit 1"
    4.54 +test x\$exitcode = x0 || exit 1
    4.55 +test -x / || exit 1"
    4.56    as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
    4.57    as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
    4.58    eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
    4.59 @@ -211,21 +235,25 @@
    4.60  
    4.61  
    4.62        if test "x$CONFIG_SHELL" != x; then :
    4.63 -  # We cannot yet assume a decent shell, so we have to provide a
    4.64 -	# neutralization value for shells without unset; and this also
    4.65 -	# works around shells that cannot unset nonexistent variables.
    4.66 -	# Preserve -v and -x to the replacement shell.
    4.67 -	BASH_ENV=/dev/null
    4.68 -	ENV=/dev/null
    4.69 -	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
    4.70 -	export CONFIG_SHELL
    4.71 -	case $- in # ((((
    4.72 -	  *v*x* | *x*v* ) as_opts=-vx ;;
    4.73 -	  *v* ) as_opts=-v ;;
    4.74 -	  *x* ) as_opts=-x ;;
    4.75 -	  * ) as_opts= ;;
    4.76 -	esac
    4.77 -	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
    4.78 +  export CONFIG_SHELL
    4.79 +             # We cannot yet assume a decent shell, so we have to provide a
    4.80 +# neutralization value for shells without unset; and this also
    4.81 +# works around shells that cannot unset nonexistent variables.
    4.82 +# Preserve -v and -x to the replacement shell.
    4.83 +BASH_ENV=/dev/null
    4.84 +ENV=/dev/null
    4.85 +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
    4.86 +case $- in # ((((
    4.87 +  *v*x* | *x*v* ) as_opts=-vx ;;
    4.88 +  *v* ) as_opts=-v ;;
    4.89 +  *x* ) as_opts=-x ;;
    4.90 +  * ) as_opts= ;;
    4.91 +esac
    4.92 +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
    4.93 +# Admittedly, this is quite paranoid, since all the known shells bail
    4.94 +# out after a failed `exec'.
    4.95 +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
    4.96 +exit 255
    4.97  fi
    4.98  
    4.99      if test x$as_have_required = xno; then :
   4.100 @@ -327,6 +355,14 @@
   4.101  
   4.102  
   4.103  } # as_fn_mkdir_p
   4.104 +
   4.105 +# as_fn_executable_p FILE
   4.106 +# -----------------------
   4.107 +# Test if FILE is an executable regular file.
   4.108 +as_fn_executable_p ()
   4.109 +{
   4.110 +  test -f "$1" && test -x "$1"
   4.111 +} # as_fn_executable_p
   4.112  # as_fn_append VAR VALUE
   4.113  # ----------------------
   4.114  # Append the text in VALUE to the end of the definition contained in VAR. Take
   4.115 @@ -448,6 +484,10 @@
   4.116    chmod +x "$as_me.lineno" ||
   4.117      { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
   4.118  
   4.119 +  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
   4.120 +  # already done that, so ensure we don't try to do so again and fall
   4.121 +  # in an infinite loop.  This has already happened in practice.
   4.122 +  _as_can_reexec=no; export _as_can_reexec
   4.123    # Don't try to exec as it changes $[0], causing all sort of problems
   4.124    # (the dirname of $[0] is not the place where we might find the
   4.125    # original and so on.  Autoconf is especially sensitive to this).
   4.126 @@ -482,16 +522,16 @@
   4.127      # ... but there are two gotchas:
   4.128      # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
   4.129      # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
   4.130 -    # In both cases, we have to default to `cp -p'.
   4.131 +    # In both cases, we have to default to `cp -pR'.
   4.132      ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
   4.133 -      as_ln_s='cp -p'
   4.134 +      as_ln_s='cp -pR'
   4.135    elif ln conf$$.file conf$$ 2>/dev/null; then
   4.136      as_ln_s=ln
   4.137    else
   4.138 -    as_ln_s='cp -p'
   4.139 +    as_ln_s='cp -pR'
   4.140    fi
   4.141  else
   4.142 -  as_ln_s='cp -p'
   4.143 +  as_ln_s='cp -pR'
   4.144  fi
   4.145  rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
   4.146  rmdir conf$$.dir 2>/dev/null
   4.147 @@ -503,28 +543,8 @@
   4.148    as_mkdir_p=false
   4.149  fi
   4.150  
   4.151 -if test -x / >/dev/null 2>&1; then
   4.152 -  as_test_x='test -x'
   4.153 -else
   4.154 -  if ls -dL / >/dev/null 2>&1; then
   4.155 -    as_ls_L_option=L
   4.156 -  else
   4.157 -    as_ls_L_option=
   4.158 -  fi
   4.159 -  as_test_x='
   4.160 -    eval sh -c '\''
   4.161 -      if test -d "$1"; then
   4.162 -	test -d "$1/.";
   4.163 -      else
   4.164 -	case $1 in #(
   4.165 -	-*)set "./$1";;
   4.166 -	esac;
   4.167 -	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
   4.168 -	???[sx]*):;;*)false;;esac;fi
   4.169 -    '\'' sh
   4.170 -  '
   4.171 -fi
   4.172 -as_executable_p=$as_test_x
   4.173 +as_test_x='test -x'
   4.174 +as_executable_p=as_fn_executable_p
   4.175  
   4.176  # Sed expression to map a string onto a valid CPP name.
   4.177  as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
   4.178 @@ -1111,8 +1131,6 @@
   4.179  if test "x$host_alias" != x; then
   4.180    if test "x$build_alias" = x; then
   4.181      cross_compiling=maybe
   4.182 -    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
   4.183 -    If a cross compiler is detected then cross compile mode will be used" >&2
   4.184    elif test "x$build_alias" != "x$host_alias"; then
   4.185      cross_compiling=yes
   4.186    fi
   4.187 @@ -1367,9 +1385,9 @@
   4.188  if $ac_init_version; then
   4.189    cat <<\_ACEOF
   4.190  configure
   4.191 -generated by GNU Autoconf 2.68
   4.192 -
   4.193 -Copyright (C) 2010 Free Software Foundation, Inc.
   4.194 +generated by GNU Autoconf 2.69
   4.195 +
   4.196 +Copyright (C) 2012 Free Software Foundation, Inc.
   4.197  This configure script is free software; the Free Software Foundation
   4.198  gives unlimited permission to copy, distribute and modify it.
   4.199  _ACEOF
   4.200 @@ -1487,7 +1505,7 @@
   4.201  	 test ! -s conftest.err
   4.202         } && test -s conftest$ac_exeext && {
   4.203  	 test "$cross_compiling" = yes ||
   4.204 -	 $as_test_x conftest$ac_exeext
   4.205 +	 test -x conftest$ac_exeext
   4.206         }; then :
   4.207    ac_retval=0
   4.208  else
   4.209 @@ -1547,7 +1565,7 @@
   4.210  running configure, to aid debugging if configure makes a mistake.
   4.211  
   4.212  It was created by $as_me, which was
   4.213 -generated by GNU Autoconf 2.68.  Invocation command line was
   4.214 +generated by GNU Autoconf 2.69.  Invocation command line was
   4.215  
   4.216    $ $0 $@
   4.217  
   4.218 @@ -2019,7 +2037,7 @@
   4.219    IFS=$as_save_IFS
   4.220    test -z "$as_dir" && as_dir=.
   4.221      for ac_exec_ext in '' $ac_executable_extensions; do
   4.222 -  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
   4.223 +  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
   4.224      ac_cv_prog_CC="${ac_tool_prefix}gcc"
   4.225      $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   4.226      break 2
   4.227 @@ -2059,7 +2077,7 @@
   4.228    IFS=$as_save_IFS
   4.229    test -z "$as_dir" && as_dir=.
   4.230      for ac_exec_ext in '' $ac_executable_extensions; do
   4.231 -  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
   4.232 +  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
   4.233      ac_cv_prog_ac_ct_CC="gcc"
   4.234      $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   4.235      break 2
   4.236 @@ -2112,7 +2130,7 @@
   4.237    IFS=$as_save_IFS
   4.238    test -z "$as_dir" && as_dir=.
   4.239      for ac_exec_ext in '' $ac_executable_extensions; do
   4.240 -  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
   4.241 +  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
   4.242      ac_cv_prog_CC="${ac_tool_prefix}cc"
   4.243      $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   4.244      break 2
   4.245 @@ -2153,7 +2171,7 @@
   4.246    IFS=$as_save_IFS
   4.247    test -z "$as_dir" && as_dir=.
   4.248      for ac_exec_ext in '' $ac_executable_extensions; do
   4.249 -  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
   4.250 +  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
   4.251      if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
   4.252         ac_prog_rejected=yes
   4.253         continue
   4.254 @@ -2211,7 +2229,7 @@
   4.255    IFS=$as_save_IFS
   4.256    test -z "$as_dir" && as_dir=.
   4.257      for ac_exec_ext in '' $ac_executable_extensions; do
   4.258 -  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
   4.259 +  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
   4.260      ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
   4.261      $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   4.262      break 2
   4.263 @@ -2255,7 +2273,7 @@
   4.264    IFS=$as_save_IFS
   4.265    test -z "$as_dir" && as_dir=.
   4.266      for ac_exec_ext in '' $ac_executable_extensions; do
   4.267 -  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
   4.268 +  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
   4.269      ac_cv_prog_ac_ct_CC="$ac_prog"
   4.270      $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   4.271      break 2
   4.272 @@ -2701,8 +2719,7 @@
   4.273  /* end confdefs.h.  */
   4.274  #include <stdarg.h>
   4.275  #include <stdio.h>
   4.276 -#include <sys/types.h>
   4.277 -#include <sys/stat.h>
   4.278 +struct stat;
   4.279  /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
   4.280  struct buf { int x; };
   4.281  FILE * (*rcsopen) (struct buf *, struct stat *, int);
   4.282 @@ -2801,11 +2818,11 @@
   4.283  int
   4.284  main ()
   4.285  {
   4.286 -/* FIXME: Include the comments suggested by Paul. */
   4.287 +
   4.288  #ifndef __cplusplus
   4.289 -  /* Ultrix mips cc rejects this.  */
   4.290 +  /* Ultrix mips cc rejects this sort of thing.  */
   4.291    typedef int charset[2];
   4.292 -  const charset cs;
   4.293 +  const charset cs = { 0, 0 };
   4.294    /* SunOS 4.1.1 cc rejects this.  */
   4.295    char const *const *pcpcc;
   4.296    char **ppc;
   4.297 @@ -2822,8 +2839,9 @@
   4.298    ++pcpcc;
   4.299    ppc = (char**) pcpcc;
   4.300    pcpcc = (char const *const *) ppc;
   4.301 -  { /* SCO 3.2v4 cc rejects this.  */
   4.302 -    char *t;
   4.303 +  { /* SCO 3.2v4 cc rejects this sort of thing.  */
   4.304 +    char tx;
   4.305 +    char *t = &tx;
   4.306      char const *s = 0 ? (char *) 0 : (char const *) 0;
   4.307  
   4.308      *t++ = 0;
   4.309 @@ -2839,10 +2857,10 @@
   4.310      iptr p = 0;
   4.311      ++p;
   4.312    }
   4.313 -  { /* AIX XL C 1.02.0.0 rejects this saying
   4.314 +  { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
   4.315         "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
   4.316 -    struct s { int j; const int *ap[3]; };
   4.317 -    struct s *b; b->j = 5;
   4.318 +    struct s { int j; const int *ap[3]; } bx;
   4.319 +    struct s *b = &bx; b->j = 5;
   4.320    }
   4.321    { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
   4.322      const int foo = 10;
   4.323 @@ -2922,7 +2940,7 @@
   4.324    IFS=$as_save_IFS
   4.325    test -z "$as_dir" && as_dir=.
   4.326      for ac_exec_ext in '' $ac_executable_extensions; do
   4.327 -  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
   4.328 +  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
   4.329      ac_cv_path_OSMESA_CONFIG="$as_dir/$ac_word$ac_exec_ext"
   4.330      $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   4.331      break 2
   4.332 @@ -2999,7 +3017,7 @@
   4.333    IFS=$as_save_IFS
   4.334    test -z "$as_dir" && as_dir=.
   4.335      for ac_exec_ext in '' $ac_executable_extensions; do
   4.336 -  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
   4.337 +  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
   4.338      ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
   4.339      $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   4.340      break 2
   4.341 @@ -3042,7 +3060,7 @@
   4.342    IFS=$as_save_IFS
   4.343    test -z "$as_dir" && as_dir=.
   4.344      for ac_exec_ext in '' $ac_executable_extensions; do
   4.345 -  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
   4.346 +  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
   4.347      ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
   4.348      $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   4.349      break 2
   4.350 @@ -3230,7 +3248,7 @@
   4.351    IFS=$as_save_IFS
   4.352    test -z "$as_dir" && as_dir=.
   4.353      for ac_exec_ext in '' $ac_executable_extensions; do
   4.354 -  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
   4.355 +  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
   4.356      ac_cv_path_SDL_CONFIG="$as_dir/$ac_word$ac_exec_ext"
   4.357      $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   4.358      break 2
   4.359 @@ -3432,7 +3450,7 @@
   4.360    rm -f conf.sdltest
   4.361  
   4.362  CFLAGS="$CFLAGS $SDL_CFLAGS"
   4.363 -LIBS="$LIBS $SDL_LIBS"
   4.364 +LIBS="$LIBS -lSDL2_test $SDL_LIBS"
   4.365  
   4.366  ac_ext=c
   4.367  ac_cpp='$CPP $CPPFLAGS'
   4.368 @@ -4338,16 +4356,16 @@
   4.369      # ... but there are two gotchas:
   4.370      # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
   4.371      # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
   4.372 -    # In both cases, we have to default to `cp -p'.
   4.373 +    # In both cases, we have to default to `cp -pR'.
   4.374      ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
   4.375 -      as_ln_s='cp -p'
   4.376 +      as_ln_s='cp -pR'
   4.377    elif ln conf$$.file conf$$ 2>/dev/null; then
   4.378      as_ln_s=ln
   4.379    else
   4.380 -    as_ln_s='cp -p'
   4.381 +    as_ln_s='cp -pR'
   4.382    fi
   4.383  else
   4.384 -  as_ln_s='cp -p'
   4.385 +  as_ln_s='cp -pR'
   4.386  fi
   4.387  rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
   4.388  rmdir conf$$.dir 2>/dev/null
   4.389 @@ -4407,28 +4425,16 @@
   4.390    as_mkdir_p=false
   4.391  fi
   4.392  
   4.393 -if test -x / >/dev/null 2>&1; then
   4.394 -  as_test_x='test -x'
   4.395 -else
   4.396 -  if ls -dL / >/dev/null 2>&1; then
   4.397 -    as_ls_L_option=L
   4.398 -  else
   4.399 -    as_ls_L_option=
   4.400 -  fi
   4.401 -  as_test_x='
   4.402 -    eval sh -c '\''
   4.403 -      if test -d "$1"; then
   4.404 -	test -d "$1/.";
   4.405 -      else
   4.406 -	case $1 in #(
   4.407 -	-*)set "./$1";;
   4.408 -	esac;
   4.409 -	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
   4.410 -	???[sx]*):;;*)false;;esac;fi
   4.411 -    '\'' sh
   4.412 -  '
   4.413 -fi
   4.414 -as_executable_p=$as_test_x
   4.415 +
   4.416 +# as_fn_executable_p FILE
   4.417 +# -----------------------
   4.418 +# Test if FILE is an executable regular file.
   4.419 +as_fn_executable_p ()
   4.420 +{
   4.421 +  test -f "$1" && test -x "$1"
   4.422 +} # as_fn_executable_p
   4.423 +as_test_x='test -x'
   4.424 +as_executable_p=as_fn_executable_p
   4.425  
   4.426  # Sed expression to map a string onto a valid CPP name.
   4.427  as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
   4.428 @@ -4450,7 +4456,7 @@
   4.429  # values after options handling.
   4.430  ac_log="
   4.431  This file was extended by $as_me, which was
   4.432 -generated by GNU Autoconf 2.68.  Invocation command line was
   4.433 +generated by GNU Autoconf 2.69.  Invocation command line was
   4.434  
   4.435    CONFIG_FILES    = $CONFIG_FILES
   4.436    CONFIG_HEADERS  = $CONFIG_HEADERS
   4.437 @@ -4503,10 +4509,10 @@
   4.438  ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
   4.439  ac_cs_version="\\
   4.440  config.status
   4.441 -configured by $0, generated by GNU Autoconf 2.68,
   4.442 +configured by $0, generated by GNU Autoconf 2.69,
   4.443    with options \\"\$ac_cs_config\\"
   4.444  
   4.445 -Copyright (C) 2010 Free Software Foundation, Inc.
   4.446 +Copyright (C) 2012 Free Software Foundation, Inc.
   4.447  This config.status script is free software; the Free Software Foundation
   4.448  gives unlimited permission to copy, distribute and modify it."
   4.449  
   4.450 @@ -4583,7 +4589,7 @@
   4.451  _ACEOF
   4.452  cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
   4.453  if \$ac_cs_recheck; then
   4.454 -  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
   4.455 +  set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
   4.456    shift
   4.457    \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
   4.458    CONFIG_SHELL='$SHELL'
     5.1 --- a/test/configure.in	Mon Dec 31 10:14:38 2012 -0800
     5.2 +++ b/test/configure.in	Mon Dec 31 10:26:38 2012 -0800
     5.3 @@ -86,7 +86,7 @@
     5.4  	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
     5.5  )
     5.6  CFLAGS="$CFLAGS $SDL_CFLAGS"
     5.7 -LIBS="$LIBS $SDL_LIBS"
     5.8 +LIBS="$LIBS -lSDL2_test $SDL_LIBS"
     5.9  
    5.10  dnl Check for X11 path, needed for OpenGL on some systems
    5.11  AC_PATH_X
     6.1 --- a/test/testdraw2.c	Mon Dec 31 10:14:38 2012 -0800
     6.2 +++ b/test/testdraw2.c	Mon Dec 31 10:26:38 2012 -0800
     6.3 @@ -16,11 +16,11 @@
     6.4  #include <stdio.h>
     6.5  #include <time.h>
     6.6  
     6.7 -#include "common.h"
     6.8 +#include "SDL_test_common.h"
     6.9  
    6.10  #define NUM_OBJECTS	100
    6.11  
    6.12 -static CommonState *state;
    6.13 +static SDLTest_CommonState *state;
    6.14  static int num_objects;
    6.15  static SDL_bool cycle_color;
    6.16  static SDL_bool cycle_alpha;
    6.17 @@ -180,14 +180,14 @@
    6.18      num_objects = NUM_OBJECTS;
    6.19  
    6.20      /* Initialize test framework */
    6.21 -    state = CommonCreateState(argv, SDL_INIT_VIDEO);
    6.22 +    state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
    6.23      if (!state) {
    6.24          return 1;
    6.25      }
    6.26      for (i = 1; i < argc;) {
    6.27          int consumed;
    6.28  
    6.29 -        consumed = CommonArg(state, i);
    6.30 +        consumed = SDLTest_CommonArg(state, i);
    6.31          if (consumed == 0) {
    6.32              consumed = -1;
    6.33              if (SDL_strcasecmp(argv[i], "--blend") == 0) {
    6.34 @@ -220,12 +220,12 @@
    6.35          if (consumed < 0) {
    6.36              fprintf(stderr,
    6.37                      "Usage: %s %s [--blend none|blend|add|mod] [--cyclecolor] [--cyclealpha]\n",
    6.38 -                    argv[0], CommonUsage(state));
    6.39 +                    argv[0], SDLTest_CommonUsage(state));
    6.40              return 1;
    6.41          }
    6.42          i += consumed;
    6.43      }
    6.44 -    if (!CommonInit(state)) {
    6.45 +    if (!SDLTest_CommonInit(state)) {
    6.46          return 2;
    6.47      }
    6.48  
    6.49 @@ -247,7 +247,7 @@
    6.50          /* Check for events */
    6.51          ++frames;
    6.52          while (SDL_PollEvent(&event)) {
    6.53 -            CommonEvent(state, &event, &done);
    6.54 +            SDLTest_CommonEvent(state, &event, &done);
    6.55          }
    6.56          for (i = 0; i < state->num_windows; ++i) {
    6.57              SDL_Renderer *renderer = state->renderers[i];
    6.58 @@ -262,7 +262,7 @@
    6.59          }
    6.60      }
    6.61  
    6.62 -    CommonQuit(state);
    6.63 +    SDLTest_CommonQuit(state);
    6.64  
    6.65      /* Print out some timing information */
    6.66      now = SDL_GetTicks();
     7.1 --- a/test/testgl2.c	Mon Dec 31 10:14:38 2012 -0800
     7.2 +++ b/test/testgl2.c	Mon Dec 31 10:26:38 2012 -0800
     7.3 @@ -14,7 +14,7 @@
     7.4  #include <string.h>
     7.5  #include <math.h>
     7.6  
     7.7 -#include "common.h"
     7.8 +#include "SDL_test_common.h"
     7.9  
    7.10  #ifdef __MACOS__
    7.11  #define HAVE_OPENGL
    7.12 @@ -27,7 +27,7 @@
    7.13  /* Undefine this if you want a flat cube instead of a rainbow cube */
    7.14  #define SHADED_CUBE
    7.15  
    7.16 -static CommonState *state;
    7.17 +static SDLTest_CommonState *state;
    7.18  static SDL_GLContext context;
    7.19  
    7.20  /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
    7.21 @@ -38,7 +38,7 @@
    7.22          /* SDL_GL_MakeCurrent(0, NULL); *//* doesn't do anything */
    7.23          SDL_GL_DeleteContext(context);
    7.24      }
    7.25 -    CommonQuit(state);
    7.26 +    SDLTest_CommonQuit(state);
    7.27      exit(rc);
    7.28  }
    7.29  
    7.30 @@ -186,14 +186,14 @@
    7.31      accel = -1;
    7.32  
    7.33      /* Initialize test framework */
    7.34 -    state = CommonCreateState(argv, SDL_INIT_VIDEO);
    7.35 +    state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
    7.36      if (!state) {
    7.37          return 1;
    7.38      }
    7.39      for (i = 1; i < argc;) {
    7.40          int consumed;
    7.41  
    7.42 -        consumed = CommonArg(state, i);
    7.43 +        consumed = SDLTest_CommonArg(state, i);
    7.44          if (consumed == 0) {
    7.45              if (SDL_strcasecmp(argv[i], "--fsaa") == 0) {
    7.46                  ++fsaa;
    7.47 @@ -207,7 +207,7 @@
    7.48          }
    7.49          if (consumed < 0) {
    7.50              fprintf(stderr, "Usage: %s %s [--fsaa] [--accel n]\n", argv[0],
    7.51 -                    CommonUsage(state));
    7.52 +                    SDLTest_CommonUsage(state));
    7.53              quit(1);
    7.54          }
    7.55          i += consumed;
    7.56 @@ -228,7 +228,7 @@
    7.57          state->gl_accelerated = accel;
    7.58      }
    7.59  
    7.60 -    if (!CommonInit(state)) {
    7.61 +    if (!SDLTest_CommonInit(state)) {
    7.62          quit(2);
    7.63      }
    7.64  
    7.65 @@ -327,7 +327,7 @@
    7.66          /* Check for events */
    7.67          ++frames;
    7.68          while (SDL_PollEvent(&event)) {
    7.69 -            CommonEvent(state, &event, &done);
    7.70 +            SDLTest_CommonEvent(state, &event, &done);
    7.71          }
    7.72          for (i = 0; i < state->num_windows; ++i) {
    7.73              int w, h;
     8.1 --- a/test/testgles.c	Mon Dec 31 10:14:38 2012 -0800
     8.2 +++ b/test/testgles.c	Mon Dec 31 10:26:38 2012 -0800
     8.3 @@ -14,7 +14,7 @@
     8.4  #include <string.h>
     8.5  #include <math.h>
     8.6  
     8.7 -#include "common.h"
     8.8 +#include "SDL_test_common.h"
     8.9  
    8.10  #if defined(__IPHONEOS__) || defined(__ANDROID__)
    8.11  #define HAVE_OPENGLES
    8.12 @@ -24,7 +24,7 @@
    8.13  
    8.14  #include "SDL_opengles.h"
    8.15  
    8.16 -static CommonState *state;
    8.17 +static SDLTest_CommonState *state;
    8.18  static SDL_GLContext *context = NULL;
    8.19  static int depth = 16;
    8.20  
    8.21 @@ -44,7 +44,7 @@
    8.22          SDL_free(context);
    8.23      }
    8.24  
    8.25 -    CommonQuit(state);
    8.26 +    SDLTest_CommonQuit(state);
    8.27      exit(rc);
    8.28  }
    8.29  
    8.30 @@ -115,14 +115,14 @@
    8.31      accel = 0;
    8.32  
    8.33      /* Initialize test framework */
    8.34 -    state = CommonCreateState(argv, SDL_INIT_VIDEO);
    8.35 +    state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
    8.36      if (!state) {
    8.37          return 1;
    8.38      }
    8.39      for (i = 1; i < argc;) {
    8.40          int consumed;
    8.41  
    8.42 -        consumed = CommonArg(state, i);
    8.43 +        consumed = SDLTest_CommonArg(state, i);
    8.44          if (consumed == 0) {
    8.45              if (SDL_strcasecmp(argv[i], "--fsaa") == 0) {
    8.46                  ++fsaa;
    8.47 @@ -144,7 +144,7 @@
    8.48          }
    8.49          if (consumed < 0) {
    8.50              fprintf(stderr, "Usage: %s %s [--fsaa] [--accel] [--zdepth %%d]\n", argv[0],
    8.51 -                    CommonUsage(state));
    8.52 +                    SDLTest_CommonUsage(state));
    8.53              quit(1);
    8.54          }
    8.55          i += consumed;
    8.56 @@ -163,7 +163,7 @@
    8.57      if (accel) {
    8.58          state->gl_accelerated=1;
    8.59      }
    8.60 -    if (!CommonInit(state)) {
    8.61 +    if (!SDLTest_CommonInit(state)) {
    8.62          quit(2);
    8.63      }
    8.64  
    8.65 @@ -306,7 +306,7 @@
    8.66                          break;
    8.67                  }
    8.68              }
    8.69 -            CommonEvent(state, &event, &done);
    8.70 +            SDLTest_CommonEvent(state, &event, &done);
    8.71          }
    8.72          for (i = 0; i < state->num_windows; ++i) {
    8.73              status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
     9.1 --- a/test/testime.c	Mon Dec 31 10:14:38 2012 -0800
     9.2 +++ b/test/testime.c	Mon Dec 31 10:26:38 2012 -0800
     9.3 @@ -20,13 +20,13 @@
     9.4  #include "SDL_ttf.h"
     9.5  #endif
     9.6  
     9.7 -#include "common.h"
     9.8 +#include "SDL_test_common.h"
     9.9  
    9.10  #define DEFAULT_PTSIZE  30
    9.11  #define DEFAULT_FONT    "/System/Library/Fonts/华文细黑.ttf"
    9.12  #define MAX_TEXT_LENGTH 256
    9.13  
    9.14 -static CommonState *state;
    9.15 +static SDLTest_CommonState *state;
    9.16  static SDL_Rect textRect, markedRect;
    9.17  static SDL_Color lineColor = {0,0,0,0};
    9.18  static SDL_Color backColor = {255,255,255,0};
    9.19 @@ -211,12 +211,12 @@
    9.20      const char *fontname = DEFAULT_FONT;
    9.21  
    9.22      /* Initialize test framework */
    9.23 -    state = CommonCreateState(argv, SDL_INIT_VIDEO);
    9.24 +    state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
    9.25      if (!state) {
    9.26          return 1;
    9.27      }
    9.28      for (i = 1; i < argc;i++) {
    9.29 -        CommonArg(state, i);
    9.30 +        SDLTest_CommonArg(state, i);
    9.31      }
    9.32      for (argc--, argv++; argc > 0; argc--, argv++)
    9.33      {
    9.34 @@ -239,7 +239,7 @@
    9.35          }
    9.36      }
    9.37      
    9.38 -    if (!CommonInit(state)) {
    9.39 +    if (!SDLTest_CommonInit(state)) {
    9.40          return 2;
    9.41      }
    9.42  
    9.43 @@ -273,7 +273,7 @@
    9.44      while (!done) {
    9.45          /* Check for events */
    9.46          while (SDL_PollEvent(&event)) {
    9.47 -            CommonEvent(state, &event, &done);
    9.48 +            SDLTest_CommonEvent(state, &event, &done);
    9.49              switch(event.type) {
    9.50                  case SDL_KEYDOWN: {
    9.51                      switch (event.key.keysym.sym)
    9.52 @@ -361,7 +361,7 @@
    9.53          }
    9.54      }
    9.55      CleanupVideo();
    9.56 -    CommonQuit(state);
    9.57 +    SDLTest_CommonQuit(state);
    9.58      return 0;
    9.59  }
    9.60  
    10.1 --- a/test/testintersections.c	Mon Dec 31 10:14:38 2012 -0800
    10.2 +++ b/test/testintersections.c	Mon Dec 31 10:26:38 2012 -0800
    10.3 @@ -16,12 +16,12 @@
    10.4  #include <stdio.h>
    10.5  #include <time.h>
    10.6  
    10.7 -#include "common.h"
    10.8 +#include "SDL_test_common.h"
    10.9  
   10.10  #define SWAP(typ,a,b) do{typ t=a;a=b;b=t;}while(0)
   10.11  #define NUM_OBJECTS	100
   10.12  
   10.13 -static CommonState *state;
   10.14 +static SDLTest_CommonState *state;
   10.15  static int num_objects;
   10.16  static SDL_bool cycle_color;
   10.17  static SDL_bool cycle_alpha;
   10.18 @@ -204,14 +204,14 @@
   10.19      num_objects = NUM_OBJECTS;
   10.20  
   10.21      /* Initialize test framework */
   10.22 -    state = CommonCreateState(argv, SDL_INIT_VIDEO);
   10.23 +    state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
   10.24      if (!state) {
   10.25          return 1;
   10.26      }
   10.27      for (i = 1; i < argc;) {
   10.28          int consumed;
   10.29  
   10.30 -        consumed = CommonArg(state, i);
   10.31 +        consumed = SDLTest_CommonArg(state, i);
   10.32          if (consumed == 0) {
   10.33              consumed = -1;
   10.34              if (SDL_strcasecmp(argv[i], "--blend") == 0) {
   10.35 @@ -244,12 +244,12 @@
   10.36          if (consumed < 0) {
   10.37              fprintf(stderr,
   10.38                      "Usage: %s %s [--blend none|blend|add|mod] [--cyclecolor] [--cyclealpha]\n",
   10.39 -                    argv[0], CommonUsage(state));
   10.40 +                    argv[0], SDLTest_CommonUsage(state));
   10.41              return 1;
   10.42          }
   10.43          i += consumed;
   10.44      }
   10.45 -    if (!CommonInit(state)) {
   10.46 +    if (!SDLTest_CommonInit(state)) {
   10.47          return 2;
   10.48      }
   10.49  
   10.50 @@ -271,7 +271,7 @@
   10.51          /* Check for events */
   10.52          ++frames;
   10.53          while (SDL_PollEvent(&event)) {
   10.54 -            CommonEvent(state, &event, &done);
   10.55 +            SDLTest_CommonEvent(state, &event, &done);
   10.56              switch (event.type) {
   10.57              case SDL_MOUSEBUTTONDOWN:
   10.58                  mouse_begin_x = event.button.x;
   10.59 @@ -322,7 +322,7 @@
   10.60          }
   10.61      }
   10.62  
   10.63 -    CommonQuit(state);
   10.64 +    SDLTest_CommonQuit(state);
   10.65  
   10.66      /* Print out some timing information */
   10.67      now = SDL_GetTicks();
    11.1 --- a/test/testrelative.c	Mon Dec 31 10:14:38 2012 -0800
    11.2 +++ b/test/testrelative.c	Mon Dec 31 10:26:38 2012 -0800
    11.3 @@ -16,10 +16,10 @@
    11.4  #include <stdio.h>
    11.5  #include <time.h>
    11.6  
    11.7 -#include "common.h"
    11.8 +#include "SDL_test_common.h"
    11.9  
   11.10  
   11.11 -static CommonState *state;
   11.12 +static SDLTest_CommonState *state;
   11.13  static SDL_Rect rect;
   11.14  
   11.15  static void
   11.16 @@ -37,14 +37,14 @@
   11.17  
   11.18   
   11.19      /* Initialize test framework */
   11.20 -    state = CommonCreateState(argv, SDL_INIT_VIDEO);
   11.21 +    state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
   11.22      if (!state) {
   11.23          return 1;
   11.24      }
   11.25      for (i = 1; i < argc;i++) {
   11.26 -        CommonArg(state, i);
   11.27 +        SDLTest_CommonArg(state, i);
   11.28      }
   11.29 -    if (!CommonInit(state)) {
   11.30 +    if (!SDLTest_CommonInit(state)) {
   11.31          return 2;
   11.32      }
   11.33  
   11.34 @@ -70,7 +70,7 @@
   11.35      while (!done) {
   11.36          /* Check for events */
   11.37          while (SDL_PollEvent(&event)) {
   11.38 -            CommonEvent(state, &event, &done);
   11.39 +            SDLTest_CommonEvent(state, &event, &done);
   11.40              switch(event.type) {
   11.41                  case SDL_MOUSEMOTION:
   11.42                  {
   11.43 @@ -93,7 +93,7 @@
   11.44          }
   11.45      }
   11.46  
   11.47 -    CommonQuit(state);
   11.48 +    SDLTest_CommonQuit(state);
   11.49      return 0;
   11.50  }
   11.51  
    12.1 --- a/test/testrendercopyex.c	Mon Dec 31 10:14:38 2012 -0800
    12.2 +++ b/test/testrendercopyex.c	Mon Dec 31 10:26:38 2012 -0800
    12.3 @@ -15,13 +15,12 @@
    12.4  #include <stdio.h>
    12.5  #include <time.h>
    12.6  
    12.7 -#include "SDL.h"
    12.8 -#include "common.h"
    12.9 +#include "SDL_test_common.h"
   12.10  
   12.11  #define WINDOW_WIDTH    640
   12.12  #define WINDOW_HEIGHT   480
   12.13  
   12.14 -static CommonState *state;
   12.15 +static SDLTest_CommonState *state;
   12.16  
   12.17  typedef struct {
   12.18      SDL_Window *window;
   12.19 @@ -36,7 +35,7 @@
   12.20  static void
   12.21  quit(int rc)
   12.22  {
   12.23 -    CommonQuit(state);
   12.24 +    SDLTest_CommonQuit(state);
   12.25      exit(rc);
   12.26  }
   12.27  
   12.28 @@ -143,21 +142,21 @@
   12.29      Uint32 then, now;
   12.30  
   12.31      /* Initialize test framework */
   12.32 -    state = CommonCreateState(argv, SDL_INIT_VIDEO);
   12.33 +    state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
   12.34      if (!state) {
   12.35          return 1;
   12.36      }
   12.37      for (i = 1; i < argc;) {
   12.38          int consumed;
   12.39  
   12.40 -        consumed = CommonArg(state, i);
   12.41 +        consumed = SDLTest_CommonArg(state, i);
   12.42          if (consumed == 0) {
   12.43 -            fprintf(stderr, "Usage: %s %s\n", argv[0], CommonUsage(state));
   12.44 +            fprintf(stderr, "Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state));
   12.45              return 1;
   12.46          }
   12.47          i += consumed;
   12.48      }
   12.49 -    if (!CommonInit(state)) {
   12.50 +    if (!SDLTest_CommonInit(state)) {
   12.51          quit(2);
   12.52      }
   12.53  
   12.54 @@ -185,7 +184,7 @@
   12.55          /* Check for events */
   12.56          ++frames;
   12.57          while (SDL_PollEvent(&event)) {
   12.58 -            CommonEvent(state, &event, &done);
   12.59 +            SDLTest_CommonEvent(state, &event, &done);
   12.60          }
   12.61          for (i = 0; i < state->num_windows; ++i) {
   12.62              Draw(&drawstates[i]);
    13.1 --- a/test/testrendertarget.c	Mon Dec 31 10:14:38 2012 -0800
    13.2 +++ b/test/testrendertarget.c	Mon Dec 31 10:26:38 2012 -0800
    13.3 @@ -15,13 +15,12 @@
    13.4  #include <stdio.h>
    13.5  #include <time.h>
    13.6  
    13.7 -#include "SDL.h"
    13.8 -#include "common.h"
    13.9 +#include "SDL_test_common.h"
   13.10  
   13.11  #define WINDOW_WIDTH    640
   13.12  #define WINDOW_HEIGHT   480
   13.13  
   13.14 -static CommonState *state;
   13.15 +static SDLTest_CommonState *state;
   13.16  
   13.17  typedef struct {
   13.18      SDL_Window *window;
   13.19 @@ -36,7 +35,7 @@
   13.20  static void
   13.21  quit(int rc)
   13.22  {
   13.23 -    CommonQuit(state);
   13.24 +    SDLTest_CommonQuit(state);
   13.25      exit(rc);
   13.26  }
   13.27  
   13.28 @@ -139,21 +138,21 @@
   13.29      Uint32 then, now;
   13.30  
   13.31      /* Initialize test framework */
   13.32 -    state = CommonCreateState(argv, SDL_INIT_VIDEO);
   13.33 +    state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
   13.34      if (!state) {
   13.35          return 1;
   13.36      }
   13.37      for (i = 1; i < argc;) {
   13.38          int consumed;
   13.39  
   13.40 -        consumed = CommonArg(state, i);
   13.41 +        consumed = SDLTest_CommonArg(state, i);
   13.42          if (consumed == 0) {
   13.43 -            fprintf(stderr, "Usage: %s %s\n", argv[0], CommonUsage(state));
   13.44 +            fprintf(stderr, "Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state));
   13.45              return 1;
   13.46          }
   13.47          i += consumed;
   13.48      }
   13.49 -    if (!CommonInit(state)) {
   13.50 +    if (!SDLTest_CommonInit(state)) {
   13.51          quit(2);
   13.52      }
   13.53  
   13.54 @@ -181,7 +180,7 @@
   13.55          /* Check for events */
   13.56          ++frames;
   13.57          while (SDL_PollEvent(&event)) {
   13.58 -            CommonEvent(state, &event, &done);
   13.59 +            SDLTest_CommonEvent(state, &event, &done);
   13.60          }
   13.61          for (i = 0; i < state->num_windows; ++i) {
   13.62              Draw(&drawstates[i]);
    14.1 --- a/test/testscale.c	Mon Dec 31 10:14:38 2012 -0800
    14.2 +++ b/test/testscale.c	Mon Dec 31 10:26:38 2012 -0800
    14.3 @@ -15,13 +15,12 @@
    14.4  #include <stdio.h>
    14.5  #include <time.h>
    14.6  
    14.7 -#include "SDL.h"
    14.8 -#include "common.h"
    14.9 +#include "SDL_test_common.h"
   14.10  
   14.11  #define WINDOW_WIDTH    640
   14.12  #define WINDOW_HEIGHT   480
   14.13  
   14.14 -static CommonState *state;
   14.15 +static SDLTest_CommonState *state;
   14.16  
   14.17  typedef struct {
   14.18      SDL_Window *window;
   14.19 @@ -36,7 +35,7 @@
   14.20  static void
   14.21  quit(int rc)
   14.22  {
   14.23 -    CommonQuit(state);
   14.24 +    SDLTest_CommonQuit(state);
   14.25      exit(rc);
   14.26  }
   14.27  
   14.28 @@ -131,21 +130,21 @@
   14.29      Uint32 then, now;
   14.30  
   14.31      /* Initialize test framework */
   14.32 -    state = CommonCreateState(argv, SDL_INIT_VIDEO);
   14.33 +    state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
   14.34      if (!state) {
   14.35          return 1;
   14.36      }
   14.37      for (i = 1; i < argc;) {
   14.38          int consumed;
   14.39  
   14.40 -        consumed = CommonArg(state, i);
   14.41 +        consumed = SDLTest_CommonArg(state, i);
   14.42          if (consumed == 0) {
   14.43 -            fprintf(stderr, "Usage: %s %s\n", argv[0], CommonUsage(state));
   14.44 +            fprintf(stderr, "Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state));
   14.45              return 1;
   14.46          }
   14.47          i += consumed;
   14.48      }
   14.49 -    if (!CommonInit(state)) {
   14.50 +    if (!SDLTest_CommonInit(state)) {
   14.51          quit(2);
   14.52      }
   14.53  
   14.54 @@ -173,7 +172,7 @@
   14.55          /* Check for events */
   14.56          ++frames;
   14.57          while (SDL_PollEvent(&event)) {
   14.58 -            CommonEvent(state, &event, &done);
   14.59 +            SDLTest_CommonEvent(state, &event, &done);
   14.60          }
   14.61          for (i = 0; i < state->num_windows; ++i) {
   14.62              Draw(&drawstates[i]);
    15.1 --- a/test/testsprite2.c	Mon Dec 31 10:14:38 2012 -0800
    15.2 +++ b/test/testsprite2.c	Mon Dec 31 10:26:38 2012 -0800
    15.3 @@ -15,12 +15,12 @@
    15.4  #include <stdio.h>
    15.5  #include <time.h>
    15.6  
    15.7 -#include "common.h"
    15.8 +#include "SDL_test_common.h"
    15.9  
   15.10  #define NUM_SPRITES    100
   15.11  #define MAX_SPEED     1
   15.12  
   15.13 -static CommonState *state;
   15.14 +static SDLTest_CommonState *state;
   15.15  static int num_sprites;
   15.16  static SDL_Texture **sprites;
   15.17  static SDL_bool cycle_color;
   15.18 @@ -46,7 +46,7 @@
   15.19      if (velocities) {
   15.20          SDL_free(velocities);
   15.21      }
   15.22 -    CommonQuit(state);
   15.23 +    SDLTest_CommonQuit(state);
   15.24      exit(rc);
   15.25  }
   15.26  
   15.27 @@ -226,7 +226,7 @@
   15.28      num_sprites = NUM_SPRITES;
   15.29  
   15.30      /* Initialize test framework */
   15.31 -    state = CommonCreateState(argv, SDL_INIT_VIDEO);
   15.32 +    state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
   15.33      if (!state) {
   15.34          return 1;
   15.35      }
   15.36 @@ -236,7 +236,7 @@
   15.37      for (i = 1; i < argc;) {
   15.38          int consumed;
   15.39  
   15.40 -        consumed = CommonArg(state, i);
   15.41 +        consumed = SDLTest_CommonArg(state, i);
   15.42          if (consumed == 0) {
   15.43              consumed = -1;
   15.44              if (SDL_strcasecmp(argv[i], "--blend") == 0) {
   15.45 @@ -269,12 +269,12 @@
   15.46          if (consumed < 0) {
   15.47              fprintf(stderr,
   15.48                      "Usage: %s %s [--blend none|blend|add|mod] [--cyclecolor] [--cyclealpha]\n",
   15.49 -                    argv[0], CommonUsage(state));
   15.50 +                    argv[0], SDLTest_CommonUsage(state));
   15.51              quit(1);
   15.52          }
   15.53          i += consumed;
   15.54      }
   15.55 -    if (!CommonInit(state)) {
   15.56 +    if (!SDLTest_CommonInit(state)) {
   15.57          quit(2);
   15.58      }
   15.59  
   15.60 @@ -323,7 +323,7 @@
   15.61          /* Check for events */
   15.62          ++frames;
   15.63          while (SDL_PollEvent(&event)) {
   15.64 -            CommonEvent(state, &event, &done);
   15.65 +            SDLTest_CommonEvent(state, &event, &done);
   15.66          }
   15.67          for (i = 0; i < state->num_windows; ++i) {
   15.68              MoveSprites(state->renderers[i], sprites[i]);
    16.1 --- a/test/testwm2.c	Mon Dec 31 10:14:38 2012 -0800
    16.2 +++ b/test/testwm2.c	Mon Dec 31 10:26:38 2012 -0800
    16.3 @@ -13,15 +13,15 @@
    16.4  #include <stdlib.h>
    16.5  #include <stdio.h>
    16.6  
    16.7 -#include "common.h"
    16.8 +#include "SDL_test_common.h"
    16.9  
   16.10 -static CommonState *state;
   16.11 +static SDLTest_CommonState *state;
   16.12  
   16.13  /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
   16.14  static void
   16.15  quit(int rc)
   16.16  {
   16.17 -    CommonQuit(state);
   16.18 +    SDLTest_CommonQuit(state);
   16.19      exit(rc);
   16.20  }
   16.21  
   16.22 @@ -50,7 +50,7 @@
   16.23      SDL_Cursor *cursor = NULL;
   16.24  
   16.25      /* Initialize test framework */
   16.26 -    state = CommonCreateState(argv, SDL_INIT_VIDEO);
   16.27 +    state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
   16.28      if (!state) {
   16.29          return 1;
   16.30      }
   16.31 @@ -58,17 +58,17 @@
   16.32      for (i = 1; i < argc;) {
   16.33          int consumed;
   16.34  
   16.35 -        consumed = CommonArg(state, i);
   16.36 +        consumed = SDLTest_CommonArg(state, i);
   16.37          if (consumed == 0) {
   16.38              consumed = -1;
   16.39          }
   16.40          if (consumed < 0) {
   16.41 -            fprintf(stderr, "Usage: %s %s\n", argv[0], CommonUsage(state));
   16.42 +            fprintf(stderr, "Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state));
   16.43              quit(1);
   16.44          }
   16.45          i += consumed;
   16.46      }
   16.47 -    if (!CommonInit(state)) {
   16.48 +    if (!SDLTest_CommonInit(state)) {
   16.49          quit(2);
   16.50      }
   16.51  
   16.52 @@ -77,7 +77,7 @@
   16.53      while (!done) {
   16.54          /* Check for events */
   16.55          while (SDL_PollEvent(&event)) {
   16.56 -            CommonEvent(state, &event, &done);
   16.57 +            SDLTest_CommonEvent(state, &event, &done);
   16.58  
   16.59              if (event.type == SDL_WINDOWEVENT) {
   16.60                  if (event.window.event == SDL_WINDOWEVENT_MOVED) {