Float runFloat(CppiaCtx *ctx) { if (FUNC==afPop) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); BCR_CHECK; return ValToFloat(thisVal->pop()); } if (FUNC==afShift) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); BCR_CHECK; return ValToFloat(thisVal->shift()); } if (FUNC==af__get) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); BCR_CHECK; return ValToFloat(thisVal->__get(args[0]->runInt(ctx))); } if (FUNC==af__set) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); BCR_CHECK; int i = args[0]->runInt(ctx); ELEM elem; runValue(elem,ctx,args[1]); BCR_CHECK; thisVal->Item(i) = elem; return ValToFloat(elem); } if (FUNC==af__crement) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); ELEM &elem = thisVal->Item(args[0]->runInt(ctx)); return ValToFloat(CREMENT::run(elem)); } if (FUNC==afPush) return runInt(ctx); return 0.0; }
::String runString(CppiaCtx *ctx) { if (FUNC==afPop) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); BCR_CHECK; return ValToString(thisVal->pop()); } if (FUNC==afShift) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); BCR_CHECK; return ValToString(thisVal->shift()); } if (FUNC==af__get) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); BCR_CHECK; int idx = args[0]->runInt(ctx); BCR_CHECK; return ValToString(thisVal->__get(idx)); } if (FUNC==af__set) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); BCR_CHECK; int i = args[0]->runInt(ctx); BCR_CHECK; ELEM elem; runValue(elem,ctx,args[1]); BCR_CHECK; return ValToString( thisVal->Item(i) = elem); } if (FUNC==af__crement) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); BCR_CHECK; int idx = args[0]->runInt(ctx); BCR_CHECK; ELEM &elem = thisVal->Item(idx); return ValToString(CREMENT::run(elem)); } if (FUNC==afJoin) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); BCR_CHECK; String space = args[0]->runString(ctx); BCR_CHECK; return thisVal->join(space); } if (FUNC==afToString) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); BCR_CHECK; return thisVal->toString(); } if (FUNC==afPush) return Dynamic(runInt(ctx))->toString(); return runObject(ctx)->toString(); }
int runInt(CppiaCtx *ctx) { if (FUNC==afPush) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); BCR_CHECK; ELEM elem; runValue(elem,ctx,args[0]); BCR_CHECK; int result = thisVal->push(elem); return result; } if (FUNC==afPop) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); BCR_CHECK; return ValToInt(thisVal->pop()); } if (FUNC==afShift) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); BCR_CHECK; return ValToInt(thisVal->shift()); } if (FUNC==afRemove) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); BCR_CHECK; ELEM elem; runValue(elem,ctx,args[0]); BCR_CHECK; return thisVal->remove(elem); } if (FUNC==afIndexOf) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); BCR_CHECK; ELEM elem; runValue(elem,ctx,args[0]); BCR_CHECK; hx::Object *start = args[1]->runObject(ctx); BCR_CHECK; return thisVal->indexOf(elem,start); } if (FUNC==afLastIndexOf) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); BCR_CHECK; ELEM elem; runValue(elem,ctx,args[0]); BCR_CHECK; hx::Object *start = args[1]->runObject(ctx); BCR_CHECK; return thisVal->lastIndexOf(elem, start); } if (FUNC==af__get) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); BCR_CHECK; int idx = args[0]->runInt(ctx); BCR_CHECK; return ValToInt(thisVal->__get(idx)); } if (FUNC==af__set) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); BCR_CHECK; int i = args[0]->runInt(ctx); BCR_CHECK; ELEM elem; runValue(elem,ctx,args[1]); BCR_CHECK; thisVal->Item(i) = elem; return ValToInt(elem); } if (FUNC==af__crement) { Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); BCR_CHECK; int idx = args[0]->runInt(ctx); BCR_CHECK; ELEM &elem = thisVal->Item(idx); return ValToInt(CREMENT::run(elem)); } return 0; }