[Scummvm-cvs-logs] SF.net SVN: scummvm:[47302] tools/trunk

tdhs at users.sourceforge.net tdhs at users.sourceforge.net
Fri Jan 15 04:11:36 CET 2010


Revision: 47302
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47302&view=rev
Author:   tdhs
Date:     2010-01-15 03:11:35 +0000 (Fri, 15 Jan 2010)

Log Message:
-----------
Fixed nominal build of Mohawk tools.
Removed some of the duplicated engines/mohawk/utils code.

Modified Paths:
--------------
    tools/trunk/Makefile
    tools/trunk/Makefile.common
    tools/trunk/common/scummsys.h
    tools/trunk/engines/mohawk/deriven.cpp
    tools/trunk/engines/mohawk/extract_mohawk.cpp
    tools/trunk/engines/mohawk/utils/str.cpp
    tools/trunk/engines/mohawk/utils/str.h
    tools/trunk/engines/mohawk/utils/voc.h

Added Paths:
-----------
    tools/trunk/common/func.h

Removed Paths:
-------------
    tools/trunk/engines/mohawk/Makefile
    tools/trunk/engines/mohawk/util.cpp
    tools/trunk/engines/mohawk/utils/algorithm.h
    tools/trunk/engines/mohawk/utils/array.h
    tools/trunk/engines/mohawk/utils/md5.cpp
    tools/trunk/engines/mohawk/utils/md5.h
    tools/trunk/engines/mohawk/utils/pack-end.h
    tools/trunk/engines/mohawk/utils/pack-start.h

Modified: tools/trunk/Makefile
===================================================================
--- tools/trunk/Makefile	2010-01-14 23:42:40 UTC (rev 47301)
+++ tools/trunk/Makefile	2010-01-15 03:11:35 UTC (rev 47302)
@@ -88,8 +88,10 @@
 	strip decine.exe -o $(WIN32PATH)/tools/decine.exe
 	strip degob.exe -o $(WIN32PATH)/tools/degob.exe
 	strip dekyra.exe -o $(WIN32PATH)/tools/dekyra.exe
+	strip deriven.exe -o $(WIN32PATH)/tools/deriven.exe
 	strip descumm.exe -o $(WIN32PATH)/tools/descumm.exe
 	strip desword2.exe -o $(WIN32PATH)/tools/desword2.exe
+	strip extract_mohawk.exe -o $(WIN32PATH)/tools/extract_mohawk.exe
 	strip scummvm-tools.exe -o $(WIN32PATH)/tools/scummvm-tools.exe
 	strip scummvm-tools-cli.exe -o $(WIN32PATH)/tools/scummvm-tools-cli.exe
 	cp *.bat $(WIN32PATH)/tools

Modified: tools/trunk/Makefile.common
===================================================================
--- tools/trunk/Makefile.common	2010-01-14 23:42:40 UTC (rev 47301)
+++ tools/trunk/Makefile.common	2010-01-15 03:11:35 UTC (rev 47302)
@@ -29,6 +29,8 @@
 	engines/gob/ \
 	engines/groovie/ \
 	engines/kyra/ \
+	engines/mohawk/ \
+	engines/mohawk/utils/ \
 	engines/parallaction/ \
 	engines/queen/ \
 	engines/saga/ \
@@ -62,8 +64,10 @@
 TARGETS := \
 	decine$(EXEEXT) \
 	dekyra$(EXEEXT) \
+	deriven$(EXEEXT) \
 	descumm$(EXEEXT) \
 	desword2$(EXEEXT) \
+	extract_mohawk$(EXEEXT) \
 	degob$(EXEEXT) \
 	scummvm-tools-cli$(EXEEXT)
 
@@ -109,9 +113,11 @@
 PROGRAMS = \
 	decine \
 	dekyra \
+	deriven \
 	descumm \
 	desword2 \
 	degob \
+	extract_mohawk \
 	create_sjisfnt \
 	scummvm-tools \
 	scummvm-tools-cli \
@@ -125,6 +131,18 @@
 	engines/kyra/dekyra_v1.o \
 	$(UTILS)
 
+deriven_OBJS := \
+	engines/mohawk/deriven.o \
+	engines/mohawk/mohawk_file.o \
+	engines/mohawk/utils/str.o \
+	engines/mohawk/utils/file.o \
+	engines/mohawk/utils/adpcm.o \
+	engines/mohawk/utils/audiostream.o \
+	engines/mohawk/utils/voc.o \
+	engines/mohawk/utils/wave.o \
+	common/md5.o \
+	common/util.o
+
 descumm_OBJS := \
 	engines/scumm/descumm-tool.o \
 	engines/scumm/descumm.o \
@@ -147,6 +165,17 @@
 	tool.o \
 	$(UTILS)
 
+extract_mohawk_OBJS := \
+	engines/mohawk/extract_mohawk.o \
+	engines/mohawk/mohawk_file.o \
+	engines/mohawk/utils/str.o \
+	engines/mohawk/utils/file.o \
+	engines/mohawk/utils/adpcm.o \
+	engines/mohawk/utils/audiostream.o \
+	engines/mohawk/utils/voc.o \
+	engines/mohawk/utils/wave.o \
+	common/md5.o \
+	common/util.o
 
 create_sjisfnt_OBJS := create_sjisfnt.o $(UTILS)
 create_sjisfnt_LIBS := $(FREETYPELIBS) $(ICONVLIBS)

Added: tools/trunk/common/func.h
===================================================================
--- tools/trunk/common/func.h	                        (rev 0)
+++ tools/trunk/common/func.h	2010-01-15 03:11:35 UTC (rev 47302)
@@ -0,0 +1,544 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#ifndef COMMON_FUNC_H
+#define COMMON_FUNC_H
+
+#include "common/scummsys.h"
+
+namespace Common {
+
+/**
+ * Generic unary function.
+ */
+template<class Arg, class Result>
+struct UnaryFunction {
+	typedef Arg ArgumenType;
+	typedef Result ResultType;
+};
+
+/**
+ * Generic binary function.
+ */
+template<class Arg1, class Arg2, class Result>
+struct BinaryFunction {
+	typedef Arg1 FirstArgumentType;
+	typedef Arg2 SecondArgumentType;
+	typedef Result ResultType;
+};
+
+/**
+ * Predicate to check for equallity of two data elements.
+ */
+template<class T>
+struct EqualTo : public BinaryFunction<T, T, bool> {
+	bool operator()(const T &x, const T &y) const { return x == y; }
+};
+
+/**
+ * Predicate to check for x being less than y.
+ */
+template<class T>
+struct Less : public BinaryFunction<T, T, bool> {
+	bool operator()(const T &x, const T &y) const { return x < y; }
+};
+
+/**
+ * Predicate to check for x being greater than y.
+ */
+template<class T>
+struct Greater : public BinaryFunction<T, T, bool> {
+	bool operator()(const T &x, const T &y) const { return x > y; }
+};
+
+template<class Op>
+class Binder1st : public UnaryFunction<typename Op::SecondArgumentType, typename Op::ResultType> {
+private:
+	Op _op;
+	typename Op::FirstArgumentType _arg1;
+public:
+	Binder1st(const Op &op, typename Op::FirstArgumentType arg1) : _op(op), _arg1(arg1) {}
+
+	typename Op::ResultType operator()(typename Op::SecondArgumentType v) const {
+		return _op(_arg1, v);
+	}
+};
+
+/**
+ * Transforms a binary function object into an unary function object.
+ * To achieve that the first parameter is bound to the passed value t.
+ */
+template<class Op>
+inline Binder1st<Op> bind1st(const Op &op, typename Op::FirstArgumentType t) {
+	return Binder1st<Op>(op, t);
+}
+
+template<class Op>
+class Binder2nd : public UnaryFunction<typename Op::FirstArgumentType, typename Op::ResultType> {
+private:
+	Op _op;
+	typename Op::SecondArgumentType _arg2;
+public:
+	Binder2nd(const Op &op, typename Op::SecondArgumentType arg2) : _op(op), _arg2(arg2) {}
+
+	typename Op::ResultType operator()(typename Op::FirstArgumentType v) const {
+		return _op(v, _arg2);
+	}
+};
+
+/**
+ * Transforms a binary function object into an unary function object.
+ * To achieve that the first parameter is bound to the passed value t.
+ */
+template<class Op>
+inline Binder2nd<Op> bind2nd(const Op &op, typename Op::SecondArgumentType t) {
+	return Binder2nd<Op>(op, t);
+}
+
+template<class Arg, class Result>
+class PointerToUnaryFunc : public UnaryFunction<Arg, Result> {
+private:
+	Result (*_func)(Arg);
+public:
+	typedef Result (*FuncType)(Arg);
+
+	PointerToUnaryFunc(const FuncType &func) : _func(func) {}
+	Result operator()(Arg v) const {
+		return _func(v);
+	}
+};
+
+template<class Arg1, class Arg2, class Result>
+class PointerToBinaryFunc : public BinaryFunction<Arg1, Arg2, Result> {
+private:
+	Result (*_func)(Arg1, Arg2);
+public:
+	typedef Result (*FuncType)(Arg1, Arg2);
+
+	PointerToBinaryFunc(const FuncType &func) : _func(func) {}
+	Result operator()(Arg1 v1, Arg2 v2) const {
+		return _func(v1, v2);
+	}
+};
+
+/**
+ * Creates an unary function object from a function pointer.
+ */
+template<class Arg, class Result>
+inline PointerToUnaryFunc<Arg, Result> ptr_fun(Result (*func)(Arg)) {
+	return PointerToUnaryFunc<Arg, Result>(func);
+}
+
+/**
+ * Creates an binary function object from a function pointer.
+ */
+template<class Arg1, class Arg2, class Result>
+inline PointerToBinaryFunc<Arg1, Arg2, Result> ptr_fun(Result (*func)(Arg1, Arg2)) {
+	return PointerToBinaryFunc<Arg1, Arg2, Result>(func);
+}
+
+template<class Result, class T>
+class MemFunc0 : public UnaryFunction<T *, Result> {
+private:
+	Result (T::*_func)();
+public:
+	typedef Result (T::*FuncType)();
+
+	MemFunc0(const FuncType &func) : _func(func) {}
+	Result operator()(T *v) const {
+		return (v->*_func)();
+	}
+};
+
+template<class Result, class T>
+class ConstMemFunc0 : public UnaryFunction<T *, Result> {
+private:
+	Result (T::*_func)() const;
+public:
+	typedef Result (T::*FuncType)() const;
+
+	ConstMemFunc0(const FuncType &func) : _func(func) {}
+	Result operator()(const T *v) const {
+		return (v->*_func)();
+	}
+};
+
+template<class Result, class Arg, class T>
+class MemFunc1 : public BinaryFunction<T *, Arg, Result> {
+private:
+	Result (T::*_func)(Arg);
+public:
+	typedef Result (T::*FuncType)(Arg);
+
+	MemFunc1(const FuncType &func) : _func(func) {}
+	Result operator()(T *v1, Arg v2) const {
+		return (v1->*_func)(v2);
+	}
+};
+
+template<class Result, class Arg, class T>
+class ConstMemFunc1 : public BinaryFunction<T *, Arg, Result> {
+private:
+	Result (T::*_func)(Arg) const;
+public:
+	typedef Result (T::*FuncType)(Arg) const;
+
+	ConstMemFunc1(const FuncType &func) : _func(func) {}
+	Result operator()(const T *v1, Arg v2) const {
+		return (v1->*_func)(v2);
+	}
+};
+
+/**
+ * Creates a unary function object from a class member function pointer.
+ * The parameter passed to the function object is the 'this' pointer to
+ * be used for the function call.
+ */
+template<class Result, class T>
+inline MemFunc0<Result, T> mem_fun(Result (T::*f)()) {
+	return MemFunc0<Result, T>(f);
+}
+
+/**
+ * Creates a unary function object from a class member function pointer.
+ * The parameter passed to the function object is the 'this' pointer to
+ * be used for the function call.
+ */
+template<class Result, class T>
+inline ConstMemFunc0<Result, T> mem_fun(Result (T::*f)() const) {
+	return ConstMemFunc0<Result, T>(f);
+}
+
+/**
+ * Creates a binary function object from a class member function pointer.
+ * The first parameter passed to the function object is the 'this' pointer to
+ * be used for the function call.
+ * The second one is the parameter passed to the member function.
+ */
+template<class Result, class Arg, class T>
+inline MemFunc1<Result, Arg, T> mem_fun(Result (T::*f)(Arg)) {
+	return MemFunc1<Result, Arg, T>(f);
+}
+
+/**
+ * Creates a binary function object from a class member function pointer.
+ * The first parameter passed to the function object is the 'this' pointer to
+ * be used for the function call.
+ * The second one is the parameter passed to the member function.
+ */
+template<class Result, class Arg, class T>
+inline ConstMemFunc1<Result, Arg, T> mem_fun(Result (T::*f)(Arg) const) {
+	return ConstMemFunc1<Result, Arg, T>(f);
+}
+
+template<class Result, class T>
+class MemFuncRef0 : public UnaryFunction<T &, Result> {
+private:
+	Result (T::*_func)();
+public:
+	typedef Result (T::*FuncType)();
+
+	MemFuncRef0(const FuncType &func) : _func(func) {}
+	Result operator()(T &v) const {
+		return (v.*_func)();
+	}
+};
+
+template<class Result, class T>
+class ConstMemFuncRef0 : public UnaryFunction<T &, Result> {
+private:
+	Result (T::*_func)() const;
+public:
+	typedef Result (T::*FuncType)() const;
+
+	ConstMemFuncRef0(const FuncType &func) : _func(func) {}
+	Result operator()(const T &v) const {
+		return (v.*_func)();
+	}
+};
+
+template<class Result, class Arg, class T>
+class MemFuncRef1 : public BinaryFunction<T &, Arg, Result> {
+private:
+	Result (T::*_func)(Arg);
+public:
+	typedef Result (T::*FuncType)(Arg);
+
+	MemFuncRef1(const FuncType &func) : _func(func) {}
+	Result operator()(T &v1, Arg v2) const {
+		return (v1.*_func)(v2);
+	}
+};
+
+template<class Result, class Arg, class T>
+class ConstMemFuncRef1 : public BinaryFunction<T &, Arg, Result> {
+private:
+	Result (T::*_func)(Arg) const;
+public:
+	typedef Result (T::*FuncType)(Arg) const;
+
+	ConstMemFuncRef1(const FuncType &func) : _func(func) {}
+	Result operator()(const T &v1, Arg v2) const {
+		return (v1.*_func)(v2);
+	}
+};
+
+/**
+ * Creates a unary function object from a class member function pointer.
+ * The parameter passed to the function object is the object instance to
+ * be used for the function call. Note unlike mem_fun, it takes a reference
+ * as parameter. Note unlike mem_fun, it takes a reference
+ * as parameter.
+ */
+template<class Result, class T>
+inline MemFuncRef0<Result, T> mem_fun_ref(Result (T::*f)()) {
+	return MemFuncRef0<Result, T>(f);
+}
+
+/**
+ * Creates a unary function object from a class member function pointer.
+ * The parameter passed to the function object is the object instance to
+ * be used for the function call. Note unlike mem_fun, it takes a reference
+ * as parameter.
+ */
+template<class Result, class T>
+inline ConstMemFuncRef0<Result, T> mem_fun_Ref(Result (T::*f)() const) {
+	return ConstMemFuncRef0<Result, T>(f);
+}
+
+/**
+ * Creates a binary function object from a class member function pointer.
+ * The first parameter passed to the function object is the object instance to
+ * be used for the function call. Note unlike mem_fun, it takes a reference
+ * as parameter.
+ * The second one is the parameter passed to the member function.
+ */
+template<class Result, class Arg, class T>
+inline MemFuncRef1<Result, Arg, T> mem_fun_ref(Result (T::*f)(Arg)) {
+	return MemFuncRef1<Result, Arg, T>(f);
+}
+
+/**
+ * Creates a binary function object from a class member function pointer.
+ * The first parameter passed to the function object is the object instance to
+ * be used for the function call. Note unlike mem_fun, it takes a reference
+ * as parameter.
+ * The second one is the parameter passed to the member function.
+ */
+template<class Result, class Arg, class T>
+inline ConstMemFuncRef1<Result, Arg, T> mem_fun_ref(Result (T::*f)(Arg) const) {
+	return ConstMemFuncRef1<Result, Arg, T>(f);
+}
+
+// functor code
+
+/**
+ * Generic functor object for function objects without parameters.
+ *
+ * @see Functor1
+ */
+template<class Res>
+struct Functor0 {
+	virtual ~Functor0() {}
+
+	virtual bool isValid() const = 0;
+	virtual Res operator()() const = 0;
+};
+
+/**
+ * Functor object for a class member function without parameter.
+ *
+ * Example creation:
+ *
+ * Foo bar;
+ * Functor0Mem<void, Foo> myFunctor(&bar, &Foo::myFunc);
+ *
+ * Example usage:
+ *
+ * myFunctor();
+ */
+template<class Res, class T>
+class Functor0Mem : public Functor0<Res> {
+public:
+	typedef Res (T::*FuncType)();
+
+	Functor0Mem(T *t, const FuncType &func) : _t(t), _func(func) {}
+
+	bool isValid() const { return _func != 0 && _t != 0; }
+	Res operator()() const {
+		return (_t->*_func)();
+	}
+private:
+	mutable T *_t;
+	const FuncType _func;
+};
+
+/**
+ * Generic functor object for unary function objects.
+ *
+ * A typical usage for an unary function object is for executing opcodes
+ * in a script interpreter. To achieve that one can create an Common::Array
+ * object with 'Functor1<Arg, Res> *' as type. Now after the right engine version
+ * has been determined and the opcode table to use is found one could easily
+ * add the opcode implementations like this:
+ *
+ * Common::Array<Functor1<ScriptState, void> *> opcodeTable;
+ * opcodeTable[0] = new Functor1Mem<ScriptState, void, MyEngine_v1>(&myEngine, &MyEngine_v1::o1_foo);
+ * opcodeTable[1] = new Functor1Mem<ScriptState, void, MyEngine_v2>(&myEngine, &MyEngine_v2::o2_foo);
+ * // unimplemented/unused opcode
+ * opcodeTable[2] = 0;
+ * etc.
+ *
+ * This makes it easy to add member functions of different classes as
+ * opcode functions to the function table. Since with the generic
+ * Functor1<ScriptState, void> object the only requirement for an
+ * function to be used is 'ScriptState' as argument and 'void' as return
+ * value.
+ *
+ * Now for calling the opcodes one has simple to do:
+ * if (opcodeTable[opcodeNum] && opcodeTable[opcodeNum]->isValid())
+ *     (*opcodeTable[opcodeNum])(scriptState);
+ * else
+ *     warning("Unimplemented opcode %d", opcodeNum);
+ *
+ * If you want to see an real world example check the kyra engine.
+ * Files: engines/kyra/script.cpp and .h and engines/kyra/script_*.cpp
+ * are interesting for that matter.
+ */
+template<class Arg, class Res>
+struct Functor1 : public Common::UnaryFunction<Arg, Res> {
+	virtual ~Functor1() {}
+
+	virtual bool isValid() const = 0;
+	virtual Res operator()(Arg) const = 0;
+};
+
+/**
+ * Functor object for an unary class member function.
+ * Usage is like with Functor0Mem. The resulting functor object
+ * will take one parameter though.
+ *
+ * @see Functor0Mem
+ */
+template<class Arg, class Res, class T>
+class Functor1Mem : public Functor1<Arg, Res> {
+public:
+	typedef Res (T::*FuncType)(Arg);
+
+	Functor1Mem(T *t, const FuncType &func) : _t(t), _func(func) {}
+
+	bool isValid() const { return _func != 0 && _t != 0; }
+	Res operator()(Arg v1) const {
+		return (_t->*_func)(v1);
+	}
+private:
+	mutable T *_t;
+	const FuncType _func;
+};
+
+/**
+ * Generic functor object for binary function objects.
+ *
+ * @see Functor1
+ */
+template<class Arg1, class Arg2, class Res>
+struct Functor2 : public Common::BinaryFunction<Arg1, Arg2, Res> {
+	virtual ~Functor2() {}
+
+	virtual bool isValid() const = 0;
+	virtual Res operator()(Arg1, Arg2) const = 0;
+};
+
+/**
+ * Functor object for a binary function.
+ *
+ * @see Functor2Mem
+ */
+template<class Arg1, class Arg2, class Res>
+class Functor2Fun : public Functor2<Arg1, Arg2, Res> {
+public:
+	typedef Res (*FuncType)(Arg1, Arg2);
+
+	Functor2Fun(const FuncType func) : _func(func) {}
+
+	bool isValid() const { return _func != 0; }
+	Res operator()(Arg1 v1, Arg2 v2) const {
+		return (*_func)(v1, v2);
+	}
+private:
+	const FuncType _func;
+};
+
+/**
+ * Functor object for a binary class member function.
+ * Usage is like with Functor0Mem. The resulting functor object
+ * will take two parameter though.
+ *
+ * @see Functor0Mem
+ */
+template<class Arg1, class Arg2, class Res, class T>
+class Functor2Mem : public Functor2<Arg1, Arg2, Res> {
+public:
+	typedef Res (T::*FuncType)(Arg1, Arg2);
+
+	Functor2Mem(T *t, const FuncType &func) : _t(t), _func(func) {}
+
+	bool isValid() const { return _func != 0 && _t != 0; }
+	Res operator()(Arg1 v1, Arg2 v2) const {
+		return (_t->*_func)(v1, v2);
+	}
+private:
+	mutable T *_t;
+	const FuncType _func;
+};
+
+/**
+ * Base template for hash functor objects, used by HashMap.
+ * This needs to be specialized for every type that you need to hash.
+ */
+template<typename T> struct Hash;
+
+
+#define GENERATE_TRIVIAL_HASH_FUNCTOR(T) \
+	template<> struct Hash<T> : public UnaryFunction<T, uint> { \
+		uint operator()(T val) const { return (uint)val; } \
+	}
+
+GENERATE_TRIVIAL_HASH_FUNCTOR(bool);
+GENERATE_TRIVIAL_HASH_FUNCTOR(char);
+GENERATE_TRIVIAL_HASH_FUNCTOR(signed char);
+GENERATE_TRIVIAL_HASH_FUNCTOR(unsigned char);
+GENERATE_TRIVIAL_HASH_FUNCTOR(short);
+GENERATE_TRIVIAL_HASH_FUNCTOR(int);
+GENERATE_TRIVIAL_HASH_FUNCTOR(long);
+GENERATE_TRIVIAL_HASH_FUNCTOR(unsigned short);
+GENERATE_TRIVIAL_HASH_FUNCTOR(unsigned int);
+GENERATE_TRIVIAL_HASH_FUNCTOR(unsigned long);
+
+#undef GENERATE_TRIVIAL_HASH_FUNCTOR
+
+}	// End of namespace Common
+
+#endif
+


Property changes on: tools/trunk/common/func.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: tools/trunk/common/scummsys.h
===================================================================
--- tools/trunk/common/scummsys.h	2010-01-14 23:42:40 UTC (rev 47301)
+++ tools/trunk/common/scummsys.h	2010-01-15 03:11:35 UTC (rev 47302)
@@ -43,6 +43,14 @@
 typedef signed int int32;
 #endif
 
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
+#include <math.h>
+
 /*
  * Various utility macros
  */

Deleted: tools/trunk/engines/mohawk/Makefile
===================================================================
--- tools/trunk/engines/mohawk/Makefile	2010-01-14 23:42:40 UTC (rev 47301)
+++ tools/trunk/engines/mohawk/Makefile	2010-01-15 03:11:35 UTC (rev 47302)
@@ -1,106 +0,0 @@
-# $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/tools/branches/gsoc2009-gui/Makefile $
-# $Id: Makefile 41455 2009-06-11 21:42:48Z fingolfin $
-
-#######################################################################
-# Default compilation parameters. Normally don't edit these           #
-#######################################################################
-
-srcdir      ?= .
-
-DEFINES     := -DUNIX
-LDFLAGS     := $(LDFLAGS)
-INCLUDES    := -I. -I$(srcdir)
-LIBS        :=
-OBJS        :=
-DEPDIR      := .deps
-
-# Load the make rules generated by configure
-# HACK: We don't yet support configure in the tools SVN module, but at least one can
-# manually create a config.mk files with overrides, if needed.
--include config.mk
-
-CXXFLAGS  += -g -O -Wuninitialized
-
-# Additional warnings
-CXXFLAGS:= -Wall $(CXXFLAGS)
-# Turn off some annoying and not-so-useful warnings
-CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder
-# Enable even more warnings...
-#CXXFLAGS+= -pedantic	# -pedantic is too pedantic, at least on Mac OS X
-CXXFLAGS+= -Wpointer-arith -Wcast-qual -Wconversion
-CXXFLAGS+= -Wshadow -Wimplicit -Wundef -Wnon-virtual-dtor -Wwrite-strings
-
-# Disable exceptions, and enabled checking of pointers returned by "new"
-CXXFLAGS+= -fno-exceptions -fcheck-new
-
-#######################################################################
-# Default commands - put the necessary replacements in config.mk      #
-#######################################################################
-
-CAT     ?= cat
-CP      ?= cp
-ECHO    ?= printf
-INSTALL ?= install
-MKDIR   ?= mkdir -p
-RM      ?= rm -f
-RM_REC  ?= $(RM) -r
-ZIP     ?= zip -q
-
-CC      := gcc
-CXX     := g++
-
-#######################################################################
-
-# HACK: Until we get proper module support, add these "module dirs" to 
-# get the dependency tracking code working.
-MODULE_DIRS := ./ utils/
-
-#######################################################################
-
-TARGETS := \
-	deriven$(EXEEXT) \
-	extract_mohawk$(EXEEXT)
-
-UTILS := \
-	utils/adpcm.o \
-	utils/audiostream.o \
-	utils/file.o \
-	utils/md5.o \
-	utils/str.o \
-	utils/voc.o \
-	utils/wave.o
-
-all: $(TARGETS)
-
-install: $(TARGETS)
-	for i in $^ ; do install -p -m 0755 $$i $(DESTDIR) ; done
-
-deriven$(EXEEXT): deriven.o mohawk_file.o util.o $(UTILS)
-	$(CXX) $(LDFLAGS) -o $@ $+
-
-extract_mohawk$(EXEEXT): extract_mohawk.o mohawk_file.o util.o $(UTILS)
-	$(CXX) $(LDFLAGS) -o $@ $+
-clean:
-	rm -f *.o utils/*.o $(TARGETS)
-
-######################################################################
-# The build rules follow - normally you should have no need to
-# touch whatever comes after here.
-######################################################################
-
-# Concat DEFINES and INCLUDES to form the CPPFLAGS
-CPPFLAGS := $(DEFINES) $(INCLUDES)
-
-# Include the build instructions for all modules
-#-include $(addprefix $(srcdir)/, $(addsuffix /module.mk,$(MODULES)))
-
-# Depdir information
-DEPDIRS = $(addsuffix $(DEPDIR),$(MODULE_DIRS))
-DEPFILES =
-
-%.o: %.cpp
-	$(MKDIR) $(*D)/$(DEPDIR)
-	$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
-
-# Include the dependency tracking files.
--include $(wildcard $(addsuffix /*.d,$(DEPDIRS)))

Modified: tools/trunk/engines/mohawk/deriven.cpp
===================================================================
--- tools/trunk/engines/mohawk/deriven.cpp	2010-01-14 23:42:40 UTC (rev 47301)
+++ tools/trunk/engines/mohawk/deriven.cpp	2010-01-15 03:11:35 UTC (rev 47302)
@@ -21,8 +21,11 @@
  */
 
 #include "mohawk_file.h"
+#include "util.h"
 #include "utils/file.h"
 
+#include <assert.h>
+
 #define NO_OP "empty"
 
 static const char *opcode_names[] = {

Modified: tools/trunk/engines/mohawk/extract_mohawk.cpp
===================================================================
--- tools/trunk/engines/mohawk/extract_mohawk.cpp	2010-01-14 23:42:40 UTC (rev 47301)
+++ tools/trunk/engines/mohawk/extract_mohawk.cpp	2010-01-15 03:11:35 UTC (rev 47302)
@@ -21,8 +21,11 @@
  */
 
 #include "mohawk_file.h"
+#include "util.h"
 #include "utils/file.h"
 
+#include <assert.h>
+
 // Have a maximum buffer size
 #define MAX_BUF_SIZE 16384
 

Deleted: tools/trunk/engines/mohawk/util.cpp
===================================================================
--- tools/trunk/engines/mohawk/util.cpp	2010-01-14 23:42:40 UTC (rev 47301)
+++ tools/trunk/engines/mohawk/util.cpp	2010-01-15 03:11:35 UTC (rev 47302)
@@ -1,316 +0,0 @@
-/* Scumm Tools
- * Copyright (C) 2003-2006  The ScummVM Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/tools/branches/gsoc2009-gui/util.cpp $
- * $Id: util.cpp 41547 2009-06-15 14:24:36Z Remere $
- *
- */
-
-#include "util.h"
-#include <stdarg.h>
-
-#ifdef _MSC_VER
-	#define	vsnprintf _vsnprintf
-#endif
-
-void error(const char *s, ...) {
-	char buf[1024];
-	va_list va;
-
-	va_start(va, s);
-	vsnprintf(buf, 1024, s, va);
-	va_end(va);
-
-	fprintf(stderr, "ERROR: %s!\n", buf);
-
-	exit(1);
-}
-
-void warning(const char *s, ...) {
-	char buf[1024];
-	va_list va;
-
-	va_start(va, s);
-	vsnprintf(buf, 1024, s, va);
-	va_end(va);
-
-	fprintf(stderr, "WARNING: %s!\n", buf);
-}
-
-void debug(int level, const char *s, ...) {
-	char buf[1024];
-	va_list va;
-
-	va_start(va, s);
-	vsnprintf(buf, 1024, s, va);
-	va_end(va);
-
-	fprintf(stderr, "DEBUG: %s!\n", buf);
-}
-
-void notice(const char *s, ...) {
-	char buf[1024];
-	va_list va;
-
-	va_start(va, s);
-	vsnprintf(buf, 1024, s, va);
-	va_end(va);
-
-	fprintf(stdout, "%s\n", buf);
-}
-
-uint8 readByte(FILE *fp) {
-	return fgetc(fp);
-}
-
-uint16 readUint16BE(FILE *fp) {
-	uint16 ret = 0;
-	ret |= fgetc(fp) << 8;
-	ret |= fgetc(fp);
-	return ret;
-}
-
-uint16 readUint16LE(FILE *fp) {
-	uint16 ret = 0;
-	ret |= fgetc(fp);
-	ret |= fgetc(fp) << 8;
-	return ret;
-}
-
-uint32 readUint32BE(FILE *fp) {
-	uint32 ret = 0;
-	ret |= fgetc(fp) << 24;
-	ret |= fgetc(fp) << 16;
-	ret |= fgetc(fp) << 8;
-	ret |= fgetc(fp);
-	return ret;
-}
-
-uint32 readUint32LE(FILE *fp) {
-	uint32 ret = 0;
-	ret |= fgetc(fp);
-	ret |= fgetc(fp) << 8;
-	ret |= fgetc(fp) << 16;
-	ret |= fgetc(fp) << 24;
-	return ret;
-}
-
-void writeByte(FILE *fp, uint8 b) {
-	fwrite(&b, 1, 1, fp);
-}
-
-void writeUint16BE(FILE *fp, uint16 value) {
-	writeByte(fp, (uint8)(value >> 8));
-	writeByte(fp, (uint8)(value));
-}
-
-void writeUint16LE(FILE *fp, uint16 value) {
-	writeByte(fp, (uint8)(value));
-	writeByte(fp, (uint8)(value >> 8));
-}
-
-void writeUint32BE(FILE *fp, uint32 value) {
-	writeByte(fp, (uint8)(value >> 24));
-	writeByte(fp, (uint8)(value >> 16));
-	writeByte(fp, (uint8)(value >> 8));
-	writeByte(fp, (uint8)(value));
-}
-
-void writeUint32LE(FILE *fp, uint32 value) {
-	writeByte(fp, (uint8)(value));
-	writeByte(fp, (uint8)(value >> 8));
-	writeByte(fp, (uint8)(value >> 16));
-	writeByte(fp, (uint8)(value >> 24));
-}
-
-uint32 fileSize(FILE *fp) {
-	uint32 sz;
-	uint32 pos = ftell(fp);
-	fseek(fp, 0, SEEK_END);
-	sz = ftell(fp);
-	fseek(fp, pos, SEEK_SET);
-	return sz;
-}
-
-Filename::Filename(const char *path) {
-	strcpy(_path, path);
-}
-
-Filename::Filename(const Filename& filename) {
-	strcpy(_path, filename._path);
-}
-
-Filename& Filename::operator=(const Filename& filename) {
-	strcpy(_path, filename._path);
-	return *this;
-}
-
-void Filename::setFullPath(const char *path) {
-	strcpy(_path, path);
-}
-
-Filename *Filename::setFullName(const char *newname) {
-	char p[1024];
-	if (getPath(p)) {
-		strcat(p, newname);
-		strcpy(_path, p);
-		return this;
-	}
-	return NULL;
-}
-
-void Filename::addExtension(const char *ext) {
-	strcat(_path, ext);
-}
-
-void Filename::setExtension(const char *ext) {
-	char *dot = strrchr(_path, '.');
-	if(!dot)
-		dot = _path + strlen(_path) - 1;
-	// Don't copy the dot
-	if(*ext == '.')
-		ext++;
-	strcpy(dot+1, ext);
-}
-
-bool Filename::equals(const Filename *other) const {
-#ifdef _WIN32
-	// On Windows paths are case-insensitive
-	return scumm_stricmp(_path, other->_path) == 0;
-#else
-	return strcmp(_path, other->_path) == 0;
-#endif
-}
-
-bool Filename::empty() const {
-	return *_path == 0;
-}
-
-bool Filename::hasExtension(const char *suffix) const {
-	const char *dot = strrchr(_path, '.');
-	if(!dot)
-		dot = _path + strlen(_path);
-
-	// Check that dot position is less than /, since some
-	// directories contain ., like /home/.data/file
-	const char *slash = strrchr(_path, '/');
-	if(slash && slash > dot)
-		return false;
-
-	slash = strrchr(_path, '\\');
-	if(slash && slash > dot)
-		return false;
-
-	// We compare extensions, skip any dots
-	if(*dot == '.')
-		dot++;
-	if(*suffix == '.')
-		suffix++;
-
-#ifdef _WIN32
-	// On Windows paths are case-insensitive
-	return scumm_stricmp(dot, suffix) == 0;
-#else
-	return strcmp(dot, suffix) == 0;
-#endif
-}
-
-const char *Filename::getFullPath() const {
-	return _path;
-}
-
-const char *Filename::getFullName(char *out) const {
-	const char *slash;
-	if ((slash = strrchr(_path, '/')) || (slash = strrchr(_path, '\\'))) {
-		strcpy(out, slash + 1);
-		return out;
-	}
-	strcpy(out, _path);
-	return out;
-}
-
-const char *Filename::getFullName() const {
-	const char *slash;
-	if ((slash = strrchr(_path, '/')) || (slash = strrchr(_path, '\\'))) {
-		return slash + 1;
-	}
-	return _path;
-}
-
-const char *Filename::getPath(char *out) const {
-	const char *slash;
-	if ((slash = strrchr(_path, '/')) || (slash = strrchr(_path, '\\'))) {
-		int end = strlen(_path) - strlen(slash) + 1;
-		strncpy(out, _path, end);
-		out[end] = '\0';
-		return out;
-	}
-	// If there was no '/', this was a local path
-	out[0] = '\0';
-	return out;
-}
-
-void displayHelp(const char *msg, const char *exename) {
-	if (!msg) {
-		printf("\nUsage: %s [-o <output dir> = out/] <file 1> ... <file n>\n", exename);
-	}
-	else {
-		printf(msg, exename);
-	}
-	exit(2);
-}
-
-void parseHelpArguments(const char * const argv[], int argc, const char *msg) {
-	if (argc < 2 || strcmp(argv[1], "--help") == 0 || scumm_stricmp(argv[1], "-h") == 0) {
-		displayHelp(msg, argv[0]);
-	}
-}
-
-bool parseOutputArguments(Filename *outputname, bool output_directory, const char * const argv[], int argc, int start_arg) {
-	if (start_arg >= 0 && (strcmp(argv[start_arg], "-o") == 0 || strcmp(argv[start_arg], "--output") == 0)) {
-		/* It's a -o argument, can we check next arg? */
-
-		if (start_arg + 1 < argc) {
-			outputname->setFullPath(argv[start_arg + 1]);
-
-			if (output_directory) {
-				/* Ensure last character is a /, this way we force directory output */
-				char lastchr = outputname->getFullPath()[strlen(outputname->getFullPath()) - 1];
-				if (lastchr != '/' && lastchr != '\\') {
-					strcat(outputname->_path, "/");
-				}
-			} else {
-				char* lastchr = outputname->_path + strlen(outputname->getFullPath()) - 1;
-				if (*lastchr == '/' && *lastchr == '\\') {
-					*lastchr = '\0';
-				}
-			}
-			return true;
-		} else {
-			error("Expected directory path after '-o' or '--output'.");
-		}
-	}
-	return false;
-}
-
-bool parseOutputFileArguments(Filename *outputname, const char * const argv[], int argc, int start_arg) {
-	return parseOutputArguments(outputname, false, argv, argc, start_arg);
-}
-
-bool parseOutputDirectoryArguments(Filename *outputname, const char * const argv[], int argc, int start_arg) {
-	return parseOutputArguments(outputname, true, argv, argc, start_arg);
-}

Deleted: tools/trunk/engines/mohawk/utils/algorithm.h
===================================================================
--- tools/trunk/engines/mohawk/utils/algorithm.h	2010-01-14 23:42:40 UTC (rev 47301)
+++ tools/trunk/engines/mohawk/utils/algorithm.h	2010-01-15 03:11:35 UTC (rev 47302)
@@ -1,201 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- */
-
-#ifndef COMMON_ALGORITHM_H
-#define COMMON_ALGORITHM_H
-
-#include "../util.h"
-
-namespace Common {
-
-/**
- * Copies data from the range [first, last) to [dst, dst + (last - first)).
- * It requires the range [dst, dst + (last - first)) to be valid.
- * It also requires dst not to be in the range [first, last).
- */
-template<class In, class Out>
-Out copy(In first, In last, Out dst) {
-	while (first != last)
-		*dst++ = *first++;
-	return dst;
-}
-
-/**
- * Copies data from the range [first, last) to [dst - (last - first), dst).
- * It requires the range [dst - (last - first), dst) to be valid.
- * It also requires dst not to be in the range [first, last).
- *
- * Unlike copy copy_backward copies the data from the end to the beginning.
- */
-template<class In, class Out>
-Out copy_backward(In first, In last, Out dst) {
-	while (first != last)
-		*--dst = *--last;
-	return dst;
-}
-
-/**
- * Copies data from the range [first, last) to [dst, dst + (last - first)).
- * It requires the range [dst, dst + (last - first)) to be valid.
- * It also requires dst not to be in the range [first, last).
- *
- * Unlike copy or copy_backward it does not copy all data. It only copies
- * a data element when operator() of the op parameter returns true for the
- * passed data element.
- */
-template<class In, class Out, class Op>
-Out copy_if(In first, In last, Out dst, Op op) {
-	while (first != last) {
-		if (op(*first))
-			*dst++ = *first;
-		++first;
-	}
-	return dst;
-}
-
-// Our 'specialized' 'set_to' template for char, signed char and unsigned char arrays.
-// Since C++ doesn't support partial specialized template functions (currently) we
-// are going this way...
-// With this we assure the usage of memset for those, which should be
-// faster than a simple loop like for the generic 'set_to'.
-template<class Value>
-signed char *set_to(signed char *first, signed char *last, Value val) {
-	memset(first, (val & 0xFF), last - first);
-	return last;
-}
-
-template<class Value>
-unsigned char *set_to(unsigned char *first, unsigned char *last, Value val) {
-	memset(first, (val & 0xFF), last - first);
-	return last;
-}
-
-template<class Value>
-char *set_to(char *first, char *last, Value val) {
-	memset(first, (val & 0xFF), last - first);
-	return last;
-}
-
-/**
- * Sets all elements in the range [first, last) to val.
- */
-template<class In, class Value>
-In set_to(In first, In last, Value val) {
-	while (first != last)
-		*first++ = val;
-	return first;
-}
-
-/**
- * Finds the first data value in the range [first, last) matching v.
- * For data comperance it uses operator == of the data elements.
- */
-template<class In, class T>
-In find(In first, In last, const T &v) {
-	while (first != last) {
-		if (*first == v)
-			return first;
-		++first;
-	}
-	return last;
-}
-
-/**
- * Finds the first data value in the range [first, last) for which
- * the specified predicate p returns true.
- */
-template<class In, class Pred>
-In find_if(In first, In last, Pred p) {
-	while (first != last) {
-		if (p(*first))
-			return first;
-		++first;
-	}
-	return last;
-}
-
-/**
- * Applies the function f on all elements of the range [first, last).
- * The processing order is from beginning to end.
- */
-template<class In, class Op>
-Op for_each(In first, In last, Op f) {
-	while (first != last) f(*first++);
-	return f;
-}
-
-/**
- * Simple sort function, modeled after std::sort.
- * Use it like this: sort(container.begin(), container.end()).
- * Also works on plain old i.e. int arrays etc. For comperance
- * operator < is used.
- */
-template<class T>
-void sort(T first, T last) {
-	if (first == last)
-		return;
-
-	// Simple selection sort
-	T i(first);
-	for (; i != last; ++i) {
-		T minElem(i);
-		T j(i);
-		++j;
-		for (; j != last; ++j)
-			if (*j < *minElem)
-				minElem = j;
-		if (minElem != i)
-			SWAP(*minElem, *i);
-	}
-}
-
-/**
- * Simple sort function, modeled after std::sort.
- * It compares data with the given comparator object comp.
- *
- * Note: Using this with: Common::Less from common/func.h
- * will give the same results as the plain sort function.
- */
-template<class T, class StrictWeakOrdering>
-void sort(T first, T last, StrictWeakOrdering comp) {
-	if (first == last)
-		return;
-
-	// Simple selection sort
-	T i(first);
-	for (; i != last; ++i) {
-		T minElem(i);
-		T j(i);
-		++j;
-		for (; j != last; ++j)
-			if (comp(*j, *minElem))
-				minElem = j;
-		if (minElem != i)
-			SWAP(*minElem, *i);
-	}
-}
-
-} // End of namespace Common
-
-#endif

Deleted: tools/trunk/engines/mohawk/utils/array.h
===================================================================
--- tools/trunk/engines/mohawk/utils/array.h	2010-01-14 23:42:40 UTC (rev 47301)
+++ tools/trunk/engines/mohawk/utils/array.h	2010-01-15 03:11:35 UTC (rev 47302)
@@ -1,182 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- */
-
-#ifndef COMMON_ARRAY_H
-#define COMMON_ARRAY_H
-
-#include "utils/algorithm.h"
-
-namespace Common {
-
-template<class T>
-class Array {
-protected:
-	uint _capacity;
-	uint _size;
-	T *_storage;
-
-public:
-	typedef T *iterator;
-	typedef const T *const_iterator;
-
-	typedef T value_type;
-
-public:
-	Array() : _capacity(0), _size(0), _storage(0) {}
-	Array(const Array<T> &array) : _capacity(0), _size(0), _storage(0) {
-		_size = array._size;
-		_capacity = _size + 32;
-		_storage = new T[_capacity];
-		copy(array._storage, array._storage + _size, _storage);
-	}
-
-	~Array() {
-		delete[] _storage;
-	}
-
-	void push_back(const T &element) {
-		ensureCapacity(_size + 1);
-		_storage[_size++] = element;
-	}
-
-	void push_back(const Array<T> &array) {
-		ensureCapacity(_size + array._size);
-		copy(array._storage, array._storage + array._size, _storage + _size);
-		_size += array._size;
-	}
-
-	void insert_at(int idx, const T &element) {
-		assert(idx >= 0 && (uint)idx <= _size);
-		ensureCapacity(_size + 1);
-		copy_backward(_storage + idx, _storage + _size, _storage + _size + 1);
-		_storage[idx] = element;
-		_size++;
-	}
-
-	T remove_at(int idx) {
-		assert(idx >= 0 && (uint)idx < _size);
-		T tmp = _storage[idx];
-		copy(_storage + idx + 1, _storage + _size, _storage + idx);
-		_size--;
-		return tmp;
-	}
-
-	// TODO: insert, remove, ...
-
-	T& operator[](int idx) {
-		assert(idx >= 0 && (uint)idx < _size);
-		return _storage[idx];
-	}
-
-	const T& operator[](int idx) const {
-		assert(idx >= 0 && (uint)idx < _size);
-		return _storage[idx];
-	}
-
-	Array<T>& operator=(const Array<T> &array) {
-		if (this == &array)
-			return *this;
-
-		delete[] _storage;
-		_size = array._size;
-		_capacity = _size + 32;
-		_storage = new T[_capacity];
-		copy(array._storage, array._storage + _size, _storage);
-
-		return *this;
-	}
-
-	uint size() const {
-		return _size;
-	}
-
-	void clear() {
-		delete[] _storage;
-		_storage = 0;
-		_size = 0;
-		_capacity = 0;
-	}
-
-	bool empty() const {
-		return (_size == 0);
-	}
-
-
-	iterator		begin() {
-		return _storage;
-	}
-
-	iterator		end() {
-		return _storage + _size;
-	}
-
-	const_iterator	begin() const {
-		return _storage;
-	}
-
-	const_iterator	end() const {
-		return _storage + _size;
-	}
-
-	void reserve(uint newCapacity) {
-		if (newCapacity <= _capacity)
-			return;
-
-		T *old_storage = _storage;
-		_capacity = newCapacity;
-		_storage = new T[newCapacity];
-
-		if (old_storage) {
-			// Copy old data
-			copy(old_storage, old_storage + _size, _storage);
-			delete[] old_storage;
-		}
-	}
-
-	void resize(uint newSize) {
-		if (newSize == _size)
-			return;
-
-		T *old_storage = _storage;
-		_capacity = newSize;
-		_storage = new T[newSize];
-		if (old_storage) {
-			// Copy old data
-			int cnt = (_size < newSize ? _size : newSize);
-			copy(old_storage, old_storage + cnt, _storage);
-			delete[] old_storage;
-		}
-		_size = newSize;
-	}
-
-protected:
-	void ensureCapacity(uint len) {
-		if (len >= _capacity)
-			reserve(len + 32);
-	}
-};
-
-} // End of namespace Common
-
-#endif

Deleted: tools/trunk/engines/mohawk/utils/md5.cpp
===================================================================
--- tools/trunk/engines/mohawk/utils/md5.cpp	2010-01-14 23:42:40 UTC (rev 47301)
+++ tools/trunk/engines/mohawk/utils/md5.cpp	2010-01-15 03:11:35 UTC (rev 47302)
@@ -1,265 +0,0 @@
-/* Scumm Tools
- * Copyright (C) 2004-2006  The ScummVM Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/tools/branches/gsoc2009-gui/utils/md5.cpp $
- * $Id: md5.cpp 40868 2009-05-24 15:19:28Z lordhoto $
- *
- */
-
-#include "md5.h"
-
-namespace Common {
-
-#define GET_UINT32(n, b, i)	(n) = READ_LE_UINT32(b + i)
-#define PUT_UINT32(n, b, i)	WRITE_LE_UINT32(b + i, n)
-
-void md5_starts(md5_context *ctx) {
-	ctx->total[0] = 0;
-	ctx->total[1] = 0;
-
-	ctx->state[0] = 0x67452301;
-	ctx->state[1] = 0xEFCDAB89;
-	ctx->state[2] = 0x98BADCFE;
-	ctx->state[3] = 0x10325476;
-}
-
-static void md5_process(md5_context *ctx, const uint8 data[64]) {
-	uint32 X[16], A, B, C, D;
-
-	GET_UINT32(X[0],  data,  0);
-	GET_UINT32(X[1],  data,  4);
-	GET_UINT32(X[2],  data,  8);
-	GET_UINT32(X[3],  data, 12);
-	GET_UINT32(X[4],  data, 16);
-	GET_UINT32(X[5],  data, 20);
-	GET_UINT32(X[6],  data, 24);
-	GET_UINT32(X[7],  data, 28);
-	GET_UINT32(X[8],  data, 32);
-	GET_UINT32(X[9],  data, 36);
-	GET_UINT32(X[10], data, 40);
-	GET_UINT32(X[11], data, 44);
-	GET_UINT32(X[12], data, 48);
-	GET_UINT32(X[13], data, 52);
-	GET_UINT32(X[14], data, 56);
-	GET_UINT32(X[15], data, 60);
-
-#define S(x, n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
-
-#define P(a, b, c, d, k, s, t)                    \
-{                                                 \
-	a += F(b,c,d) + X[k] + t; a = S(a,s) + b; \
-}
-
-	A = ctx->state[0];
-	B = ctx->state[1];
-	C = ctx->state[2];
-	D = ctx->state[3];
-
-#define F(x, y, z) (z ^ (x & (y ^ z)))
-
-	P(A, B, C, D,  0,  7, 0xD76AA478);
-	P(D, A, B, C,  1, 12, 0xE8C7B756);
-	P(C, D, A, B,  2, 17, 0x242070DB);
-	P(B, C, D, A,  3, 22, 0xC1BDCEEE);
-	P(A, B, C, D,  4,  7, 0xF57C0FAF);
-	P(D, A, B, C,  5, 12, 0x4787C62A);
-	P(C, D, A, B,  6, 17, 0xA8304613);
-	P(B, C, D, A,  7, 22, 0xFD469501);
-	P(A, B, C, D,  8,  7, 0x698098D8);
-	P(D, A, B, C,  9, 12, 0x8B44F7AF);
-	P(C, D, A, B, 10, 17, 0xFFFF5BB1);
-	P(B, C, D, A, 11, 22, 0x895CD7BE);
-	P(A, B, C, D, 12,  7, 0x6B901122);
-	P(D, A, B, C, 13, 12, 0xFD987193);
-	P(C, D, A, B, 14, 17, 0xA679438E);
-	P(B, C, D, A, 15, 22, 0x49B40821);
-
-#undef F
-
-#define F(x, y, z) (y ^ (z & (x ^ y)))
-
-	P(A, B, C, D,  1,  5, 0xF61E2562);
-	P(D, A, B, C,  6,  9, 0xC040B340);
-	P(C, D, A, B, 11, 14, 0x265E5A51);
-	P(B, C, D, A,  0, 20, 0xE9B6C7AA);
-	P(A, B, C, D,  5,  5, 0xD62F105D);
-	P(D, A, B, C, 10,  9, 0x02441453);
-	P(C, D, A, B, 15, 14, 0xD8A1E681);
-	P(B, C, D, A,  4, 20, 0xE7D3FBC8);
-	P(A, B, C, D,  9,  5, 0x21E1CDE6);
-	P(D, A, B, C, 14,  9, 0xC33707D6);
-	P(C, D, A, B,  3, 14, 0xF4D50D87);
-	P(B, C, D, A,  8, 20, 0x455A14ED);
-	P(A, B, C, D, 13,  5, 0xA9E3E905);
-	P(D, A, B, C,  2,  9, 0xFCEFA3F8);
-	P(C, D, A, B,  7, 14, 0x676F02D9);
-	P(B, C, D, A, 12, 20, 0x8D2A4C8A);
-
-#undef F
-
-#define F(x, y, z) (x ^ y ^ z)
-
-	P(A, B, C, D,  5,  4, 0xFFFA3942);
-	P(D, A, B, C,  8, 11, 0x8771F681);
-	P(C, D, A, B, 11, 16, 0x6D9D6122);
-	P(B, C, D, A, 14, 23, 0xFDE5380C);
-	P(A, B, C, D,  1,  4, 0xA4BEEA44);
-	P(D, A, B, C,  4, 11, 0x4BDECFA9);
-	P(C, D, A, B,  7, 16, 0xF6BB4B60);
-	P(B, C, D, A, 10, 23, 0xBEBFBC70);
-	P(A, B, C, D, 13,  4, 0x289B7EC6);
-	P(D, A, B, C,  0, 11, 0xEAA127FA);
-	P(C, D, A, B,  3, 16, 0xD4EF3085);
-	P(B, C, D, A,  6, 23, 0x04881D05);
-	P(A, B, C, D,  9,  4, 0xD9D4D039);
-	P(D, A, B, C, 12, 11, 0xE6DB99E5);
-	P(C, D, A, B, 15, 16, 0x1FA27CF8);
-	P(B, C, D, A,  2, 23, 0xC4AC5665);
-
-#undef F
-
-#define F(x, y, z) (y ^ (x | ~z))
-
-	P(A, B, C, D,  0,  6, 0xF4292244);
-	P(D, A, B, C,  7, 10, 0x432AFF97);
-	P(C, D, A, B, 14, 15, 0xAB9423A7);
-	P(B, C, D, A,  5, 21, 0xFC93A039);
-	P(A, B, C, D, 12,  6, 0x655B59C3);
-	P(D, A, B, C,  3, 10, 0x8F0CCC92);
-	P(C, D, A, B, 10, 15, 0xFFEFF47D);
-	P(B, C, D, A,  1, 21, 0x85845DD1);
-	P(A, B, C, D,  8,  6, 0x6FA87E4F);
-	P(D, A, B, C, 15, 10, 0xFE2CE6E0);
-	P(C, D, A, B,  6, 15, 0xA3014314);
-	P(B, C, D, A, 13, 21, 0x4E0811A1);
-	P(A, B, C, D,  4,  6, 0xF7537E82);
-	P(D, A, B, C, 11, 10, 0xBD3AF235);
-	P(C, D, A, B,  2, 15, 0x2AD7D2BB);
-	P(B, C, D, A,  9, 21, 0xEB86D391);
-
-#undef F
-
-	ctx->state[0] += A;
-	ctx->state[1] += B;
-	ctx->state[2] += C;
-	ctx->state[3] += D;
-}
-
-void md5_update(md5_context *ctx, const uint8 *input, uint32 length) {
-	uint32 left, fill;
-
-	if (!length)
-		return;
-
-	left = ctx->total[0] & 0x3F;
-	fill = 64 - left;
-
-	ctx->total[0] += length;
-	ctx->total[0] &= 0xFFFFFFFF;
-
-	if (ctx->total[0] < length)
-		ctx->total[1]++;
-
-	if (left && length >= fill) {
-		memcpy((void *)(ctx->buffer + left), (const void *)input, fill);
-		md5_process(ctx, ctx->buffer);
-		length -= fill;
-		input  += fill;
-		left = 0;
-	}
-
-	while (length >= 64) {
-		md5_process(ctx, input);
-		length -= 64;
-		input  += 64;
-	}
-
-	if (length) {
-		memcpy((void *)(ctx->buffer + left), (const void *)input, length);
-	}
-}
-
-static const uint8 md5_padding[64] = {
-	0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-void md5_finish(md5_context *ctx, uint8 digest[16]) {
-	uint32 last, padn;
-	uint32 high, low;
-	uint8 msglen[8];
-
-	high = (ctx->total[0] >> 29) | (ctx->total[1] << 3);
-	low  = (ctx->total[0] <<  3);
-
-	PUT_UINT32(low,  msglen, 0);
-	PUT_UINT32(high, msglen, 4);
-
-	last = ctx->total[0] & 0x3F;
-	padn = (last < 56) ? (56 - last) : (120 - last);
-
-	md5_update(ctx, md5_padding, padn);
-	md5_update(ctx, msglen, 8);
-
-	PUT_UINT32(ctx->state[0], digest,  0);
-	PUT_UINT32(ctx->state[1], digest,  4);
-	PUT_UINT32(ctx->state[2], digest,  8);
-	PUT_UINT32(ctx->state[3], digest, 12);
-}
-
-bool md5_file(const char *name, uint8 digest[16], uint32 length) {
-	FILE *f;
-
-	f = fopen(name, "rb");
-	if (f == NULL) {
-		printf("md5_file couldn't open '%s'", name);
-		return false;
-	}
-
-	md5_context ctx;
-	uint32 i;
-	unsigned char buf[1000];
-	bool restricted = (length != 0);
-	int readlen;
-
-	if (!restricted || sizeof(buf) <= length)
-		readlen = sizeof(buf);
-	else
-		readlen = length;
-
-	md5_starts(&ctx);
-
-
-	while ((i = (uint32)fread(buf, 1, readlen, f)) > 0) {
-		md5_update(&ctx, buf, i);
-
-		length -= i;
-		if (restricted && length == 0)
-			break;
-
-		if (restricted && sizeof(buf) > length)
-			readlen = length;
-	}
-
-	md5_finish(&ctx, digest);
-	fclose(f);
-	return true;
-}
-
-}

Deleted: tools/trunk/engines/mohawk/utils/md5.h
===================================================================
--- tools/trunk/engines/mohawk/utils/md5.h	2010-01-14 23:42:40 UTC (rev 47301)
+++ tools/trunk/engines/mohawk/utils/md5.h	2010-01-15 03:11:35 UTC (rev 47302)
@@ -1,44 +0,0 @@
-/* Scumm Tools
- * Copyright (C) 2004-2006  The ScummVM Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/tools/branches/gsoc2009-gui/utils/md5.h $
- * $Id: md5.h 23138 2006-06-15 15:44:06Z h00ligan $
- *
- */
-
-#ifndef COMMON_MD5_H
-#define COMMON_MD5_H
-
-#include "../util.h"
-
-namespace Common {
-
-typedef struct {
-	uint32 total[2];
-	uint32 state[4];
-	uint8 buffer[64];
-} md5_context;
-
-void md5_starts(md5_context *ctx);
-void md5_update(md5_context *ctx, const uint8 *input, uint32 length);
-void md5_finish(md5_context *ctx, uint8 digest[16]);
-
-bool md5_file(const char *name, uint8 digest[16], uint32 length = 0);
-
-} // End of namespace Common
-
-#endif

Deleted: tools/trunk/engines/mohawk/utils/pack-end.h
===================================================================
--- tools/trunk/engines/mohawk/utils/pack-end.h	2010-01-14 23:42:40 UTC (rev 47301)
+++ tools/trunk/engines/mohawk/utils/pack-end.h	2010-01-15 03:11:35 UTC (rev 47302)
@@ -1,25 +0,0 @@
-/* ScummVM Tools
- * Copyright (C) 2002-2009 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/tools/trunk/common/pack-end.h $
- * $Id: pack-end.h 46360 2009-12-13 20:09:16Z fingolfin $
- *
- */
-
-#if defined(SCUMMVM_USE_PRAGMA_PACK)
-  #pragma pack()
-#endif

Deleted: tools/trunk/engines/mohawk/utils/pack-start.h
===================================================================
--- tools/trunk/engines/mohawk/utils/pack-start.h	2010-01-14 23:42:40 UTC (rev 47301)
+++ tools/trunk/engines/mohawk/utils/pack-start.h	2010-01-15 03:11:35 UTC (rev 47302)
@@ -1,25 +0,0 @@
-/* ScummVM Tools
- * Copyright (C) 2002-2009 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/tools/trunk/common/pack-start.h $
- * $Id: pack-start.h 46360 2009-12-13 20:09:16Z fingolfin $
- *
- */
-
-#if defined(SCUMMVM_USE_PRAGMA_PACK)
-  #pragma pack(1)
-#endif

Modified: tools/trunk/engines/mohawk/utils/str.cpp
===================================================================
--- tools/trunk/engines/mohawk/utils/str.cpp	2010-01-14 23:42:40 UTC (rev 47301)
+++ tools/trunk/engines/mohawk/utils/str.cpp	2010-01-15 03:11:35 UTC (rev 47302)
@@ -22,9 +22,12 @@
  * $Id$
  */
 
-#include "utils/str.h"
-#include "utils/util.h"
+#include "str.h"
+#include "util.h"
 
+//#include "engines/mohawk/utils/str.h"
+//#include "engines/mohawk/utils/util.h"
+
 #if !defined(__SYMBIAN32__)
 #include <new>
 #endif

Modified: tools/trunk/engines/mohawk/utils/str.h
===================================================================
--- tools/trunk/engines/mohawk/utils/str.h	2010-01-14 23:42:40 UTC (rev 47301)
+++ tools/trunk/engines/mohawk/utils/str.h	2010-01-15 03:11:35 UTC (rev 47302)
@@ -25,7 +25,7 @@
 #ifndef COMMON_STRING_H
 #define COMMON_STRING_H
 
-#include "utils/array.h"
+#include "common/array.h"
 
 namespace Common {
 

Modified: tools/trunk/engines/mohawk/utils/voc.h
===================================================================
--- tools/trunk/engines/mohawk/utils/voc.h	2010-01-14 23:42:40 UTC (rev 47301)
+++ tools/trunk/engines/mohawk/utils/voc.h	2010-01-15 03:11:35 UTC (rev 47302)
@@ -31,7 +31,7 @@
 
 class AudioStream;
 
-#include "pack-start.h"	/* START STRUCT PACKING */
+#include "common/pack-start.h"	/* START STRUCT PACKING */
 
 struct VocFileHeader {
 	uint8 desc[20];
@@ -47,7 +47,7 @@
 	uint8 pack;
 } GCC_PACK;
 
-#include "pack-end.h"	/* END STRUCT PACKING */
+#include "common/pack-end.h"	/* END STRUCT PACKING */
 
 /**
  * Take a sample rate parameter as it occurs in a VOC sound header, and


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list