Mercurial > sdl-ios-xcode
annotate test/automated/testsdl.c @ 3463:06c66b8d5033
Output last SDL error in case of test was failed.
author | Mike Gorchak <lestat@i.com.ua> |
---|---|
date | Fri, 20 Nov 2009 07:08:28 +0000 |
parents | ba48701b0534 |
children | 78db4f7ae2f3 |
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 |
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
|
19 #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
|
20 #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
|
21 #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
|
22 |
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 #include <stdio.h> /* printf */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 #include <stdlib.h> /* exit */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 #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
|
26 #include <string.h> /* strcmp */ |
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
|
27 #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
|
28 #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
|
29 #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
|
30 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 /* |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 * Tests to run. |
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 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
|
36 /* Manual. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 /* Automatic. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 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
|
39 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
|
40 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
|
41 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
|
42 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
|
43 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 /* |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 * Prototypes. |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 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
|
48 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
|
49 |
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 /** |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 * @brief Displays program usage. |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 */ |
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
|
54 #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
|
55 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
|
56 { |
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
|
57 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
|
58 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
|
59 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
|
60 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
|
61 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
|
62 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
|
63 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
|
64 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
|
65 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
|
66 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
|
67 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
|
68 } |
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 #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
|
70 |
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 #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
|
72 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
|
73 { |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 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
|
75 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
|
76 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
|
77 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
|
78 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
|
79 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
|
80 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
|
81 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
|
82 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
|
83 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
|
84 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
|
85 } |
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
|
86 #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
|
87 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 /** |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 * @brief Handles the options. |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 */ |
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
|
91 #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
|
92 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
|
93 { |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 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
|
95 { "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
|
96 { "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
|
97 { "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
|
98 { "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
|
99 { "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
|
100 { "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
|
101 { "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
|
102 { "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
|
103 { "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
|
104 {NULL,0,0,0} |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 }; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 int option_index = 0; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 int c = 0; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 int i; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 const char *str; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 /* Iterate over options. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 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
|
113 "mposravqh", |
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 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
|
115 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 /* Handle options. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 switch (c) { |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 case 0: |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 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
|
120 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
|
121 run_platform = 0; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 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
|
123 run_rwops = 0; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 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
|
125 run_surface = 0; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 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
|
127 run_render = 0; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 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
|
129 run_audio = 0; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 break; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 /* Manual. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 case 'm': |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 run_manual = 1; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 break; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 |
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
|
137 /* 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
|
138 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
|
139 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
|
140 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
|
141 |
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
|
142 /* 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
|
143 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
|
144 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
|
145 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
|
146 |
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
|
147 /* 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
|
148 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
|
149 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
|
150 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
|
151 |
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 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
|
153 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
|
154 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
|
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 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
|
158 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
|
159 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
|
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 |
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 /* Verbosity. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 case 'v': |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 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
|
165 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
|
166 break; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
168 /* Quiet. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 case 'q': |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 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
|
171 break; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
173 /* Help. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 case 'h': |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 print_usage( argv[0] ); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 exit(EXIT_SUCCESS); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 } |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 } |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
179 } |
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
|
180 #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
|
181 |
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
|
182 #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
|
183 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
|
184 { |
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
|
185 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
|
186 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
|
187 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
|
188 |
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
|
189 /* 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
|
190 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
|
191 /* 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
|
192 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
|
193 /* 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
|
194 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
|
195 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
|
196 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
|
197 |
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 /* 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
|
199 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
|
200 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
|
201 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
|
202 |
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 /* 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
|
204 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
|
205 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
|
206 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
|
207 |
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 /* 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
|
209 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
|
210 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
|
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 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
|
214 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
|
215 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
|
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 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
|
219 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
|
220 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
|
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 /* 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
|
224 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
|
225 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
|
226 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
|
227 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
|
228 |
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 /* 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
|
230 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
|
231 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
|
232 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
|
233 |
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 /* 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
|
235 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
|
236 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
|
237 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
|
238 } |
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 } |
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 } |
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 #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
|
242 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
243 /** |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
244 * @brief Main entry point. |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
245 */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
246 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
|
247 { |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
248 int failed; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
249 int rev; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
250 SDL_version ver; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
251 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
252 /* Get options. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
253 parse_options( argc, argv ); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
254 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
255 /* Defaults. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
256 failed = 0; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
257 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
258 /* 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
|
259 SDL_GetVersion( &ver ); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 rev = SDL_GetRevision(); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
261 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
|
262 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
|
263 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
264 /* Automatic tests. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
265 if (run_platform) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
266 failed += test_platform(); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
267 if (run_rwops) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
268 failed += test_rwops(); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
269 if (run_surface) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
270 failed += test_surface(); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 if (run_render) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 failed += test_render(); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
273 if (run_audio) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
274 failed += test_audio(); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
275 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
276 /* Manual tests. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
277 if (run_manual) { |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
278 } |
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 /* 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
|
281 if (failed > 0) { |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
282 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
|
283 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
|
284 SDL_ATprintErr( "System is running %s and is %s endian\n", |
3319 | 285 SDL_GetPlatform(), |
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
286 #ifdef SDL_LIL_ENDIAN |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
287 "little" |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
288 #else |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
289 "big" |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
290 #endif |
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 } |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
294 return failed; |
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 |