test/testplatform.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
     1.1 --- a/test/testplatform.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/test/testplatform.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -11,50 +11,50 @@
     1.4   *  compiler quiet.  --ryan.
     1.5   */
     1.6  static int
     1.7 -badsize (size_t sizeoftype, size_t hardcodetype)
     1.8 +badsize(size_t sizeoftype, size_t hardcodetype)
     1.9  {
    1.10      return sizeoftype != hardcodetype;
    1.11  }
    1.12  
    1.13  int
    1.14 -TestTypes (SDL_bool verbose)
    1.15 +TestTypes(SDL_bool verbose)
    1.16  {
    1.17      int error = 0;
    1.18  
    1.19 -    if (badsize (sizeof (Uint8), 1)) {
    1.20 +    if (badsize(sizeof(Uint8), 1)) {
    1.21          if (verbose)
    1.22 -            printf ("sizeof(Uint8) != 1, instead = %ul\n", sizeof (Uint8));
    1.23 +            printf("sizeof(Uint8) != 1, instead = %ul\n", sizeof(Uint8));
    1.24          ++error;
    1.25      }
    1.26 -    if (badsize (sizeof (Uint16), 2)) {
    1.27 +    if (badsize(sizeof(Uint16), 2)) {
    1.28          if (verbose)
    1.29 -            printf ("sizeof(Uint16) != 2, instead = %ul\n", sizeof (Uint16));
    1.30 +            printf("sizeof(Uint16) != 2, instead = %ul\n", sizeof(Uint16));
    1.31          ++error;
    1.32      }
    1.33 -    if (badsize (sizeof (Uint32), 4)) {
    1.34 +    if (badsize(sizeof(Uint32), 4)) {
    1.35          if (verbose)
    1.36 -            printf ("sizeof(Uint32) != 4, instead = %ul\n", sizeof (Uint32));
    1.37 +            printf("sizeof(Uint32) != 4, instead = %ul\n", sizeof(Uint32));
    1.38          ++error;
    1.39      }
    1.40  #ifdef SDL_HAS_64BIT_TYPE
    1.41 -    if (badsize (sizeof (Uint64), 8)) {
    1.42 +    if (badsize(sizeof(Uint64), 8)) {
    1.43          if (verbose)
    1.44 -            printf ("sizeof(Uint64) != 8, instead = %ul\n", sizeof (Uint64));
    1.45 +            printf("sizeof(Uint64) != 8, instead = %ul\n", sizeof(Uint64));
    1.46          ++error;
    1.47      }
    1.48  #else
    1.49      if (verbose) {
    1.50 -        printf ("WARNING: No 64-bit datatype on this platform\n");
    1.51 +        printf("WARNING: No 64-bit datatype on this platform\n");
    1.52      }
    1.53  #endif
    1.54      if (verbose && !error)
    1.55 -        printf ("All data types are the expected size.\n");
    1.56 +        printf("All data types are the expected size.\n");
    1.57  
    1.58      return (error ? 1 : 0);
    1.59  }
    1.60  
    1.61  int
    1.62 -TestEndian (SDL_bool verbose)
    1.63 +TestEndian(SDL_bool verbose)
    1.64  {
    1.65      int error = 0;
    1.66      Uint16 value = 0x1234;
    1.67 @@ -74,8 +74,8 @@
    1.68  #endif
    1.69  
    1.70      if (verbose) {
    1.71 -        printf ("Detected a %s endian machine.\n",
    1.72 -                (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? "little" : "big");
    1.73 +        printf("Detected a %s endian machine.\n",
    1.74 +               (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? "little" : "big");
    1.75      }
    1.76      if ((*((char *) &value) >> 4) == 0x1) {
    1.77          real_byteorder = SDL_BIG_ENDIAN;
    1.78 @@ -84,44 +84,44 @@
    1.79      }
    1.80      if (real_byteorder != SDL_BYTEORDER) {
    1.81          if (verbose) {
    1.82 -            printf ("Actually a %s endian machine!\n",
    1.83 -                    (real_byteorder == SDL_LIL_ENDIAN) ? "little" : "big");
    1.84 +            printf("Actually a %s endian machine!\n",
    1.85 +                   (real_byteorder == SDL_LIL_ENDIAN) ? "little" : "big");
    1.86          }
    1.87          ++error;
    1.88      }
    1.89      if (verbose) {
    1.90 -        printf ("Value 16 = 0x%X, swapped = 0x%X\n", value16,
    1.91 -                SDL_Swap16 (value16));
    1.92 +        printf("Value 16 = 0x%X, swapped = 0x%X\n", value16,
    1.93 +               SDL_Swap16(value16));
    1.94      }
    1.95 -    if (SDL_Swap16 (value16) != swapped16) {
    1.96 +    if (SDL_Swap16(value16) != swapped16) {
    1.97          if (verbose) {
    1.98 -            printf ("16 bit value swapped incorrectly!\n");
    1.99 +            printf("16 bit value swapped incorrectly!\n");
   1.100          }
   1.101          ++error;
   1.102      }
   1.103      if (verbose) {
   1.104 -        printf ("Value 32 = 0x%X, swapped = 0x%X\n", value32,
   1.105 -                SDL_Swap32 (value32));
   1.106 +        printf("Value 32 = 0x%X, swapped = 0x%X\n", value32,
   1.107 +               SDL_Swap32(value32));
   1.108      }
   1.109 -    if (SDL_Swap32 (value32) != swapped32) {
   1.110 +    if (SDL_Swap32(value32) != swapped32) {
   1.111          if (verbose) {
   1.112 -            printf ("32 bit value swapped incorrectly!\n");
   1.113 +            printf("32 bit value swapped incorrectly!\n");
   1.114          }
   1.115          ++error;
   1.116      }
   1.117  #ifdef SDL_HAS_64BIT_TYPE
   1.118      if (verbose) {
   1.119  #ifdef _MSC_VER
   1.120 -        printf ("Value 64 = 0x%I64X, swapped = 0x%I64X\n", value64,
   1.121 -                SDL_Swap64 (value64));
   1.122 +        printf("Value 64 = 0x%I64X, swapped = 0x%I64X\n", value64,
   1.123 +               SDL_Swap64(value64));
   1.124  #else
   1.125 -        printf ("Value 64 = 0x%llX, swapped = 0x%llX\n", value64,
   1.126 -                SDL_Swap64 (value64));
   1.127 +        printf("Value 64 = 0x%llX, swapped = 0x%llX\n", value64,
   1.128 +               SDL_Swap64(value64));
   1.129  #endif
   1.130      }
   1.131 -    if (SDL_Swap64 (value64) != swapped64) {
   1.132 +    if (SDL_Swap64(value64) != swapped64) {
   1.133          if (verbose) {
   1.134 -            printf ("64 bit value swapped incorrectly!\n");
   1.135 +            printf("64 bit value swapped incorrectly!\n");
   1.136          }
   1.137          ++error;
   1.138      }
   1.139 @@ -131,87 +131,85 @@
   1.140  
   1.141  
   1.142  int
   1.143 -TestCPUInfo (SDL_bool verbose)
   1.144 +TestCPUInfo(SDL_bool verbose)
   1.145  {
   1.146      if (verbose) {
   1.147 -        printf ("RDTSC %s\n", SDL_HasRDTSC ()? "detected" : "not detected");
   1.148 -        printf ("MMX %s\n", SDL_HasMMX ()? "detected" : "not detected");
   1.149 -        printf ("MMX Ext %s\n",
   1.150 -                SDL_HasMMXExt ()? "detected" : "not detected");
   1.151 -        printf ("3DNow %s\n", SDL_Has3DNow ()? "detected" : "not detected");
   1.152 -        printf ("3DNow Ext %s\n",
   1.153 -                SDL_Has3DNowExt ()? "detected" : "not detected");
   1.154 -        printf ("SSE %s\n", SDL_HasSSE ()? "detected" : "not detected");
   1.155 -        printf ("SSE2 %s\n", SDL_HasSSE2 ()? "detected" : "not detected");
   1.156 -        printf ("AltiVec %s\n",
   1.157 -                SDL_HasAltiVec ()? "detected" : "not detected");
   1.158 +        printf("RDTSC %s\n", SDL_HasRDTSC()? "detected" : "not detected");
   1.159 +        printf("MMX %s\n", SDL_HasMMX()? "detected" : "not detected");
   1.160 +        printf("MMX Ext %s\n", SDL_HasMMXExt()? "detected" : "not detected");
   1.161 +        printf("3DNow %s\n", SDL_Has3DNow()? "detected" : "not detected");
   1.162 +        printf("3DNow Ext %s\n",
   1.163 +               SDL_Has3DNowExt()? "detected" : "not detected");
   1.164 +        printf("SSE %s\n", SDL_HasSSE()? "detected" : "not detected");
   1.165 +        printf("SSE2 %s\n", SDL_HasSSE2()? "detected" : "not detected");
   1.166 +        printf("AltiVec %s\n", SDL_HasAltiVec()? "detected" : "not detected");
   1.167      }
   1.168      return (0);
   1.169  }
   1.170  
   1.171  int
   1.172 -main (int argc, char *argv[])
   1.173 +main(int argc, char *argv[])
   1.174  {
   1.175      SDL_bool verbose = SDL_TRUE;
   1.176      int status = 0;
   1.177  
   1.178 -    if (argv[1] && (SDL_strcmp (argv[1], "-q") == 0)) {
   1.179 +    if (argv[1] && (SDL_strcmp(argv[1], "-q") == 0)) {
   1.180          verbose = SDL_FALSE;
   1.181      }
   1.182      if (verbose) {
   1.183 -        printf ("This system is running %s\n",
   1.184 +        printf("This system is running %s\n",
   1.185  #if __AIX__
   1.186 -                "AIX"
   1.187 +               "AIX"
   1.188  #elif __AMIGA__
   1.189 -                "AmigaOS"
   1.190 +               "AmigaOS"
   1.191  #elif __BEOS__
   1.192 -                "BeOS"
   1.193 +               "BeOS"
   1.194  #elif __BSDI__
   1.195 -                "BSDI"
   1.196 +               "BSDI"
   1.197  #elif __DREAMCAST__
   1.198 -                "Dreamcast"
   1.199 +               "Dreamcast"
   1.200  #elif __FREEBSD__
   1.201 -                "FreeBSD"
   1.202 +               "FreeBSD"
   1.203  #elif __HPUX__
   1.204 -                "HP-UX"
   1.205 +               "HP-UX"
   1.206  #elif __IRIX__
   1.207 -                "Irix"
   1.208 +               "Irix"
   1.209  #elif __LINUX__
   1.210 -                "Linux"
   1.211 +               "Linux"
   1.212  #elif __MINT__
   1.213 -                "Atari MiNT"
   1.214 +               "Atari MiNT"
   1.215  #elif __MACOS__
   1.216 -                "MacOS Classic"
   1.217 +               "MacOS Classic"
   1.218  #elif __MACOSX__
   1.219 -                "Mac OS X"
   1.220 +               "Mac OS X"
   1.221  #elif __NETBSD__
   1.222 -                "NetBSD"
   1.223 +               "NetBSD"
   1.224  #elif __OPENBSD__
   1.225 -                "OpenBSD"
   1.226 +               "OpenBSD"
   1.227  #elif __OS2__
   1.228 -                "OS/2"
   1.229 +               "OS/2"
   1.230  #elif __OSF__
   1.231 -                "OSF/1"
   1.232 +               "OSF/1"
   1.233  #elif __QNXNTO__
   1.234 -                "QNX Neutrino"
   1.235 +               "QNX Neutrino"
   1.236  #elif __RISCOS__
   1.237 -                "RISC OS"
   1.238 +               "RISC OS"
   1.239  #elif __SOLARIS__
   1.240 -                "Solaris"
   1.241 +               "Solaris"
   1.242  #elif __WIN32__
   1.243  #ifdef _WIN32_WCE
   1.244 -                "Windows CE"
   1.245 +               "Windows CE"
   1.246  #else
   1.247 -                "Windows"
   1.248 +               "Windows"
   1.249  #endif
   1.250  #else
   1.251 -                "an unknown operating system! (see SDL_platform.h)"
   1.252 +               "an unknown operating system! (see SDL_platform.h)"
   1.253  #endif
   1.254              );
   1.255      }
   1.256  
   1.257 -    status += TestTypes (verbose);
   1.258 -    status += TestEndian (verbose);
   1.259 -    status += TestCPUInfo (verbose);
   1.260 +    status += TestTypes(verbose);
   1.261 +    status += TestEndian(verbose);
   1.262 +    status += TestCPUInfo(verbose);
   1.263      return status;
   1.264  }