Mercurial > sdl-ios-xcode
annotate test/automated/testsdl.c @ 3482:78db4f7ae2f3
More fixes to compile under Visual C++
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 22 Nov 2009 07:00:26 +0000 |
parents | ba48701b0534 |
children | 0c429a5fda8a |
rev | line source |
---|---|
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 * SDL test suite framework code. |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3 * |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 * Written by Edgar Simo "bobbens" |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 * |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 * Released under Public Domain. |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 #include "SDL.h" |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 #include "SDL_at.h" |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 #include "platform/platform.h" |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 #include "rwops/rwops.h" |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 #include "surface/surface.h" |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 #include "render/render.h" |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 #include "audio/audio.h" |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
3482
78db4f7ae2f3
More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents:
3460
diff
changeset
|
19 #if defined(WIN32) |
78db4f7ae2f3
More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents:
3460
diff
changeset
|
20 #define NO_GETOPT |
78db4f7ae2f3
More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents:
3460
diff
changeset
|
21 #endif |
3460
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
22 #if defined(__QNXNTO__) |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
23 #define NO_GETOPT_LONG 1 |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
24 #endif /* __QNXNTO__ */ |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
25 |
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 #include <stdio.h> /* printf */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 #include <stdlib.h> /* exit */ |
3482
78db4f7ae2f3
More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents:
3460
diff
changeset
|
28 #ifndef NO_GETOPT |
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 #include <unistd.h> /* getopt */ |
3460
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
30 #if !defined(NO_GETOPT_LONG) |
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 #include <getopt.h> /* getopt_long */ |
3460
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
32 #endif /* !NO_GETOPT_LONG */ |
3482
78db4f7ae2f3
More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents:
3460
diff
changeset
|
33 #endif /* !NO_GETOPT */ |
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 /* |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 * Tests to run. |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 static int run_manual = 0; /**< Run manual tests. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
40 /* Manual. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 /* Automatic. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 static int run_platform = 1; /**< Run platform tests. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 static int run_rwops = 1; /**< Run RWops tests. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 static int run_surface = 1; /**< Run surface tests. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 static int run_render = 1; /**< Run render tests. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 static int run_audio = 1; /**< Run audio tests. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 /* |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 * Prototypes. |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 static void print_usage( const char *name ); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 static void parse_options( int argc, char *argv[] ); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 /** |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 * @brief Displays program usage. |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 */ |
3482
78db4f7ae2f3
More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents:
3460
diff
changeset
|
58 #ifdef NO_GETOPT |
78db4f7ae2f3
More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents:
3460
diff
changeset
|
59 static void print_usage( const char *name ) |
78db4f7ae2f3
More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents:
3460
diff
changeset
|
60 { |
78db4f7ae2f3
More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents:
3460
diff
changeset
|
61 } |
78db4f7ae2f3
More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents:
3460
diff
changeset
|
62 #else |
3460
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
63 #if !defined(NO_GETOPT_LONG) |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
64 static void print_usage( const char *name ) |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
65 { |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
66 printf("Usage: %s [OPTIONS]\n", name); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
67 printf("Options are:\n"); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
68 printf(" -m, --manual enables tests that require user interaction\n"); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
69 printf(" -p, --noplatform do not run the platform tests\n"); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
70 printf(" -o, --norwops do not run the rwops tests\n"); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
71 printf(" -s, --nosurface do not run the surface tests\n"); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
72 printf(" -r, --norender do not run the render tests\n"); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
73 printf(" -a, --noaudio do not run the audio tests\n"); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
74 printf(" -v, --verbose increases verbosity level by 1 for each -v\n"); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
75 printf(" -q, --quiet only displays errors\n"); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
76 printf(" -h, --help display this message and exit\n"); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
77 } |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
78 #endif /* !NO_GETOPT_LONG */ |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
79 |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
80 #if defined(NO_GETOPT_LONG) |
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 static void print_usage( const char *name ) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 { |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 printf("Usage: %s [OPTIONS]\n", name); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 printf("Options are:\n"); |
3460
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
85 printf(" -m, enables tests that require user interaction\n"); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
86 printf(" -p, do not run the platform tests\n"); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
87 printf(" -o, do not run the rwops tests\n"); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
88 printf(" -s, do not run the surface tests\n"); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
89 printf(" -r, do not run the render tests\n"); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
90 printf(" -a, do not run the audio tests\n"); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
91 printf(" -v, increases verbosity level by 1 for each -v\n"); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
92 printf(" -q, only displays errors\n"); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
93 printf(" -h, display this message and exit\n"); |
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 } |
3460
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
95 #endif /* NO_GETOPT_LONG */ |
3482
78db4f7ae2f3
More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents:
3460
diff
changeset
|
96 #endif /* NO_GETOPT */ |
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 /** |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
99 * @brief Handles the options. |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 */ |
3482
78db4f7ae2f3
More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents:
3460
diff
changeset
|
101 #ifdef NO_GETOPT |
78db4f7ae2f3
More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents:
3460
diff
changeset
|
102 static void parse_options( int argc, char *argv[] ) |
78db4f7ae2f3
More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents:
3460
diff
changeset
|
103 { |
78db4f7ae2f3
More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents:
3460
diff
changeset
|
104 } |
78db4f7ae2f3
More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents:
3460
diff
changeset
|
105 #else |
3460
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
106 #if !defined(NO_GETOPT_LONG) |
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 static void parse_options( int argc, char *argv[] ) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 { |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 static struct option long_options[] = { |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 { "manual", no_argument, 0, 'm' }, |
3460
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
111 { "noplatform", no_argument, 0, 'p' }, |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
112 { "norwops", no_argument, 0, 'o' }, |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
113 { "nosurface", no_argument, 0, 's' }, |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
114 { "norender", no_argument, 0, 'r' }, |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
115 { "noaudio", no_argument, 0, 'a' }, |
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 { "verbose", no_argument, 0, 'v' }, |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 { "quiet", no_argument, 0, 'q' }, |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 { "help", no_argument, 0, 'h' }, |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 {NULL,0,0,0} |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 }; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 int option_index = 0; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 int c = 0; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 int i; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 const char *str; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 /* Iterate over options. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 while ((c = getopt_long( argc, argv, |
3460
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
128 "mposravqh", |
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 long_options, &option_index)) != -1) { |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 /* Handle options. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 switch (c) { |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 case 0: |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 str = long_options[option_index].name; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 if (strcmp(str,"noplatform")==0) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 run_platform = 0; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 else if (strcmp(str,"norwops")==0) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 run_rwops = 0; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 else if (strcmp(str,"nosurface")==0) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 run_surface = 0; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 else if (strcmp(str,"norender")==0) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 run_render = 0; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 else if (strcmp(str,"noaudio")==0) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 run_audio = 0; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 break; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 /* Manual. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 case 'm': |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 run_manual = 1; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 break; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 |
3460
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
152 /* No platform. */ |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
153 case 'p': |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
154 run_platform = 0; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
155 break; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
156 |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
157 /* No rwops. */ |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
158 case 'o': |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
159 run_rwops = 0; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
160 break; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
161 |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
162 /* No surface. */ |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
163 case 's': |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
164 run_surface = 0; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
165 break; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
166 |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
167 /* No render. */ |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
168 case 'r': |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
169 run_render = 0; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
170 break; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
171 |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
172 /* No audio. */ |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
173 case 'a': |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
174 run_audio = 0; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
175 break; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
176 |
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 /* Verbosity. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 case 'v': |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
179 SDL_ATgeti( SDL_AT_VERBOSE, &i ); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
180 SDL_ATseti( SDL_AT_VERBOSE, i+1 ); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
181 break; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
182 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
183 /* Quiet. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 case 'q': |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
185 SDL_ATseti( SDL_AT_QUIET, 1 ); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
186 break; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
187 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
188 /* Help. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
189 case 'h': |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
190 print_usage( argv[0] ); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 exit(EXIT_SUCCESS); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
192 } |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
193 } |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 } |
3460
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
195 #endif /* !NO_GETOPT_LONG */ |
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
196 |
3460
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
197 #if defined(NO_GETOPT_LONG) |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
198 static void parse_options( int argc, char *argv[] ) |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
199 { |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
200 static char* short_options="mposravqh"; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
201 int c = 0; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
202 int i; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
203 |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
204 /* Iterate over options. */ |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
205 while ((c = getopt(argc, argv, short_options)) != -1) { |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
206 /* Handle options. */ |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
207 switch (c) { |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
208 /* Manual. */ |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
209 case 'm': |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
210 run_manual = 1; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
211 break; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
212 |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
213 /* No platform. */ |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
214 case 'p': |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
215 run_platform = 0; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
216 break; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
217 |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
218 /* No rwops. */ |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
219 case 'o': |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
220 run_rwops = 0; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
221 break; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
222 |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
223 /* No surface. */ |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
224 case 's': |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
225 run_surface = 0; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
226 break; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
227 |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
228 /* No render. */ |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
229 case 'r': |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
230 run_render = 0; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
231 break; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
232 |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
233 /* No audio. */ |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
234 case 'a': |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
235 run_audio = 0; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
236 break; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
237 |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
238 /* Verbosity. */ |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
239 case 'v': |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
240 SDL_ATgeti( SDL_AT_VERBOSE, &i ); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
241 SDL_ATseti( SDL_AT_VERBOSE, i+1 ); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
242 break; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
243 |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
244 /* Quiet. */ |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
245 case 'q': |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
246 SDL_ATseti( SDL_AT_QUIET, 1 ); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
247 break; |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
248 |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
249 /* Help. */ |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
250 case 'h': |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
251 print_usage( argv[0] ); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
252 exit(EXIT_SUCCESS); |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
253 } |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
254 } |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
255 } |
ba48701b0534
Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents:
3319
diff
changeset
|
256 #endif /* NO_GETOPT_LONG */ |
3482
78db4f7ae2f3
More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents:
3460
diff
changeset
|
257 #endif /* NO_GETOPT */ |
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
258 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
259 /** |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 * @brief Main entry point. |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
261 */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
262 int main( int argc, char *argv[] ) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
263 { |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
264 int failed; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
265 int rev; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
266 SDL_version ver; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
267 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
268 /* Get options. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
269 parse_options( argc, argv ); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
270 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 /* Defaults. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 failed = 0; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
273 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
274 /* Print some text if verbose. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
275 SDL_GetVersion( &ver ); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
276 rev = SDL_GetRevision(); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
277 SDL_ATprintVerbose( 1, "Running tests with SDL %d.%d.%d revision %d\n", |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
278 ver.major, ver.minor, ver.patch, rev ); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
279 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
280 /* Automatic tests. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
281 if (run_platform) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
282 failed += test_platform(); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
283 if (run_rwops) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
284 failed += test_rwops(); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
285 if (run_surface) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
286 failed += test_surface(); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
287 if (run_render) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
288 failed += test_render(); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
289 if (run_audio) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
290 failed += test_audio(); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
291 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
292 /* Manual tests. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 if (run_manual) { |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
294 } |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
295 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
296 /* Display more information if failed. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
297 if (failed > 0) { |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
298 SDL_ATprintErr( "Tests run with SDL %d.%d.%d revision %d\n", |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
299 ver.major, ver.minor, ver.patch, rev ); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
300 SDL_ATprintErr( "System is running %s and is %s endian\n", |
3319 | 301 SDL_GetPlatform(), |
3482
78db4f7ae2f3
More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents:
3460
diff
changeset
|
302 #if SDL_BYTEORDER == SDL_LIL_ENDIAN |
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
303 "little" |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
304 #else |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
305 "big" |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
306 #endif |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
307 ); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
308 } |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
309 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
310 return failed; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
311 } |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
312 |