Updated monster to 0.10

git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@69 ea6a568a-9f4f-0410-981a-c910a81bb256
pull/7/head
nkorslund 16 years ago
parent 853ee212bd
commit 2f07faf00e

@ -107,7 +107,7 @@ enum TT
Switch,
Select,
State,
Singleton,
Singleton, Clone,
This, New, Static, Const, Out, Ref, Abstract, Idle,
Public, Private, Protected, True, False, Native, Null,
Goto, Halt, Auto, Var, In,
@ -218,6 +218,7 @@ const char[][] tokenList =
TT.State : "state",
TT.Typeof : "typeof",
TT.Singleton : "singleton",
TT.Singleton : "clone",
TT.Static : "static",
TT.Const : "const",
TT.Abstract : "abstract",
@ -361,6 +362,13 @@ class StreamTokenizer
assert(line.length > 0);
// Skip the first line if it begins with #!
if(lineNum == 1 && line.begins("#!"))
{
line = null;
goto restart;
}
if(mode == Block)
{
int index = line.find("*/");

@ -1,6 +1,11 @@
#!/bin/bash
svn export ../../../monster/trunk/monster/ . --force
rm -r minibos vm/c_api.d
for a in $(find -iname \*.d); do
cat "$a" | sed s/monster.minibos./std./g > "$a"_new
mv "$a"_new "$a"
done
svn st

@ -23,6 +23,8 @@
*/
module monster.util.string;
import std.utf;
import std.string;
// These functions check whether a string begins or ends with a

@ -26,6 +26,7 @@ import monster.vm.stack;
import monster.util.freelist;
import monster.util.flags;
import monster.vm.error;
import monster.vm.mobject;
import std.string;
import std.uni;
@ -152,6 +153,7 @@ struct Arrays
alias createT!(double) create;
alias createT!(dchar) create;
alias createT!(AIndex) create;
alias createT!(MIndex) create;
ArrayRef *create(char[] arg)
{ return create(toUTF32(arg)); }

@ -97,7 +97,7 @@ final class MonsterClass
// TODO: These will probably be moved elsewhere.
// Path to search for script files. Extremely simple at the moment.
static char[][] includes = [""];
private static char[][] includes = [""];
static void addPath(char[] path)
{
@ -216,7 +216,7 @@ final class MonsterClass
// By default we leave the loadType at None. This leaves us open to
// define the class later. Calling eg. setName will define the class
// as a manual class.
// as a manual class. This isn't supported yet though.
this() {}
this(MC type, char[] name1, char[] name2 = "", bool usePath = true)
@ -266,9 +266,6 @@ final class MonsterClass
this(char[] nam1, char[] nam2 = "", bool usePath=true)
{ this(MC.File, nam1, nam2, usePath); }
// Used when binding to classes in other languages.
this(MClass cpp, char* nam1, char* nam2 = null) { assert(0); }
/*******************************************************
* *
@ -324,7 +321,7 @@ final class MonsterClass
{ bind_locate(name, FuncType.NativeDFunc).natFunc_fn = nf; }
// Used for C functions
void bind(char[] name, c_callback nf)
void bind_c(char[] name, c_callback nf)
{ bind_locate(name, FuncType.NativeCFunc).natFunc_c = nf; }
// Bind an idle function
@ -390,7 +387,7 @@ final class MonsterClass
fn_const = nf;
}
void bindConst(c_callback nf)
void bindConst_c(c_callback nf)
{
assert(constType == FuncType.Native,
"Cannot set native constructor for " ~ toString ~ ": already set");

@ -256,6 +256,7 @@ struct CodeStack
void pushFArray(float[] str) { pushArray(arrays.create(str)); }
void pushDArray(double[] str) { pushArray(arrays.create(str)); }
void pushAArray(AIndex[] str) { pushArray(arrays.create(str)); }
void pushMArray(AIndex[] str) { pushArray(arrays.create(str)); }
alias pushCArray pushArray, pushString;
alias pushIArray pushArray;
@ -278,7 +279,6 @@ struct CodeStack
void pushArray(int[] str, int size)
{ pushArray(arrays.create(str, size)); }
// Various convenient conversion templates. These will be inlined,
// so don't worry :) The *4() functions are for types that are 4
// bytes long. These are mostly intended for use in native
@ -321,9 +321,9 @@ struct CodeStack
// Template conversions
alias push4!(MIndex) pushIndex;
alias pop4!(MIndex) popIndex;
alias get4!(MIndex) getIndex;
alias push4!(MIndex) pushMIndex;
alias pop4!(MIndex) popMIndex;
alias get4!(MIndex) getMIndex;
alias push4!(AIndex) pushAIndex;
alias pop4!(AIndex) popAIndex;
@ -391,6 +391,7 @@ struct CodeStack
writefln();
}
private:
void overflow(char[] func)
{
char[] res;

@ -304,7 +304,7 @@ struct CodeThread
// reference is on the stack.
if(type == PT.FarDataOffs)
{
int clsIndex = stack.popIndex();
int clsIndex = stack.popInt();
// Get the object reference from the stack
MonsterObject *tmp = stack.popObject();
@ -321,7 +321,7 @@ struct CodeThread
{
assert(index==0);
// Array indices are on the stack, not in the opcode.
index = stack.popIndex();
index = stack.popInt();
ArrayRef *arf = stack.popArray();
assert(!arf.isNull);
if(arf.isConst)
@ -537,7 +537,7 @@ struct CodeThread
case BC.PushThis:
// Push the index of this object.
stack.pushIndex(obj.getIndex());
stack.pushObject(obj);
break;
case BC.Pop: stack.popInt(); break;
@ -957,7 +957,7 @@ struct CodeThread
case BC.CastO2S:
{
MIndex idx = stack.popIndex();
MIndex idx = stack.popMIndex();
if(idx != 0)
stack.pushArray(format("%s#%s", getMObject(idx).cls.getName,
cast(int)idx));

Loading…
Cancel
Save