Transition from QtCore to stdc++ / STL / boost

This looks like a pretty major change, but in reality,
80% of it is just renames of types and corresponding
methods.

The config parsing code has been completely replaced
with a boost::program_options based version. This
means that the config file format slightly changed
(checkout the updated README).

I still expect there to be bugs / unforseen events.
Those should be fixed in follow up commits.

Also, finally reverted back to using pkg-config to
locate and link libruby. Yay for less hacks!
This commit is contained in:
Jonas Kulla 2013-12-11 20:46:54 +01:00
parent 01529c5741
commit 2adf8ab265
40 changed files with 722 additions and 456 deletions

View file

@ -21,6 +21,8 @@
#include "file.h"
#include "debugwriter.h"
#include "../binding-util.h"
#include <mruby/string.h>
#include <mruby/array.h>
@ -36,8 +38,6 @@
#include <vector>
#include <QDebug>
extern mrb_value timeFromSecondsInt(mrb_state *mrb, time_t seconds);
static void
@ -87,7 +87,7 @@ getOpenMode(const char *mode)
STR_CASE("a", Write)
STR_CASE("a+", ReadWrite)
qDebug() << "getOpenMode failed for:" << mode;
Debug() << "getOpenMode failed for:" << mode;
return 0;
}
@ -225,7 +225,7 @@ MRB_FUNCTION(fileExpandPath)
// FIXME No idea how to integrate 'default_dir' right now
if (defDir)
qDebug() << "FIXME: File.expand_path: default_dir not implemented";
Debug() << "FIXME: File.expand_path: default_dir not implemented";
char buffer[512];
char *unused = realpath(path, buffer);
@ -457,7 +457,7 @@ MRB_METHOD(fileReadLines)
const char *rs = "\n"; (void) rs;
if (mrb->c->ci->argc > 0)
{
qDebug() << "FIXME: File.readlines: rs not implemented";
Debug() << "FIXME: File.readlines: rs not implemented";
if (mrb_string_p(arg))
rs = RSTRING_PTR(arg);

View file

@ -36,8 +36,6 @@
#include "filesystem.h"
#include "binding.h"
#include <QDebug>
void mrbBindingTerminate();
MRB_FUNCTION(kernelEval)

View file

@ -38,14 +38,11 @@
#include "file.h"
#include "rwmem.h"
#include "exception.h"
#include "boost-hash.h"
#include "debugwriter.h"
#include <SDL_timer.h>
#include <QHash>
#include <QByteArray>
#include <QDebug>
#define MARSHAL_MAJOR 4
#define MARSHAL_MINOR 8
@ -76,9 +73,9 @@
// FIXME make these dynamically allocatd, per MarshalContext
static char gpbuffer[512];
inline uint qHash(mrb_value key)
inline size_t hash_value(mrb_value key)
{
return qHash(key.value.p);
return boost::hash_value(key.value.p);
}
inline bool operator==(mrb_value v1, mrb_value v2)
@ -109,7 +106,7 @@ template<typename T>
struct LinkBuffer
{
/* Key: val, Value: idx in vec */
QHash<T, int> hash;
BoostHash<T, int> hash;
std::vector<T> vec;
bool contains(T value)
@ -551,9 +548,8 @@ read_value(MarshalContext *ctx)
break;
default :
qDebug() << "Value type" << (char)type << "not supported!";
throw Exception(Exception::MKXPError, "Marshal.load: unsupported value type '%s'",
QByteArray(1, (char)type));
std::string(1, (char)type));
}
mrb_gc_arena_restore(mrb, arena);
@ -973,7 +969,7 @@ MRB_FUNCTION(marshalLoad)
}
else
{
qDebug() << "FIXME: Marshal.load: generic IO port not implemented";
Debug() << "FIXME: Marshal.load: generic IO port not implemented";
return mrb_nil_value();
}