mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-16 08:42:23 +00:00
Updated monster to 0.10
git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@69 ea6a568a-9f4f-0410-981a-c910a81bb256
This commit is contained in:
parent
853ee212bd
commit
2f07faf00e
@ -107,7 +107,7 @@ enum TT
|
|||||||
Switch,
|
Switch,
|
||||||
Select,
|
Select,
|
||||||
State,
|
State,
|
||||||
Singleton,
|
Singleton, Clone,
|
||||||
This, New, Static, Const, Out, Ref, Abstract, Idle,
|
This, New, Static, Const, Out, Ref, Abstract, Idle,
|
||||||
Public, Private, Protected, True, False, Native, Null,
|
Public, Private, Protected, True, False, Native, Null,
|
||||||
Goto, Halt, Auto, Var, In,
|
Goto, Halt, Auto, Var, In,
|
||||||
@ -218,6 +218,7 @@ const char[][] tokenList =
|
|||||||
TT.State : "state",
|
TT.State : "state",
|
||||||
TT.Typeof : "typeof",
|
TT.Typeof : "typeof",
|
||||||
TT.Singleton : "singleton",
|
TT.Singleton : "singleton",
|
||||||
|
TT.Singleton : "clone",
|
||||||
TT.Static : "static",
|
TT.Static : "static",
|
||||||
TT.Const : "const",
|
TT.Const : "const",
|
||||||
TT.Abstract : "abstract",
|
TT.Abstract : "abstract",
|
||||||
@ -361,6 +362,13 @@ class StreamTokenizer
|
|||||||
|
|
||||||
assert(line.length > 0);
|
assert(line.length > 0);
|
||||||
|
|
||||||
|
// Skip the first line if it begins with #!
|
||||||
|
if(lineNum == 1 && line.begins("#!"))
|
||||||
|
{
|
||||||
|
line = null;
|
||||||
|
goto restart;
|
||||||
|
}
|
||||||
|
|
||||||
if(mode == Block)
|
if(mode == Block)
|
||||||
{
|
{
|
||||||
int index = line.find("*/");
|
int index = line.find("*/");
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
svn export ../../../monster/trunk/monster/ . --force
|
||||||
|
rm -r minibos vm/c_api.d
|
||||||
|
|
||||||
for a in $(find -iname \*.d); do
|
for a in $(find -iname \*.d); do
|
||||||
cat "$a" | sed s/monster.minibos./std./g > "$a"_new
|
cat "$a" | sed s/monster.minibos./std./g > "$a"_new
|
||||||
mv "$a"_new "$a"
|
mv "$a"_new "$a"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
svn st
|
@ -23,6 +23,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
module monster.util.string;
|
module monster.util.string;
|
||||||
|
|
||||||
|
import std.utf;
|
||||||
import std.string;
|
import std.string;
|
||||||
|
|
||||||
// These functions check whether a string begins or ends with a
|
// 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.freelist;
|
||||||
import monster.util.flags;
|
import monster.util.flags;
|
||||||
import monster.vm.error;
|
import monster.vm.error;
|
||||||
|
import monster.vm.mobject;
|
||||||
|
|
||||||
import std.string;
|
import std.string;
|
||||||
import std.uni;
|
import std.uni;
|
||||||
@ -152,6 +153,7 @@ struct Arrays
|
|||||||
alias createT!(double) create;
|
alias createT!(double) create;
|
||||||
alias createT!(dchar) create;
|
alias createT!(dchar) create;
|
||||||
alias createT!(AIndex) create;
|
alias createT!(AIndex) create;
|
||||||
|
alias createT!(MIndex) create;
|
||||||
|
|
||||||
ArrayRef *create(char[] arg)
|
ArrayRef *create(char[] arg)
|
||||||
{ return create(toUTF32(arg)); }
|
{ return create(toUTF32(arg)); }
|
||||||
|
@ -97,7 +97,7 @@ final class MonsterClass
|
|||||||
// TODO: These will probably be moved elsewhere.
|
// TODO: These will probably be moved elsewhere.
|
||||||
|
|
||||||
// Path to search for script files. Extremely simple at the moment.
|
// Path to search for script files. Extremely simple at the moment.
|
||||||
static char[][] includes = [""];
|
private static char[][] includes = [""];
|
||||||
|
|
||||||
static void addPath(char[] path)
|
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
|
// By default we leave the loadType at None. This leaves us open to
|
||||||
// define the class later. Calling eg. setName will define the class
|
// 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() {}
|
||||||
|
|
||||||
this(MC type, char[] name1, char[] name2 = "", bool usePath = true)
|
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(char[] nam1, char[] nam2 = "", bool usePath=true)
|
||||||
{ this(MC.File, nam1, nam2, usePath); }
|
{ 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; }
|
{ bind_locate(name, FuncType.NativeDFunc).natFunc_fn = nf; }
|
||||||
|
|
||||||
// Used for C functions
|
// 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_locate(name, FuncType.NativeCFunc).natFunc_c = nf; }
|
||||||
|
|
||||||
// Bind an idle function
|
// Bind an idle function
|
||||||
@ -390,7 +387,7 @@ final class MonsterClass
|
|||||||
fn_const = nf;
|
fn_const = nf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bindConst(c_callback nf)
|
void bindConst_c(c_callback nf)
|
||||||
{
|
{
|
||||||
assert(constType == FuncType.Native,
|
assert(constType == FuncType.Native,
|
||||||
"Cannot set native constructor for " ~ toString ~ ": already set");
|
"Cannot set native constructor for " ~ toString ~ ": already set");
|
||||||
|
@ -256,6 +256,7 @@ struct CodeStack
|
|||||||
void pushFArray(float[] str) { pushArray(arrays.create(str)); }
|
void pushFArray(float[] str) { pushArray(arrays.create(str)); }
|
||||||
void pushDArray(double[] str) { pushArray(arrays.create(str)); }
|
void pushDArray(double[] str) { pushArray(arrays.create(str)); }
|
||||||
void pushAArray(AIndex[] 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 pushCArray pushArray, pushString;
|
||||||
alias pushIArray pushArray;
|
alias pushIArray pushArray;
|
||||||
@ -278,7 +279,6 @@ struct CodeStack
|
|||||||
void pushArray(int[] str, int size)
|
void pushArray(int[] str, int size)
|
||||||
{ pushArray(arrays.create(str, size)); }
|
{ pushArray(arrays.create(str, size)); }
|
||||||
|
|
||||||
|
|
||||||
// Various convenient conversion templates. These will be inlined,
|
// Various convenient conversion templates. These will be inlined,
|
||||||
// so don't worry :) The *4() functions are for types that are 4
|
// so don't worry :) The *4() functions are for types that are 4
|
||||||
// bytes long. These are mostly intended for use in native
|
// bytes long. These are mostly intended for use in native
|
||||||
@ -321,9 +321,9 @@ struct CodeStack
|
|||||||
|
|
||||||
// Template conversions
|
// Template conversions
|
||||||
|
|
||||||
alias push4!(MIndex) pushIndex;
|
alias push4!(MIndex) pushMIndex;
|
||||||
alias pop4!(MIndex) popIndex;
|
alias pop4!(MIndex) popMIndex;
|
||||||
alias get4!(MIndex) getIndex;
|
alias get4!(MIndex) getMIndex;
|
||||||
|
|
||||||
alias push4!(AIndex) pushAIndex;
|
alias push4!(AIndex) pushAIndex;
|
||||||
alias pop4!(AIndex) popAIndex;
|
alias pop4!(AIndex) popAIndex;
|
||||||
@ -391,6 +391,7 @@ struct CodeStack
|
|||||||
writefln();
|
writefln();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
void overflow(char[] func)
|
void overflow(char[] func)
|
||||||
{
|
{
|
||||||
char[] res;
|
char[] res;
|
||||||
|
@ -304,7 +304,7 @@ struct CodeThread
|
|||||||
// reference is on the stack.
|
// reference is on the stack.
|
||||||
if(type == PT.FarDataOffs)
|
if(type == PT.FarDataOffs)
|
||||||
{
|
{
|
||||||
int clsIndex = stack.popIndex();
|
int clsIndex = stack.popInt();
|
||||||
|
|
||||||
// Get the object reference from the stack
|
// Get the object reference from the stack
|
||||||
MonsterObject *tmp = stack.popObject();
|
MonsterObject *tmp = stack.popObject();
|
||||||
@ -321,7 +321,7 @@ struct CodeThread
|
|||||||
{
|
{
|
||||||
assert(index==0);
|
assert(index==0);
|
||||||
// Array indices are on the stack, not in the opcode.
|
// Array indices are on the stack, not in the opcode.
|
||||||
index = stack.popIndex();
|
index = stack.popInt();
|
||||||
ArrayRef *arf = stack.popArray();
|
ArrayRef *arf = stack.popArray();
|
||||||
assert(!arf.isNull);
|
assert(!arf.isNull);
|
||||||
if(arf.isConst)
|
if(arf.isConst)
|
||||||
@ -537,7 +537,7 @@ struct CodeThread
|
|||||||
|
|
||||||
case BC.PushThis:
|
case BC.PushThis:
|
||||||
// Push the index of this object.
|
// Push the index of this object.
|
||||||
stack.pushIndex(obj.getIndex());
|
stack.pushObject(obj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BC.Pop: stack.popInt(); break;
|
case BC.Pop: stack.popInt(); break;
|
||||||
@ -957,7 +957,7 @@ struct CodeThread
|
|||||||
|
|
||||||
case BC.CastO2S:
|
case BC.CastO2S:
|
||||||
{
|
{
|
||||||
MIndex idx = stack.popIndex();
|
MIndex idx = stack.popMIndex();
|
||||||
if(idx != 0)
|
if(idx != 0)
|
||||||
stack.pushArray(format("%s#%s", getMObject(idx).cls.getName,
|
stack.pushArray(format("%s#%s", getMObject(idx).cls.getName,
|
||||||
cast(int)idx));
|
cast(int)idx));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user