annotate test/testplatform.c @ 1662:782fd950bd46 SDL-1.3

Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API. WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid. The code is now run through a consistent indent format: indent -i4 -nut -nsc -br -ce The headers are being converted to automatically generate doxygen documentation.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 28 May 2006 13:04:16 +0000
parents f12379c41042
children 4da1ee79c9af
rev   line source
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 #include <stdio.h>
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4 #include "SDL.h"
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 #include "SDL_endian.h"
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 #include "SDL_cpuinfo.h"
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 /*
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9 * Watcom C flags these as Warning 201: "Unreachable code" if you just
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 * compare them directly, so we push it through a function to keep the
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 * compiler quiet. --ryan.
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 */
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
13 static int
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
14 badsize (size_t sizeoftype, size_t hardcodetype)
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 {
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 return sizeoftype != hardcodetype;
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 }
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
19 int
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
20 TestTypes (SDL_bool verbose)
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
22 int error = 0;
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
24 if (badsize (sizeof (Uint8), 1)) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
25 if (verbose)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
26 printf ("sizeof(Uint8) != 1, instead = %ul\n", sizeof (Uint8));
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
27 ++error;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
28 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
29 if (badsize (sizeof (Uint16), 2)) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
30 if (verbose)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
31 printf ("sizeof(Uint16) != 2, instead = %ul\n", sizeof (Uint16));
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
32 ++error;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
33 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
34 if (badsize (sizeof (Uint32), 4)) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
35 if (verbose)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
36 printf ("sizeof(Uint32) != 4, instead = %ul\n", sizeof (Uint32));
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
37 ++error;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
38 }
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 #ifdef SDL_HAS_64BIT_TYPE
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
40 if (badsize (sizeof (Uint64), 8)) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
41 if (verbose)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
42 printf ("sizeof(Uint64) != 8, instead = %ul\n", sizeof (Uint64));
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
43 ++error;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
44 }
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 #else
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
46 if (verbose) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
47 printf ("WARNING: No 64-bit datatype on this platform\n");
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
48 }
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 #endif
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
50 if (verbose && !error)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
51 printf ("All data types are the expected size.\n");
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
53 return (error ? 1 : 0);
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 }
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
56 int
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
57 TestEndian (SDL_bool verbose)
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
59 int error = 0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
60 Uint16 value = 0x1234;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
61 int real_byteorder;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
62 Uint16 value16 = 0xCDAB;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
63 Uint16 swapped16 = 0xABCD;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
64 Uint32 value32 = 0xEFBEADDE;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
65 Uint32 swapped32 = 0xDEADBEEF;
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 #ifdef SDL_HAS_64BIT_TYPE
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
67 Uint64 value64, swapped64;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
68 value64 = 0xEFBEADDE;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
69 value64 <<= 32;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
70 value64 |= 0xCDAB3412;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
71 swapped64 = 0x1234ABCD;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
72 swapped64 <<= 32;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
73 swapped64 |= 0xDEADBEEF;
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 #endif
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
76 if (verbose) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
77 printf ("Detected a %s endian machine.\n",
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
78 (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? "little" : "big");
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
79 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
80 if ((*((char *) &value) >> 4) == 0x1) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
81 real_byteorder = SDL_BIG_ENDIAN;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
82 } else {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
83 real_byteorder = SDL_LIL_ENDIAN;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
84 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
85 if (real_byteorder != SDL_BYTEORDER) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
86 if (verbose) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
87 printf ("Actually a %s endian machine!\n",
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
88 (real_byteorder == SDL_LIL_ENDIAN) ? "little" : "big");
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
89 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
90 ++error;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
91 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
92 if (verbose) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
93 printf ("Value 16 = 0x%X, swapped = 0x%X\n", value16,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
94 SDL_Swap16 (value16));
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
95 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
96 if (SDL_Swap16 (value16) != swapped16) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
97 if (verbose) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
98 printf ("16 bit value swapped incorrectly!\n");
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
99 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
100 ++error;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
101 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
102 if (verbose) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
103 printf ("Value 32 = 0x%X, swapped = 0x%X\n", value32,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
104 SDL_Swap32 (value32));
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
105 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
106 if (SDL_Swap32 (value32) != swapped32) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
107 if (verbose) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
108 printf ("32 bit value swapped incorrectly!\n");
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
109 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
110 ++error;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
111 }
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112 #ifdef SDL_HAS_64BIT_TYPE
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
113 if (verbose) {
1615
d5298e8f22b3 Ugh, more 64-bit cleanup
Sam Lantinga <slouken@libsdl.org>
parents: 1424
diff changeset
114 #ifdef _MSC_VER
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
115 printf ("Value 64 = 0x%I64X, swapped = 0x%I64X\n", value64,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
116 SDL_Swap64 (value64));
1615
d5298e8f22b3 Ugh, more 64-bit cleanup
Sam Lantinga <slouken@libsdl.org>
parents: 1424
diff changeset
117 #else
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
118 printf ("Value 64 = 0x%llX, swapped = 0x%llX\n", value64,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
119 SDL_Swap64 (value64));
1615
d5298e8f22b3 Ugh, more 64-bit cleanup
Sam Lantinga <slouken@libsdl.org>
parents: 1424
diff changeset
120 #endif
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
121 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
122 if (SDL_Swap64 (value64) != swapped64) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
123 if (verbose) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
124 printf ("64 bit value swapped incorrectly!\n");
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
125 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
126 ++error;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
127 }
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 #endif
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
129 return (error ? 1 : 0);
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130 }
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
131
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
133 int
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
134 TestCPUInfo (SDL_bool verbose)
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
136 if (verbose) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
137 printf ("RDTSC %s\n", SDL_HasRDTSC ()? "detected" : "not detected");
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
138 printf ("MMX %s\n", SDL_HasMMX ()? "detected" : "not detected");
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
139 printf ("MMX Ext %s\n",
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
140 SDL_HasMMXExt ()? "detected" : "not detected");
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
141 printf ("3DNow %s\n", SDL_Has3DNow ()? "detected" : "not detected");
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
142 printf ("3DNow Ext %s\n",
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
143 SDL_Has3DNowExt ()? "detected" : "not detected");
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
144 printf ("SSE %s\n", SDL_HasSSE ()? "detected" : "not detected");
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
145 printf ("SSE2 %s\n", SDL_HasSSE2 ()? "detected" : "not detected");
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
146 printf ("AltiVec %s\n",
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
147 SDL_HasAltiVec ()? "detected" : "not detected");
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
148 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
149 return (0);
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150 }
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
152 int
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
153 main (int argc, char *argv[])
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
155 SDL_bool verbose = SDL_TRUE;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
156 int status = 0;
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
158 if (argv[1] && (SDL_strcmp (argv[1], "-q") == 0)) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
159 verbose = SDL_FALSE;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
160 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
161 if (verbose) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
162 printf ("This system is running %s\n",
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 #if __AIX__
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
164 "AIX"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165 #elif __AMIGA__
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
166 "AmigaOS"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 #elif __BEOS__
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
168 "BeOS"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 #elif __BSDI__
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
170 "BSDI"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171 #elif __DREAMCAST__
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
172 "Dreamcast"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173 #elif __FREEBSD__
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
174 "FreeBSD"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
175 #elif __HPUX__
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
176 "HP-UX"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
177 #elif __IRIX__
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
178 "Irix"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
179 #elif __LINUX__
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
180 "Linux"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
181 #elif __MINT__
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
182 "Atari MiNT"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
183 #elif __MACOS__
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
184 "MacOS Classic"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
185 #elif __MACOSX__
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
186 "Mac OS X"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
187 #elif __NETBSD__
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
188 "NetBSD"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
189 #elif __OPENBSD__
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
190 "OpenBSD"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
191 #elif __OS2__
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
192 "OS/2"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
193 #elif __OSF__
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
194 "OSF/1"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
195 #elif __QNXNTO__
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
196 "QNX Neutrino"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
197 #elif __RISCOS__
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
198 "RISC OS"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
199 #elif __SOLARIS__
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
200 "Solaris"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
201 #elif __WIN32__
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
202 #ifdef _WIN32_WCE
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
203 "Windows CE"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
204 #else
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
205 "Windows"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206 #endif
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
207 #else
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
208 "an unknown operating system! (see SDL_platform.h)"
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
209 #endif
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
210 );
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
211 }
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
212
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
213 status += TestTypes (verbose);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
214 status += TestEndian (verbose);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
215 status += TestCPUInfo (verbose);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1621
diff changeset
216 return status;
1421
638da75f9ab8 testplatform replaces testtypes, testendian, and testcpuinfo
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
217 }