Ticket #8789: scummvm_beos.patch
File scummvm_beos.patch, 5.2 KB (added by , 17 years ago) |
---|
-
common/hashmap.h
diff -Nur scummvm_org/common/hashmap.h scummvm_beos/common/hashmap.h
old new 86 86 template <class Key, class Val, class HashFunc = Hash<Key>, class EqualFunc = EqualTo<Key> > 87 87 class HashMap { 88 88 private: 89 #if defined (PALMOS_MODE) 89 #if defined (PALMOS_MODE) || defined (__BEOS__) 90 90 public: 91 91 #endif 92 92 … … 119 119 /** 120 120 * Simple HashMap iterator implementation. 121 121 */ 122 template <class NodeType> 122 123 class Iterator { 123 protected: 124 typedef const HashMap hashmap_t; 125 friend class HashMap; 126 127 // Allow ConstIterator to read member vars, so that Iterators can be converted to ConstIterator 128 friend class HashMap::ConstIterator; 129 124 typedef const HashMap<Key, Val, HashFunc, EqualFunc> *hashmap_t; 125 friend class HashMap<Key, Val, HashFunc, EqualFunc>; 130 126 uint _idx; 131 hashmap_t *_hashmap; 132 127 hashmap_t _hashmap; 133 128 protected: 134 Iterator(uint idx, hashmap_t *hashmap) : _idx(idx), _hashmap(hashmap) {}129 Iterator(uint idx, hashmap_t hashmap) : _idx(idx), _hashmap(hashmap) {} 135 130 136 Node *deref() const {131 NodeType *deref() const { 137 132 assert(_hashmap != 0); 138 Node *node = _hashmap->_arr[_idx];133 NodeType *node = _hashmap->_arr[_idx]; 139 134 assert(node != 0); 140 135 return node; 141 136 } … … 143 138 public: 144 139 Iterator() : _idx(0), _hashmap(0) {} 145 140 146 Node &operator *() const { return *deref(); } 147 Node *operator->() const { return deref(); } 141 // HACK: to allow non const/const begin, end and find to work. 142 friend class Iterator<const NodeType>; 143 Iterator(const Iterator<Node> &iter) : _idx(iter._idx), _hashmap(iter._hashmap) {} 144 145 NodeType &operator *() const { return *deref(); } 146 NodeType *operator->() const { return deref(); } 148 147 149 148 bool operator ==(const Iterator &iter) const { return _idx == iter._idx && _hashmap == iter._hashmap; } 150 149 bool operator !=(const Iterator &iter) const { return !(*this == iter); } … … 167 166 } 168 167 }; 169 168 170 /**171 * Simple HashMap const iterator implementation.172 * This is almost completely identical to the normal iterator class, only173 * with some const keywords added here and there, plus a conversion174 * operator which makes it possible to transparently convert iterators to175 * const iterators.176 * It is sadly not really possible to reduce this code duplication using177 * template, unless one is willing to accept various warnings on certain178 * compilers. Note that many (most? all?) implementations of the standard179 * C++ library use a similar approach for their implementations.180 */181 class ConstIterator {182 protected:183 typedef const HashMap hashmap_t;184 friend class HashMap;185 186 uint _idx;187 hashmap_t *_hashmap;188 189 protected:190 ConstIterator(uint idx, hashmap_t *hashmap) : _idx(idx), _hashmap(hashmap) {}191 192 const Node *deref() const {193 assert(_hashmap != 0);194 const Node *node = _hashmap->_arr[_idx];195 assert(node != 0);196 return node;197 }198 199 public:200 ConstIterator() : _idx(0), _hashmap(0) {}201 202 // Converting a non-const iterator to a const one is allowed203 ConstIterator(const Iterator &iter) : _idx(iter._idx), _hashmap(iter._hashmap) {}204 205 const Node &operator *() const { return *deref(); }206 const Node *operator->() const { return deref(); }207 208 bool operator ==(const ConstIterator &iter) const { return _idx == iter._idx && _hashmap == iter._hashmap; }209 bool operator !=(const ConstIterator &iter) const { return !(*this == iter); }210 211 ConstIterator &operator ++() {212 assert(_hashmap);213 do {214 _idx++;215 } while (_idx < _hashmap->_arrsize && _hashmap->_arr[_idx] == 0);216 if (_idx >= _hashmap->_arrsize)217 _idx = (uint)-1;218 219 return *this;220 }221 169 222 ConstIterator operator ++(int) {223 ConstIterator old = *this;224 operator ++();225 return old;226 }227 };228 170 229 171 public: 230 typedef Iterator iterator;231 typedef ConstIteratorconst_iterator;172 typedef Iterator<Node> iterator; 173 typedef Iterator<const Node> const_iterator; 232 174 233 175 HashMap(); 234 176 HashMap(const HM_t& map); -
configure
diff -Nur scummvm_org/configure scummvm_beos/configure
old new 955 955 echo_n "Checking hosttype... " 956 956 echo $_host_os 957 957 case $_host_os in 958 linux* | uclinux* | openbsd* | freebsd* | netbsd* | bsd* | sunos* | hpux* | beos*)958 linux* | uclinux* | openbsd* | freebsd* | netbsd* | bsd* | sunos* | hpux* ) 959 959 DEFINES="$DEFINES -DUNIX" 960 960 ;; 961 beos*) 962 DEFINES="$DEFINES -DUNIX -DSYSTEM_NOT_SUPPORTING_D_TYPE -DSCUMMVM_USE_LONG_INT" 963 LIBS="$LIBS -lbind -lsocket" 964 ;; 961 965 solaris*) 962 966 DEFINES="$DEFINES -DUNIX -DSYSTEM_NOT_SUPPORTING_D_TYPE" 963 967 ;; … … 1276 1280 int main(void) { vorbis_packet_blocksize(0,0); return 0; } 1277 1281 EOF 1278 1282 cc_check $LDFLAGS $CXXFLAGS $OGG_CFLAGS $OGG_LIBS $VORBIS_CFLAGS $VORBIS_LIBS \ 1279 -lvorbisfile -lvorbis -logg -lm&& _vorbis=yes1283 -lvorbisfile -lvorbis -logg && _vorbis=yes 1280 1284 fi 1281 1285 if test "$_vorbis" = yes ; then 1282 1286 _def_vorbis='#define USE_VORBIS' … … 1328 1332 int main(void) { return FLAC__STREAM_SYNC_LEN >> 30; /* guaranteed to be 0 */ } 1329 1333 EOF 1330 1334 cc_check $LDFLAGS $CXXFLAGS $FLAC_CFLAGS $FLAC_LIBS $OGG_CFLAGS $OGG_LIBS \ 1331 -lFLAC -logg -lm&& _flac=yes1335 -lFLAC -logg && _flac=yes 1332 1336 fi 1333 1337 if test "$_flac" = yes ; then 1334 1338 _def_flac='#define USE_FLAC'