~ubuntu-branches/debian/squeeze/stella/squeeze

« back to all changes in this revision

Viewing changes to src/common/bspf.hxx

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Kitt
  • Date: 2010-07-12 23:49:36 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100712234936-juawrr3etzhr2qpv
Tags: 3.1.2-1
* New maintainer (closes: #532039).
* New upstream version (closes: #461121):
  - includes launcher (closes: #396058).
* Fix the reference to the X Window System in the description (closes:
  #411815).
* Move to main, DFSG-free ROMs are available (see README.Debian).
* Enhance the package description.
* Drop the libslang2-dev dependency (closes: #560274).
* Remove the Encoding entry from stella.desktop.
* Avoid ignoring errors when cleaning.
* Add ${misc:Depends} to the package dependencies.
* Provide a doc-base file to install the documentation using doc-base.
* Switch to debhelper 7 with a simplified rules file.
* Use autotools-dev to provide updated configuration files.
* Update to Standards-Version 3.9.0:
  - Move to menu section Applications/Emulators.
  - Move the homepage declaration.
* Re-write the manpage.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//============================================================================
 
2
//
 
3
//  BBBBB    SSSS   PPPPP   FFFFFF
 
4
//  BB  BB  SS  SS  PP  PP  FF
 
5
//  BB  BB  SS      PP  PP  FF
 
6
//  BBBBB    SSSS   PPPPP   FFFF    --  "Brad's Simple Portability Framework"
 
7
//  BB  BB      SS  PP      FF
 
8
//  BB  BB  SS  SS  PP      FF
 
9
//  BBBBB    SSSS   PP      FF
 
10
//
 
11
// Copyright (c) 1995-2010 by Bradford W. Mott, Stephen Anthony
 
12
// and the Stella Team
 
13
//
 
14
// See the file "License.txt" for information on usage and redistribution of
 
15
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
 
16
//
 
17
// $Id: bspf.hxx 2001 2010-04-10 21:37:23Z stephena $
 
18
//============================================================================
 
19
 
 
20
#ifndef BSPF_HXX
 
21
#define BSPF_HXX
 
22
 
 
23
/**
 
24
  This file defines various basic data types and preprocessor variables
 
25
  that need to be defined for different operating systems.
 
26
 
 
27
  @author Bradford W. Mott
 
28
  @version $Id: bspf.hxx 2001 2010-04-10 21:37:23Z stephena $
 
29
*/
 
30
 
 
31
#ifdef HAVE_INTTYPES
 
32
  #include <inttypes.h>
 
33
 
 
34
  // Types for 8-bit signed and unsigned integers
 
35
  typedef int8_t Int8;
 
36
  typedef uint8_t uInt8;
 
37
  // Types for 16-bit signed and unsigned integers
 
38
  typedef int16_t Int16;
 
39
  typedef uint16_t uInt16;
 
40
  // Types for 32-bit signed and unsigned integers
 
41
  typedef int32_t Int32;
 
42
  typedef uint32_t uInt32;
 
43
  // Types for 64-bit signed and unsigned integers
 
44
  typedef int64_t Int64;
 
45
  typedef uint64_t uInt64;
 
46
#elif defined BSPF_WIN32
 
47
  // Types for 8-bit signed and unsigned integers
 
48
  typedef signed char Int8;
 
49
  typedef unsigned char uInt8;
 
50
  // Types for 16-bit signed and unsigned integers
 
51
  typedef signed short Int16;
 
52
  typedef unsigned short uInt16;
 
53
  // Types for 32-bit signed and unsigned integers
 
54
  typedef signed int Int32;
 
55
  typedef unsigned int uInt32;
 
56
  // Types for 64-bit signed and unsigned integers
 
57
  typedef __int64 Int64;
 
58
  typedef unsigned __int64 uInt64;
 
59
#else
 
60
  #error Update BSPF.hxx for datatypes
 
61
#endif
 
62
 
 
63
 
 
64
// The following code should provide access to the standard C++ objects and
 
65
// types: cout, cerr, string, ostream, istream, etc.
 
66
#include <iostream>
 
67
#include <iomanip>
 
68
#include <string>
 
69
using namespace std;
 
70
 
 
71
#include <algorithm>
 
72
 
 
73
// Defines to help with path handling
 
74
#if defined BSPF_UNIX
 
75
  #define BSPF_PATH_SEPARATOR  "/"
 
76
#elif (defined(BSPF_DOS) || defined(BSPF_WIN32) || defined(BSPF_OS2))
 
77
  #define BSPF_PATH_SEPARATOR  "\\"
 
78
#elif defined BSPF_MAC_OSX
 
79
  #define BSPF_PATH_SEPARATOR  "/"
 
80
#elif defined BSPF_GP2X
 
81
    #define BSPF_PATH_SEPARATOR  "/"
 
82
#endif
 
83
 
 
84
// I wish Windows had a complete POSIX layer
 
85
#if defined BSPF_WIN32 && !defined __GNUG__
 
86
  #define BSPF_strcasecmp stricmp
 
87
  #define BSPF_strncasecmp strnicmp
 
88
  #define BSPF_isblank(c) ((c == ' ') || (c == '\t'))
 
89
  #define BSPF_snprintf _snprintf
 
90
  #define BSPF_vsnprintf _vsnprintf
 
91
#else
 
92
  #include <strings.h>
 
93
  #define BSPF_strcasecmp strcasecmp
 
94
  #define BSPF_strncasecmp strncasecmp
 
95
  #define BSPF_isblank(c) isblank(c)
 
96
  #define BSPF_snprintf snprintf
 
97
  #define BSPF_vsnprintf vsnprintf
 
98
#endif
 
99
 
 
100
// CPU architecture type
 
101
// This isn't complete yet, but takes care of all the major platforms
 
102
#if defined(__i386__) || defined(_M_IX86)
 
103
  #define BSPF_ARCH "i386"
 
104
#elif defined(__x86_64__) || defined(_WIN64)
 
105
  #define BSPF_ARCH "x86_64"
 
106
#elif defined(__powerpc__) || defined(__ppc__)
 
107
  #define BSPF_ARCH "ppc"
 
108
#else
 
109
  #define BSPF_ARCH "NOARCH"
 
110
#endif
 
111
 
 
112
// Some convenience functions
 
113
template<typename T> inline void BSPF_swap(T &a, T &b) { T tmp = a; a = b; b = tmp; }
 
114
template<typename T> inline T BSPF_abs (T x) { return (x>=0) ? x : -x; }
 
115
template<typename T> inline T BSPF_min (T a, T b) { return (a<b) ? a : b; }
 
116
template<typename T> inline T BSPF_max (T a, T b) { return (a>b) ? a : b; }
 
117
inline string BSPF_tolower(const string& s)
 
118
{
 
119
  string t = s;
 
120
  transform(t.begin(), t.end(), t.begin(), (int(*)(int)) tolower);
 
121
  return t;
 
122
}
 
123
 
 
124
static const string EmptyString("");
 
125
 
 
126
#ifdef _WIN32_WCE
 
127
  #include "missing.h"
 
128
#endif
 
129
 
 
130
#endif