Remove unused C4Object* parameter from C4AulExecError

rope
Günther Brammer 2012-05-15 03:11:23 +02:00
parent c86eadf5eb
commit 0e6f972de4
12 changed files with 83 additions and 92 deletions

View File

@ -497,15 +497,15 @@ void C4Effect::SetPropertyByS(C4String * k, const C4Value & to)
{ {
case P_Name: case P_Name:
if (!to.getStr() || !*to.getStr()->GetCStr()) if (!to.getStr() || !*to.getStr()->GetCStr())
throw new C4AulExecError(0, "effect: Name has to be a nonempty string"); throw new C4AulExecError("effect: Name has to be a nonempty string");
C4PropListNumbered::SetPropertyByS(k, to); C4PropListNumbered::SetPropertyByS(k, to);
ReAssignCallbackFunctions(); ReAssignCallbackFunctions();
return; return;
case P_Priority: case P_Priority:
throw new C4AulExecError(0, "effect: Priority is readonly"); throw new C4AulExecError("effect: Priority is readonly");
case P_Interval: iInterval = to.getInt(); return; case P_Interval: iInterval = to.getInt(); return;
case P_CommandTarget: case P_CommandTarget:
throw new C4AulExecError(0, "effect: CommandTarget is readonly"); throw new C4AulExecError("effect: CommandTarget is readonly");
case P_Time: iTime = to.getInt(); return; case P_Time: iTime = to.getInt(); return;
} }
} }
@ -519,12 +519,12 @@ void C4Effect::ResetProperty(C4String * k)
switch(k - &Strings.P[0]) switch(k - &Strings.P[0])
{ {
case P_Name: case P_Name:
throw new C4AulExecError(0, "effect: Name has to be a nonempty string"); throw new C4AulExecError("effect: Name has to be a nonempty string");
case P_Priority: case P_Priority:
throw new C4AulExecError(0, "effect: Priority is readonly"); throw new C4AulExecError("effect: Priority is readonly");
case P_Interval: iInterval = 0; return; case P_Interval: iInterval = 0; return;
case P_CommandTarget: case P_CommandTarget:
throw new C4AulExecError(0, "effect: CommandTarget is readonly"); throw new C4AulExecError("effect: CommandTarget is readonly");
case P_Time: iTime = 0; return; case P_Time: iTime = 0; return;
} }
} }

View File

@ -281,7 +281,7 @@ static C4Value FnObjectCount(C4AulContext *cthr, C4Value *pPars)
C4FindObject *pFO = CreateCriterionsFromPars(pPars, pFOs, NULL); C4FindObject *pFO = CreateCriterionsFromPars(pPars, pFOs, NULL);
// Error? // Error?
if (!pFO) if (!pFO)
throw new C4AulExecError(cthr->Obj, "ObjectCount: No valid search criterions supplied"); throw new C4AulExecError("ObjectCount: No valid search criterions supplied");
// Search // Search
int32_t iCnt = pFO->Count(::Objects, ::Objects.Sectors); int32_t iCnt = pFO->Count(::Objects, ::Objects.Sectors);
// Free // Free
@ -298,7 +298,7 @@ static C4Value FnFindObject(C4AulContext *cthr, C4Value *pPars)
C4FindObject *pFO = CreateCriterionsFromPars(pPars, pFOs, pSOs); C4FindObject *pFO = CreateCriterionsFromPars(pPars, pFOs, pSOs);
// Error? // Error?
if (!pFO) if (!pFO)
throw new C4AulExecError(cthr->Obj, "FindObject: No valid search criterions supplied"); throw new C4AulExecError("FindObject: No valid search criterions supplied");
// Search // Search
C4Object *pObj = pFO->Find(::Objects, ::Objects.Sectors); C4Object *pObj = pFO->Find(::Objects, ::Objects.Sectors);
// Free // Free
@ -315,7 +315,7 @@ static C4Value FnFindObjects(C4AulContext *cthr, C4Value *pPars)
C4FindObject *pFO = CreateCriterionsFromPars(pPars, pFOs, pSOs); C4FindObject *pFO = CreateCriterionsFromPars(pPars, pFOs, pSOs);
// Error? // Error?
if (!pFO) if (!pFO)
throw new C4AulExecError(cthr->Obj, "FindObjects: No valid search criterions supplied"); throw new C4AulExecError("FindObjects: No valid search criterions supplied");
// Search // Search
C4ValueArray *pResult = pFO->FindMany(::Objects, ::Objects.Sectors); C4ValueArray *pResult = pFO->FindMany(::Objects, ::Objects.Sectors);
// Free // Free
@ -2186,11 +2186,11 @@ static bool FnCustomMessage(C4AulContext *ctx, C4String *pMsg, C4Object *pObj, N
uint32_t vpos = dwFlags & (C4GM_Top | C4GM_VCenter | C4GM_Bottom); uint32_t vpos = dwFlags & (C4GM_Top | C4GM_VCenter | C4GM_Bottom);
if (((hpos | (hpos-1)) + 1)>>1 != hpos) if (((hpos | (hpos-1)) + 1)>>1 != hpos)
{ {
throw new C4AulExecError(ctx->Obj, "CustomMessage: Only one horizontal positioning flag allowed"); throw new C4AulExecError("CustomMessage: Only one horizontal positioning flag allowed");
} }
if (((vpos | (vpos-1)) + 1)>>1 != vpos) if (((vpos | (vpos-1)) + 1)>>1 != vpos)
{ {
throw new C4AulExecError(ctx->Obj, "CustomMessage: Only one vertical positioning flag allowed"); throw new C4AulExecError("CustomMessage: Only one vertical positioning flag allowed");
} }
// message color // message color
if (!dwClr) dwClr = 0xffffffff; if (!dwClr) dwClr = 0xffffffff;

View File

@ -52,18 +52,18 @@ StdMeshInstance::ValueProvider* CreateValueProviderFromArray(C4Object* pForObj,
return new C4ValueProviderConst(itofix(Data[1].getInt(), 1000)); return new C4ValueProviderConst(itofix(Data[1].getInt(), 1000));
case C4AVP_Linear: case C4AVP_Linear:
if (Data[4].getInt() == 0) if (Data[4].getInt() == 0)
throw new C4AulExecError(pForObj, "Length cannot be zero"); throw new C4AulExecError("Length cannot be zero");
return new C4ValueProviderLinear(itofix(Data[1].getInt(), 1000), itofix(Data[2].getInt(), 1000), itofix(Data[3].getInt(), 1000), Data[4].getInt(), static_cast<C4AnimationEnding>(Data[5].getInt())); return new C4ValueProviderLinear(itofix(Data[1].getInt(), 1000), itofix(Data[2].getInt(), 1000), itofix(Data[3].getInt(), 1000), Data[4].getInt(), static_cast<C4AnimationEnding>(Data[5].getInt()));
case C4AVP_X: case C4AVP_X:
if (!pForObj) return NULL; if (!pForObj) return NULL;
if (Data[4].getInt() == 0) if (Data[4].getInt() == 0)
throw new C4AulExecError(pForObj, "Length cannot be zero"); throw new C4AulExecError("Length cannot be zero");
return new C4ValueProviderX(pForObj, itofix(Data[1].getInt(), 1000), itofix(Data[2].getInt(), 1000), itofix(Data[3].getInt(), 1000), Data[4].getInt()); return new C4ValueProviderX(pForObj, itofix(Data[1].getInt(), 1000), itofix(Data[2].getInt(), 1000), itofix(Data[3].getInt(), 1000), Data[4].getInt());
case C4AVP_Y: case C4AVP_Y:
if (!pForObj) return NULL; if (!pForObj) return NULL;
if (Data[4].getInt() == 0) if (Data[4].getInt() == 0)
throw new C4AulExecError(pForObj, "Length cannot be zero"); throw new C4AulExecError("Length cannot be zero");
return new C4ValueProviderY(pForObj, itofix(Data[1].getInt(), 1000), itofix(Data[2].getInt(), 1000), itofix(Data[3].getInt(), 1000), Data[4].getInt()); return new C4ValueProviderY(pForObj, itofix(Data[1].getInt(), 1000), itofix(Data[2].getInt(), 1000), itofix(Data[3].getInt(), 1000), Data[4].getInt());
case C4AVP_R: case C4AVP_R:
@ -74,27 +74,27 @@ StdMeshInstance::ValueProvider* CreateValueProviderFromArray(C4Object* pForObj,
case C4AVP_AbsX: case C4AVP_AbsX:
if (!pForObj) return NULL; if (!pForObj) return NULL;
if (Data[4].getInt() == 0) if (Data[4].getInt() == 0)
throw new C4AulExecError(pForObj, "Length cannot be zero"); throw new C4AulExecError("Length cannot be zero");
return new C4ValueProviderAbsX(pForObj, itofix(Data[1].getInt(), 1000), itofix(Data[2].getInt(), 1000), itofix(Data[3].getInt(), 1000), Data[4].getInt()); return new C4ValueProviderAbsX(pForObj, itofix(Data[1].getInt(), 1000), itofix(Data[2].getInt(), 1000), itofix(Data[3].getInt(), 1000), Data[4].getInt());
case C4AVP_AbsY: case C4AVP_AbsY:
if (!pForObj) return NULL; if (!pForObj) return NULL;
if (Data[4].getInt() == 0) if (Data[4].getInt() == 0)
throw new C4AulExecError(pForObj, "Length cannot be zero"); throw new C4AulExecError("Length cannot be zero");
return new C4ValueProviderAbsY(pForObj, itofix(Data[1].getInt(), 1000), itofix(Data[2].getInt(), 1000), itofix(Data[3].getInt(), 1000), Data[4].getInt()); return new C4ValueProviderAbsY(pForObj, itofix(Data[1].getInt(), 1000), itofix(Data[2].getInt(), 1000), itofix(Data[3].getInt(), 1000), Data[4].getInt());
case C4AVP_XDir: case C4AVP_XDir:
if (!pForObj) return NULL; if (!pForObj) return NULL;
if (Data[3].getInt() == 0) if (Data[3].getInt() == 0)
throw new C4AulExecError(pForObj, "MaxXDir cannot be zero"); throw new C4AulExecError("MaxXDir cannot be zero");
return new C4ValueProviderXDir(pForObj, itofix(Data[1].getInt(), 1000), itofix(Data[2].getInt(), 1000), itofix(Data[3].getInt(),Data[4].getInt())); return new C4ValueProviderXDir(pForObj, itofix(Data[1].getInt(), 1000), itofix(Data[2].getInt(), 1000), itofix(Data[3].getInt(),Data[4].getInt()));
case C4AVP_YDir: case C4AVP_YDir:
if (!pForObj) return NULL; if (!pForObj) return NULL;
if (Data[3].getInt() == 0) if (Data[3].getInt() == 0)
throw new C4AulExecError(pForObj, "MaxYDir cannot be zero"); throw new C4AulExecError("MaxYDir cannot be zero");
return new C4ValueProviderYDir(pForObj, itofix(Data[1].getInt(), 1000), itofix(Data[2].getInt(), 1000), itofix(Data[3].getInt(),Data[4].getInt())); return new C4ValueProviderYDir(pForObj, itofix(Data[1].getInt(), 1000), itofix(Data[2].getInt(), 1000), itofix(Data[3].getInt(),Data[4].getInt()));
case C4AVP_RDir: case C4AVP_RDir:
if (!pForObj) return NULL; if (!pForObj) return NULL;
if (Data[3].getInt() == 0) if (Data[3].getInt() == 0)
throw new C4AulExecError(pForObj, "MaxRDir cannot be zero"); throw new C4AulExecError("MaxRDir cannot be zero");
return new C4ValueProviderRDir(pForObj, itofix(Data[1].getInt(), 1000), itofix(Data[2].getInt(), 1000), itofix(Data[3].getInt(),Data[4].getInt())); return new C4ValueProviderRDir(pForObj, itofix(Data[1].getInt(), 1000), itofix(Data[2].getInt(), 1000), itofix(Data[3].getInt(),Data[4].getInt()));
case C4AVP_CosR: case C4AVP_CosR:
if (!pForObj) return NULL; if (!pForObj) return NULL;

View File

@ -4924,7 +4924,7 @@ void C4Object::SetPropertyByS(C4String * k, const C4Value & to)
switch(k - &Strings.P[0]) switch(k - &Strings.P[0])
{ {
case P_Plane: case P_Plane:
if (!to.getInt()) throw new C4AulExecError(this, "invalid Plane 0"); if (!to.getInt()) throw new C4AulExecError("invalid Plane 0");
SetPlane(to.getInt()); SetPlane(to.getInt());
return; return;
} }

View File

@ -895,7 +895,7 @@ static bool FnAddMenuItem(C4Object *Obj, C4String * szCaption, C4String * szComm
else if (Parameter.getPropList()->GetDef()) else if (Parameter.getPropList()->GetDef())
sprintf(parameter, "C4Id(\"%s\")", Parameter.getPropList()->GetDef()->id.ToString()); sprintf(parameter, "C4Id(\"%s\")", Parameter.getPropList()->GetDef()->id.ToString());
else else
throw new C4AulExecError(Obj, "proplist as parameter to AddMenuItem"); throw new C4AulExecError("proplist as parameter to AddMenuItem");
break; break;
case C4V_String: case C4V_String:
// note this breaks if there is '"' in the string. // note this breaks if there is '"' in the string.
@ -908,7 +908,7 @@ static bool FnAddMenuItem(C4Object *Obj, C4String * szCaption, C4String * szComm
break; break;
case C4V_Array: case C4V_Array:
// Arrays were never allowed, so tell the scripter // Arrays were never allowed, so tell the scripter
throw new C4AulExecError(Obj, "array as parameter to AddMenuItem"); throw new C4AulExecError("array as parameter to AddMenuItem");
default: default:
return false; return false;
} }
@ -1053,8 +1053,7 @@ static bool FnAddMenuItem(C4Object *Obj, C4String * szCaption, C4String * szComm
{ {
// draw object picture // draw object picture
if (!XPar.CheckConversion(C4V_Object)) if (!XPar.CheckConversion(C4V_Object))
throw new C4AulExecError(Obj, throw new C4AulExecError(FormatString("call to \"%s\" parameter %d: got \"%s\", but expected \"%s\"!",
FormatString("call to \"%s\" parameter %d: got \"%s\", but expected \"%s\"!",
"AddMenuItem", 8, XPar.GetTypeName(), GetC4VName(C4V_Object) "AddMenuItem", 8, XPar.GetTypeName(), GetC4VName(C4V_Object)
).getData()); ).getData());
pGfxObj = XPar.getObj(); pGfxObj = XPar.getObj();
@ -2006,7 +2005,7 @@ static Nillable<int> FnAttachMesh(C4Object *Obj, C4PropList* Mesh, C4String * sz
StdMeshMatrix trans = StdMeshMatrix::Identity(); StdMeshMatrix trans = StdMeshMatrix::Identity();
if (Transformation) if (Transformation)
if (!C4ValueToMatrix(*Transformation, &trans)) if (!C4ValueToMatrix(*Transformation, &trans))
throw new C4AulExecError(Obj, "AttachMesh: Transformation is not a valid 3x4 matrix"); throw new C4AulExecError("AttachMesh: Transformation is not a valid 3x4 matrix");
StdMeshInstance::AttachedMesh* attach; StdMeshInstance::AttachedMesh* attach;
C4Object* pObj = Mesh->GetObject(); C4Object* pObj = Mesh->GetObject();
@ -2064,7 +2063,7 @@ static bool FnSetAttachTransform(C4Object *Obj, long iAttachNumber, C4ValueArray
StdMeshMatrix trans; StdMeshMatrix trans;
if (!C4ValueToMatrix(*Transformation, &trans)) if (!C4ValueToMatrix(*Transformation, &trans))
throw new C4AulExecError(Obj, "SetAttachTransform: Transformation is not a valid 3x4 matrix"); throw new C4AulExecError("SetAttachTransform: Transformation is not a valid 3x4 matrix");
attach->SetAttachTransformation(trans); attach->SetAttachTransformation(trans);
return true; return true;

View File

@ -62,9 +62,8 @@ public:
// execution error // execution error
class C4AulExecError : public C4AulError class C4AulExecError : public C4AulError
{ {
C4Object *cObj;
public: public:
C4AulExecError(C4Object *pObj, const char *szError); // constructor C4AulExecError(const char *szError);
}; };
// function access // function access

View File

@ -102,7 +102,7 @@ public:
class NeedDefinitionContext : public C4AulExecError class NeedDefinitionContext : public C4AulExecError
{ {
public: public:
NeedDefinitionContext(const char *function) : C4AulExecError(NULL, FormatString("%s: must be called from definition context", function).getData()) {} NeedDefinitionContext(const char *function) : C4AulExecError(FormatString("%s: must be called from definition context", function).getData()) {}
}; };
// Other functions are callable in object context only. // Other functions are callable in object context only.
@ -110,7 +110,7 @@ public:
class NeedObjectContext : public C4AulExecError class NeedObjectContext : public C4AulExecError
{ {
public: public:
NeedObjectContext(const char *function) : C4AulExecError(NULL, FormatString("%s: must be called from object context", function).getData()) {} NeedObjectContext(const char *function) : C4AulExecError(FormatString("%s: must be called from object context", function).getData()) {}
}; };
// Then there's functions that don't care, but need either defn or object context. // Then there's functions that don't care, but need either defn or object context.
@ -118,7 +118,7 @@ public:
class NeedNonGlobalContext : public C4AulExecError class NeedNonGlobalContext : public C4AulExecError
{ {
public: public:
NeedNonGlobalContext(const char *function) : C4AulExecError(NULL, FormatString("%s: call must not be from global context", function).getData()) {} NeedNonGlobalContext(const char *function) : C4AulExecError(FormatString("%s: call must not be from global context", function).getData()) {}
}; };
// return type of functions returning nil // return type of functions returning nil

View File

@ -36,7 +36,7 @@
C4AulExec AulExec; C4AulExec AulExec;
C4AulExecError::C4AulExecError(C4Object *pObj, const char *szError) : cObj(pObj) C4AulExecError::C4AulExecError(const char *szError)
{ {
// direct error message string // direct error message string
sMessage.Format("ERROR: %s.", szError ? szError : "(no error message)"); sMessage.Format("ERROR: %s.", szError ? szError : "(no error message)");
@ -233,10 +233,10 @@ C4Value C4AulExec::Exec(C4AulBCC *pCPos, bool fPassErrors)
break; break;
case AB_EOF: case AB_EOFN: case AB_EOF: case AB_EOFN:
throw new C4AulExecError(pCurCtx->Obj, "internal error: function didn't return"); throw new C4AulExecError("internal error: function didn't return");
case AB_ERR: case AB_ERR:
throw new C4AulExecError(pCurCtx->Obj, "syntax error: see above for details"); throw new C4AulExecError("syntax error: see above for details");
case AB_PARN_CONTEXT: case AB_PARN_CONTEXT:
PushValue(AulExec.GetContext(AulExec.GetContextDepth()-2)->Pars[pCPos->Par.i]); PushValue(AulExec.GetContext(AulExec.GetContextDepth()-2)->Pars[pCPos->Par.i]);
@ -249,22 +249,22 @@ C4Value C4AulExec::Exec(C4AulBCC *pCPos, bool fPassErrors)
case AB_LOCALN: case AB_LOCALN:
assert(!pCurCtx->Obj || pCurCtx->Def == pCurCtx->Obj); assert(!pCurCtx->Obj || pCurCtx->Def == pCurCtx->Obj);
if (!pCurCtx->Def) if (!pCurCtx->Def)
throw new C4AulExecError(0, "can't access local variables without this"); throw new C4AulExecError("can't access local variables without this");
PushNullVals(1); PushNullVals(1);
pCurCtx->Def->GetPropertyByS(pCPos->Par.s, pCurVal); pCurCtx->Def->GetPropertyByS(pCPos->Par.s, pCurVal);
break; break;
case AB_LOCALN_SET: case AB_LOCALN_SET:
assert(!pCurCtx->Obj || pCurCtx->Def == pCurCtx->Obj); assert(!pCurCtx->Obj || pCurCtx->Def == pCurCtx->Obj);
if (!pCurCtx->Def) if (!pCurCtx->Def)
throw new C4AulExecError(0, "can't access local variables without this"); throw new C4AulExecError("can't access local variables without this");
if (pCurCtx->Def->IsFrozen()) if (pCurCtx->Def->IsFrozen())
throw new C4AulExecError(pCurCtx->Obj, "local variable: this is readonly"); throw new C4AulExecError("local variable: this is readonly");
pCurCtx->Def->SetPropertyByS(pCPos->Par.s, pCurVal[0]); pCurCtx->Def->SetPropertyByS(pCPos->Par.s, pCurVal[0]);
break; break;
case AB_PROP: case AB_PROP:
if (!pCurVal->CheckConversion(C4V_PropList)) if (!pCurVal->CheckConversion(C4V_PropList))
throw new C4AulExecError(pCurCtx->Obj, FormatString("proplist access: proplist expected, got %s", pCurVal->GetTypeName()).getData()); throw new C4AulExecError(FormatString("proplist access: proplist expected, got %s", pCurVal->GetTypeName()).getData());
if (!pCurVal->_getPropList()->GetPropertyByS(pCPos->Par.s, pCurVal)) if (!pCurVal->_getPropList()->GetPropertyByS(pCPos->Par.s, pCurVal))
pCurVal->Set0(); pCurVal->Set0();
break; break;
@ -272,9 +272,9 @@ C4Value C4AulExec::Exec(C4AulBCC *pCPos, bool fPassErrors)
{ {
C4Value *pPropList = pCurVal - 1; C4Value *pPropList = pCurVal - 1;
if (!pPropList->CheckConversion(C4V_PropList)) if (!pPropList->CheckConversion(C4V_PropList))
throw new C4AulExecError(pCurCtx->Obj, FormatString("proplist write: proplist expected, got %s", pPropList->GetTypeName()).getData()); throw new C4AulExecError(FormatString("proplist write: proplist expected, got %s", pPropList->GetTypeName()).getData());
if (pPropList->_getPropList()->IsFrozen()) if (pPropList->_getPropList()->IsFrozen())
throw new C4AulExecError(pCurCtx->Obj, "proplist write: proplist is readonly"); throw new C4AulExecError("proplist write: proplist is readonly");
pPropList->_getPropList()->SetPropertyByS(pCPos->Par.s, pCurVal[0]); pPropList->_getPropList()->SetPropertyByS(pCPos->Par.s, pCurVal[0]);
pPropList->Set(pCurVal[0]); pPropList->Set(pCurVal[0]);
PopValue(); PopValue();
@ -322,7 +322,7 @@ C4Value C4AulExec::Exec(C4AulBCC *pCPos, bool fPassErrors)
CheckOpPars(C4V_Int, C4V_Int, "/"); CheckOpPars(C4V_Int, C4V_Int, "/");
C4Value *pPar1 = pCurVal - 1, *pPar2 = pCurVal; C4Value *pPar1 = pCurVal - 1, *pPar2 = pCurVal;
if (!pPar2->_getInt()) if (!pPar2->_getInt())
throw new C4AulExecError(pCurCtx->Obj, "division by zero"); throw new C4AulExecError("division by zero");
pPar1->SetInt(pPar1->_getInt() / pPar2->_getInt()); pPar1->SetInt(pPar1->_getInt() / pPar2->_getInt());
PopValue(); PopValue();
break; break;
@ -509,7 +509,7 @@ C4Value C4AulExec::Exec(C4AulBCC *pCPos, bool fPassErrors)
assert(pStruct->GetType() == C4V_PropList); assert(pStruct->GetType() == C4V_PropList);
C4PropList *pPropList = pStruct->_getPropList(); C4PropList *pPropList = pStruct->_getPropList();
if (pPropList->IsFrozen()) if (pPropList->IsFrozen())
throw new C4AulExecError(pCurCtx->Obj, "proplist write: proplist is readonly"); throw new C4AulExecError("proplist write: proplist is readonly");
pPropList->SetPropertyByS(pIndex->_getStr(), *pValue); pPropList->SetPropertyByS(pIndex->_getStr(), *pValue);
} }
// Set result, remove array and index from stack // Set result, remove array and index from stack
@ -525,11 +525,11 @@ C4Value C4AulExec::Exec(C4AulBCC *pCPos, bool fPassErrors)
// Typcheck // Typcheck
if (!Array.CheckConversion(C4V_Array)) if (!Array.CheckConversion(C4V_Array))
throw new C4AulExecError(pCurCtx->Obj, FormatString("array slice: can't access %s as an array", Array.GetTypeName()).getData()); throw new C4AulExecError(FormatString("array slice: can't access %s as an array", Array.GetTypeName()).getData());
if (!StartIndex.CheckConversion(C4V_Int)) if (!StartIndex.CheckConversion(C4V_Int))
throw new C4AulExecError(pCurCtx->Obj, FormatString("array slice: start index of type %s, int expected", StartIndex.GetTypeName()).getData()); throw new C4AulExecError(FormatString("array slice: start index of type %s, int expected", StartIndex.GetTypeName()).getData());
if (!EndIndex.CheckConversion(C4V_Int)) if (!EndIndex.CheckConversion(C4V_Int))
throw new C4AulExecError(pCurCtx->Obj, FormatString("array slice: end index of type %s, int expected", EndIndex.GetTypeName()).getData()); throw new C4AulExecError(FormatString("array slice: end index of type %s, int expected", EndIndex.GetTypeName()).getData());
Array.SetArray(Array.GetData().Array->GetSlice(StartIndex._getInt(), EndIndex._getInt())); Array.SetArray(Array.GetData().Array->GetSlice(StartIndex._getInt(), EndIndex._getInt()));
@ -547,11 +547,11 @@ C4Value C4AulExec::Exec(C4AulBCC *pCPos, bool fPassErrors)
// Typcheck // Typcheck
if (!Array.CheckConversion(C4V_Array)) if (!Array.CheckConversion(C4V_Array))
throw new C4AulExecError(pCurCtx->Obj, FormatString("array slice: can't access %s as an array", Array.GetTypeName()).getData()); throw new C4AulExecError(FormatString("array slice: can't access %s as an array", Array.GetTypeName()).getData());
if (!StartIndex.CheckConversion(C4V_Int)) if (!StartIndex.CheckConversion(C4V_Int))
throw new C4AulExecError(pCurCtx->Obj, FormatString("array slice: start index of type %s, int expected", StartIndex.GetTypeName()).getData()); throw new C4AulExecError(FormatString("array slice: start index of type %s, int expected", StartIndex.GetTypeName()).getData());
if (!EndIndex.CheckConversion(C4V_Int)) if (!EndIndex.CheckConversion(C4V_Int))
throw new C4AulExecError(pCurCtx->Obj, FormatString("array slice: end index of type %s, int expected", EndIndex.GetTypeName()).getData()); throw new C4AulExecError(FormatString("array slice: end index of type %s, int expected", EndIndex.GetTypeName()).getData());
C4ValueArray *pArray = Array._getArray(); C4ValueArray *pArray = Array._getArray();
pArray->SetSlice(StartIndex._getInt(), EndIndex._getInt(), Value); pArray->SetSlice(StartIndex._getInt(), EndIndex._getInt(), Value);
@ -694,7 +694,7 @@ C4Value C4AulExec::Exec(C4AulBCC *pCPos, bool fPassErrors)
case AB_PAR: case AB_PAR:
if (!pCurVal->CheckConversion(C4V_Int)) if (!pCurVal->CheckConversion(C4V_Int))
throw new C4AulExecError(pCurCtx->Obj, FormatString("Par: index of type %s, int expected", pCurVal->GetTypeName()).getData()); throw new C4AulExecError(FormatString("Par: index of type %s, int expected", pCurVal->GetTypeName()).getData());
// Push reference to parameter on the stack // Push reference to parameter on the stack
if (pCurVal->_getInt() >= 0 && pCurVal->_getInt() < pCurCtx->Func->GetParCount()) if (pCurVal->_getInt() >= 0 && pCurVal->_getInt() < pCurCtx->Func->GetParCount())
pCurVal->Set(pCurCtx->Pars[pCurVal->_getInt()]); pCurVal->Set(pCurCtx->Pars[pCurVal->_getInt()]);
@ -711,7 +711,7 @@ C4Value C4AulExec::Exec(C4AulBCC *pCPos, bool fPassErrors)
if (!iItem) if (!iItem)
{ {
if (!pCurVal[-1].CheckConversion(C4V_Array)) if (!pCurVal[-1].CheckConversion(C4V_Array))
throw new C4AulExecError(pCurCtx->Obj, FormatString("for: array expected, but got %s", pCurVal[-1].GetTypeName()).getData()); throw new C4AulExecError(FormatString("for: array expected, but got %s", pCurVal[-1].GetTypeName()).getData());
} }
C4ValueArray *pArray = pCurVal[-1]._getArray(); C4ValueArray *pArray = pCurVal[-1]._getArray();
// No more entries? // No more entries?
@ -740,8 +740,7 @@ C4Value C4AulExec::Exec(C4AulBCC *pCPos, bool fPassErrors)
pDest = pTargetVal->_getPropList(); pDest = pTargetVal->_getPropList();
} }
else else
throw new C4AulExecError(pCurCtx->Obj, throw new C4AulExecError(FormatString("'->': invalid target type %s, expected proplist", pTargetVal->GetTypeName()).getData());
FormatString("'->': invalid target type %s, expected proplist", pTargetVal->GetTypeName()).getData());
// Search function for given context // Search function for given context
C4AulFunc * pFunc = pDest->GetFunc(pCPos->Par.s); C4AulFunc * pFunc = pDest->GetFunc(pCPos->Par.s);
@ -754,8 +753,7 @@ C4Value C4AulExec::Exec(C4AulBCC *pCPos, bool fPassErrors)
// Function not found? // Function not found?
if (!pFunc) if (!pFunc)
throw new C4AulExecError(pCurCtx->Obj, throw new C4AulExecError(FormatString("'->': no function \"%s\" in object \"%s\"", pCPos->Par.s->GetCStr(), pTargetVal->GetDataString().getData()).getData());
FormatString("'->': no function \"%s\" in object \"%s\"", pCPos->Par.s->GetCStr(), pTargetVal->GetDataString().getData()).getData());
assert(!pFunc->OverloadedBy); assert(!pFunc->OverloadedBy);
@ -836,8 +834,7 @@ C4AulBCC *C4AulExec::Call(C4AulFunc *pFunc, C4Value *pReturn, C4Value *pPars, C4
C4V_Type *pTypes = pFunc->GetParType(); C4V_Type *pTypes = pFunc->GetParType();
for (int i = 0; i < pFunc->GetParCount(); i++) for (int i = 0; i < pFunc->GetParCount(); i++)
if (!pPars[i].CheckParConversion(pTypes[i])) if (!pPars[i].CheckParConversion(pTypes[i]))
throw new C4AulExecError(pCurCtx->Obj, throw new C4AulExecError(FormatString("call to \"%s\" parameter %d: passed %s, but expected %s",
FormatString("call to \"%s\" parameter %d: passed %s, but expected %s",
pFunc->GetName(), i + 1, pPars[i].GetTypeName(), GetC4VName(pTypes[i]) pFunc->GetName(), i + 1, pPars[i].GetTypeName(), GetC4VName(pTypes[i])
).getData()); ).getData());
@ -849,7 +846,7 @@ C4AulBCC *C4AulExec::Call(C4AulFunc *pFunc, C4Value *pReturn, C4Value *pPars, C4
C4AulScriptContext ctx; C4AulScriptContext ctx;
ctx.Obj = pContext ? pContext->GetObject() : 0; ctx.Obj = pContext ? pContext->GetObject() : 0;
if (ctx.Obj && !ctx.Obj->Status) if (ctx.Obj && !ctx.Obj->Status)
throw new C4AulExecError(ctx.Obj, "using removed object"); throw new C4AulExecError("using removed object");
ctx.Def = pContext; ctx.Def = pContext;
ctx.Return = pReturn; ctx.Return = pReturn;
ctx.Pars = pPars; ctx.Pars = pPars;
@ -875,7 +872,7 @@ C4AulBCC *C4AulExec::Call(C4AulFunc *pFunc, C4Value *pReturn, C4Value *pPars, C4
C4AulContext ctx; C4AulContext ctx;
ctx.Obj = pContext ? pContext->GetObject() : 0; ctx.Obj = pContext ? pContext->GetObject() : 0;
if (ctx.Obj && !ctx.Obj->Status) if (ctx.Obj && !ctx.Obj->Status)
throw new C4AulExecError(ctx.Obj, "using removed object"); throw new C4AulExecError("using removed object");
ctx.Def = pContext; ctx.Def = pContext;
#ifdef DEBUGREC_SCRIPT #ifdef DEBUGREC_SCRIPT
@ -988,7 +985,7 @@ void C4AulExec::StopProfiling()
void C4AulExec::PushContext(const C4AulScriptContext &rContext) void C4AulExec::PushContext(const C4AulScriptContext &rContext)
{ {
if (pCurCtx >= Contexts + MAX_CONTEXT_STACK - 1) if (pCurCtx >= Contexts + MAX_CONTEXT_STACK - 1)
throw new C4AulExecError(pCurCtx->Obj, "context stack overflow"); throw new C4AulExecError("context stack overflow");
*++pCurCtx = rContext; *++pCurCtx = rContext;
// Trace? // Trace?
if (iTraceStart >= 0) if (iTraceStart >= 0)
@ -1004,7 +1001,7 @@ void C4AulExec::PushContext(const C4AulScriptContext &rContext)
void C4AulExec::PopContext() void C4AulExec::PopContext()
{ {
if (pCurCtx < Contexts) if (pCurCtx < Contexts)
throw new C4AulExecError(pCurCtx->Obj, "internal error: context stack underflow"); throw new C4AulExecError("internal error: context stack underflow");
// Profiler adding up times // Profiler adding up times
if (fProfiling) if (fProfiling)
{ {

View File

@ -80,7 +80,7 @@ private:
void CheckOverflow(int iCnt) void CheckOverflow(int iCnt)
{ {
if (pCurVal - Values >= MAX_VALUE_STACK - iCnt) if (pCurVal - Values >= MAX_VALUE_STACK - iCnt)
throw new C4AulExecError(pCurCtx->Obj, "value stack overflow, probably due to too deep recursion"); throw new C4AulExecError("value stack overflow, probably due to too deep recursion");
} }
void PushInt(int32_t i) void PushInt(int32_t i)
@ -176,20 +176,17 @@ private:
// Typecheck parameters // Typecheck parameters
if (!pPar1->CheckParConversion(Type1)) if (!pPar1->CheckParConversion(Type1))
throw new C4AulExecError(pCurCtx->Obj, throw new C4AulExecError(FormatString("operator \"%s\" left side got %s, but expected %s",
FormatString("operator \"%s\" left side got %s, but expected %s",
opname, pPar1->GetTypeName(), GetC4VName(Type1)).getData()); opname, pPar1->GetTypeName(), GetC4VName(Type1)).getData());
if (!pPar2->CheckParConversion(Type2)) if (!pPar2->CheckParConversion(Type2))
throw new C4AulExecError(pCurCtx->Obj, throw new C4AulExecError(FormatString("operator \"%s\" right side got %s, but expected %s",
FormatString("operator \"%s\" right side got %s, but expected %s",
opname, pPar2->GetTypeName(), GetC4VName(Type2)).getData()); opname, pPar2->GetTypeName(), GetC4VName(Type2)).getData());
} }
ALWAYS_INLINE void CheckOpPar(C4V_Type Type1, const char * opname) ALWAYS_INLINE void CheckOpPar(C4V_Type Type1, const char * opname)
{ {
// Typecheck parameter // Typecheck parameter
if (!pCurVal->CheckParConversion(Type1)) if (!pCurVal->CheckParConversion(Type1))
throw new C4AulExecError(pCurCtx->Obj, throw new C4AulExecError(FormatString("operator \"%s\": got %s, but expected %s",
FormatString("operator \"%s\": got %s, but expected %s",
opname, pCurVal->GetTypeName(), GetC4VName(Type1)).getData()); opname, pCurVal->GetTypeName(), GetC4VName(Type1)).getData());
} }
@ -198,17 +195,17 @@ private:
if (pStructure->CheckConversion(C4V_Array)) if (pStructure->CheckConversion(C4V_Array))
{ {
if (!pIndex->CheckConversion(C4V_Int)) if (!pIndex->CheckConversion(C4V_Int))
throw new C4AulExecError(pCurCtx->Obj, FormatString("array access: index of type %s, but expected int", pIndex->GetTypeName()).getData()); throw new C4AulExecError(FormatString("array access: index of type %s, but expected int", pIndex->GetTypeName()).getData());
return C4V_Array; return C4V_Array;
} }
else if (pStructure->CheckConversion(C4V_PropList)) else if (pStructure->CheckConversion(C4V_PropList))
{ {
if (!pIndex->CheckConversion(C4V_String)) if (!pIndex->CheckConversion(C4V_String))
throw new C4AulExecError(pCurCtx->Obj, FormatString("proplist access: index of type %s, but expected string", pIndex->GetTypeName()).getData()); throw new C4AulExecError(FormatString("proplist access: index of type %s, but expected string", pIndex->GetTypeName()).getData());
return C4V_PropList; return C4V_PropList;
} }
else else
throw new C4AulExecError(pCurCtx->Obj, FormatString("can't access %s as array or proplist", pStructure->GetTypeName()).getData()); throw new C4AulExecError(FormatString("can't access %s as array or proplist", pStructure->GetTypeName()).getData());
} }
C4AulBCC *Call(C4AulFunc *pFunc, C4Value *pReturn, C4Value *pPars, C4PropList * pContext = NULL); C4AulBCC *Call(C4AulFunc *pFunc, C4Value *pReturn, C4Value *pPars, C4PropList * pContext = NULL);
}; };

View File

@ -497,8 +497,7 @@ C4Value C4PropList::CallOrThrow(const char * s, C4AulParSet *Pars)
{ {
if (s[0] == '~') if (s[0] == '~')
return C4Value(); return C4Value();
throw new C4AulExecError(this->GetObject(), throw new C4AulExecError(FormatString("Call: no function \"%s\"", s).getData());
FormatString("Call: no function \"%s\"", s).getData());
} }
return pFn->Exec(this, Pars); return pFn->Exec(this, Pars);
} }
@ -543,7 +542,7 @@ void C4PropList::SetPropertyByS(C4String * k, const C4Value & to)
C4PropList * newpt = to.GetData().PropList; C4PropList * newpt = to.GetData().PropList;
for(C4PropList * it = newpt; it; it = it->prototype) for(C4PropList * it = newpt; it; it = it->prototype)
if(it == this) if(it == this)
throw new C4AulExecError(NULL, "Trying to create cyclic prototype structure"); throw new C4AulExecError("Trying to create cyclic prototype structure");
prototype = newpt; prototype = newpt;
//return; //return;
} }

View File

@ -64,7 +64,7 @@ StdStrBuf FnStringFormat(C4AulContext *cthr, const char *szFormatPar, C4Value *
// number // number
case 'd': case 'x': case 'X': case 'd': case 'x': case 'X':
{ {
if (!Par[cPar]) throw new C4AulExecError(cthr->Obj, "format placeholder without parameter"); if (!Par[cPar]) throw new C4AulExecError("format placeholder without parameter");
StringBuf.AppendFormat(szField, Par[cPar++]->getInt()); StringBuf.AppendFormat(szField, Par[cPar++]->getInt());
cpFormat+=SLen(szField); cpFormat+=SLen(szField);
break; break;
@ -72,7 +72,7 @@ StdStrBuf FnStringFormat(C4AulContext *cthr, const char *szFormatPar, C4Value *
// character // character
case 'c': case 'c':
{ {
if (!Par[cPar]) throw new C4AulExecError(cthr->Obj, "format placeholder without parameter"); if (!Par[cPar]) throw new C4AulExecError("format placeholder without parameter");
StringBuf.AppendCharacter(Par[cPar++]->getInt()); StringBuf.AppendCharacter(Par[cPar++]->getInt());
cpFormat+=SLen(szField); cpFormat+=SLen(szField);
break; break;
@ -80,7 +80,7 @@ StdStrBuf FnStringFormat(C4AulContext *cthr, const char *szFormatPar, C4Value *
// C4ID // C4ID
case 'i': case 'i':
{ {
if (!Par[cPar]) throw new C4AulExecError(cthr->Obj, "format placeholder without parameter"); if (!Par[cPar]) throw new C4AulExecError("format placeholder without parameter");
C4ID id = Par[cPar++]->getC4ID(); C4ID id = Par[cPar++]->getC4ID();
StringBuf.Append(id.ToString()); StringBuf.Append(id.ToString());
cpFormat+=SLen(szField); cpFormat+=SLen(szField);
@ -89,7 +89,7 @@ StdStrBuf FnStringFormat(C4AulContext *cthr, const char *szFormatPar, C4Value *
// C4Value // C4Value
case 'v': case 'v':
{ {
if (!Par[cPar]) throw new C4AulExecError(cthr->Obj, "format placeholder without parameter"); if (!Par[cPar]) throw new C4AulExecError("format placeholder without parameter");
StringBuf.Append(static_cast<const StdStrBuf&>(Par[cPar++]->GetDataString(10))); StringBuf.Append(static_cast<const StdStrBuf&>(Par[cPar++]->GetDataString(10)));
cpFormat+=SLen(szField); cpFormat+=SLen(szField);
break; break;
@ -98,12 +98,12 @@ StdStrBuf FnStringFormat(C4AulContext *cthr, const char *szFormatPar, C4Value *
case 's': case 's':
{ {
// get string // get string
if (!Par[cPar]) throw new C4AulExecError(cthr->Obj, "format placeholder without parameter"); if (!Par[cPar]) throw new C4AulExecError("format placeholder without parameter");
const char *szStr = "(null)"; const char *szStr = "(null)";
if (Par[cPar]->GetData()) if (Par[cPar]->GetData())
{ {
C4String * pStr = Par[cPar++]->getStr(); C4String * pStr = Par[cPar++]->getStr();
if (!pStr) throw new C4AulExecError(cthr->Obj, "string format placeholder without string"); if (!pStr) throw new C4AulExecError("string format placeholder without string");
szStr = pStr->GetCStr(); szStr = pStr->GetCStr();
} }
StringBuf.AppendFormat(szField, szStr); StringBuf.AppendFormat(szField, szStr);
@ -188,7 +188,7 @@ static C4Value FnSetProperty_C4V(C4AulContext *cthr, C4Value * key_C4V, C4Value
C4String * key = key_C4V->_getStr(); C4String * key = key_C4V->_getStr();
if (!key) return C4VFalse; if (!key) return C4VFalse;
if (pObj->IsFrozen()) if (pObj->IsFrozen())
throw new C4AulExecError(cthr->Obj, "proplist write: proplist is readonly"); throw new C4AulExecError("proplist write: proplist is readonly");
pObj->SetPropertyByS(key, *to); pObj->SetPropertyByS(key, *to);
return C4VTrue; return C4VTrue;
} }
@ -203,7 +203,7 @@ static C4Value FnResetProperty_C4V(C4AulContext *cthr, C4Value * key_C4V, C4Valu
if (!key) return C4VFalse; if (!key) return C4VFalse;
if (!pObj->HasProperty(key)) return C4VFalse; if (!pObj->HasProperty(key)) return C4VFalse;
if (pObj->IsFrozen()) if (pObj->IsFrozen())
throw new C4AulExecError(cthr->Obj, "proplist write: proplist is readonly"); throw new C4AulExecError("proplist write: proplist is readonly");
pObj->ResetProperty(key); pObj->ResetProperty(key);
return C4VTrue; return C4VTrue;
} }
@ -379,7 +379,7 @@ static C4Value FnGetLength(C4AulContext *cthr, C4Value *pPars)
C4String * pStr = pPars->getStr(); C4String * pStr = pPars->getStr();
if (pStr) if (pStr)
return C4VInt(GetCharacterCount(pStr->GetData().getData())); return C4VInt(GetCharacterCount(pStr->GetData().getData()));
throw new C4AulExecError(cthr->Obj, "func \"GetLength\" par 0 cannot be converted to string or array"); throw new C4AulExecError("GetLength: parameter 0 cannot be converted to string or array");
} }
static C4Value FnGetIndexOf(C4AulContext *cthr, C4Value *pPars) static C4Value FnGetIndexOf(C4AulContext *cthr, C4Value *pPars)
@ -390,7 +390,7 @@ static C4Value FnGetIndexOf(C4AulContext *cthr, C4Value *pPars)
// if the first param is nonzero, it must be an array // if the first param is nonzero, it must be an array
const C4ValueArray * pArray = pPars[0].getArray(); const C4ValueArray * pArray = pPars[0].getArray();
if (!pArray) if (!pArray)
throw new C4AulExecError(cthr->Obj, "func \"GetIndexOf\" par 0 cannot be converted to array"); throw new C4AulExecError("GetIndexOf: parameter 0 cannot be converted to array");
int32_t iSize = pArray->GetSize(); int32_t iSize = pArray->GetSize();
for (int32_t i = 0; i<iSize; ++i) for (int32_t i = 0; i<iSize; ++i)
if (pPars[1] == pArray->GetItem(i)) if (pPars[1] == pArray->GetItem(i))
@ -404,7 +404,7 @@ static C4Void FnSetLength(C4AulContext *cthr, C4ValueArray *pArray, int iNewSize
{ {
// safety // safety
if (iNewSize<0 || iNewSize > C4ValueArray::MaxSize) if (iNewSize<0 || iNewSize > C4ValueArray::MaxSize)
throw new C4AulExecError(cthr->Obj, FormatString("SetLength: invalid array size (%d)", iNewSize).getData()); throw new C4AulExecError(FormatString("SetLength: invalid array size (%d)", iNewSize).getData());
// set new size // set new size
pArray->SetSize(iNewSize); pArray->SetSize(iNewSize);
@ -501,7 +501,7 @@ static long FnWildcardMatch(C4AulContext *ctx, C4String *psString, C4String *psW
static bool FnFatalError(C4AulContext *ctx, C4String *pErrorMsg) static bool FnFatalError(C4AulContext *ctx, C4String *pErrorMsg)
{ {
throw new C4AulExecError(ctx->Obj, FormatString("script: %s", pErrorMsg ? pErrorMsg->GetCStr() : "(no error)").getData()); throw new C4AulExecError(FormatString("script: %s", pErrorMsg ? pErrorMsg->GetCStr() : "(no error)").getData());
} }
static bool FnStartCallTrace(C4AulContext *ctx) static bool FnStartCallTrace(C4AulContext *ctx)

View File

@ -119,13 +119,13 @@ void C4ValueArray::SetItem(int32_t iElem, const C4Value &Value)
{ {
// enlarge // enlarge
if (iElem < -iSize) if (iElem < -iSize)
throw new C4AulExecError(NULL,"array access: index out of range"); throw new C4AulExecError("array access: index out of range");
else if (iElem < 0) else if (iElem < 0)
iElem = iSize + iElem; iElem = iSize + iElem;
else if (iElem >= iSize && iElem < MaxSize) this->SetSize(iElem + 1); else if (iElem >= iSize && iElem < MaxSize) this->SetSize(iElem + 1);
// out-of-memory? This might not get caught, but it's better than a segfault // out-of-memory? This might not get caught, but it's better than a segfault
if (iElem >= iSize) if (iElem >= iSize)
throw new C4AulExecError(NULL,"array access: index too large"); throw new C4AulExecError("array access: index too large");
// set // set
pData[iElem]=Value; pData[iElem]=Value;
} }
@ -204,11 +204,11 @@ C4ValueArray * C4ValueArray::GetSlice(int32_t startIndex, int32_t endIndex)
{ {
// adjust indices so that the default end index works and that negative numbers count backwards from the end of the string // adjust indices so that the default end index works and that negative numbers count backwards from the end of the string
if (startIndex > iSize) startIndex = iSize; if (startIndex > iSize) startIndex = iSize;
else if (startIndex < -iSize) throw new C4AulExecError(NULL, "array slice: start index out of range"); else if (startIndex < -iSize) throw new C4AulExecError("array slice: start index out of range");
else if (startIndex < 0) startIndex += iSize; else if (startIndex < 0) startIndex += iSize;
if (endIndex > iSize) endIndex = iSize; // this also processes the MAX_INT default if no parameter is given in script if (endIndex > iSize) endIndex = iSize; // this also processes the MAX_INT default if no parameter is given in script
else if (endIndex < -iSize) throw new C4AulExecError(NULL, "array slice: end index out of range"); else if (endIndex < -iSize) throw new C4AulExecError("array slice: end index out of range");
else if (endIndex < 0) endIndex += iSize; else if (endIndex < 0) endIndex += iSize;
C4ValueArray* NewArray = new C4ValueArray(std::max(0, endIndex - startIndex)); C4ValueArray* NewArray = new C4ValueArray(std::max(0, endIndex - startIndex));
@ -221,15 +221,15 @@ C4ValueArray * C4ValueArray::GetSlice(int32_t startIndex, int32_t endIndex)
void C4ValueArray::SetSlice(int32_t startIndex, int32_t endIndex, const C4Value &Val) void C4ValueArray::SetSlice(int32_t startIndex, int32_t endIndex, const C4Value &Val)
{ {
// maximum bounds // maximum bounds
if(startIndex >= MaxSize) throw new C4AulExecError(NULL, "array slice: start index exceeds maximum capacity"); if(startIndex >= MaxSize) throw new C4AulExecError("array slice: start index exceeds maximum capacity");
// index from back // index from back
if(startIndex < 0) startIndex += iSize; if(startIndex < 0) startIndex += iSize;
if(endIndex < 0) endIndex += iSize; if(endIndex < 0) endIndex += iSize;
// ensure relevant bounds // ensure relevant bounds
if(startIndex < 0) throw new C4AulExecError(NULL, "array slice: start index out of range"); if(startIndex < 0) throw new C4AulExecError("array slice: start index out of range");
if(endIndex < 0) throw new C4AulExecError(NULL, "array slice: end index out of range"); if(endIndex < 0) throw new C4AulExecError("array slice: end index out of range");
if(endIndex < startIndex) if(endIndex < startIndex)
endIndex = startIndex; endIndex = startIndex;