124 |
/////////////////////////////////////////////////////////////////////////// |
/////////////////////////////////////////////////////////////////////////// |
125 |
// built-in script function: wait() |
// built-in script function: wait() |
126 |
|
|
127 |
|
bool CoreVMFunction_wait::acceptsArgUnitType(vmint iArg, StdUnit_t type) const { |
128 |
|
if (iArg == 0) |
129 |
|
return type == VM_NO_UNIT || type == VM_SECOND; |
130 |
|
else |
131 |
|
return type == VM_NO_UNIT; |
132 |
|
} |
133 |
|
|
134 |
|
bool CoreVMFunction_wait::acceptsArgUnitPrefix(vmint iArg) const { |
135 |
|
return iArg == 0; |
136 |
|
} |
137 |
|
|
138 |
VMFnResult* CoreVMFunction_wait::exec(VMFnArgs* args) { |
VMFnResult* CoreVMFunction_wait::exec(VMFnArgs* args) { |
139 |
ExecContext* ctx = dynamic_cast<ExecContext*>(vm->currentVMExecContext()); |
ExecContext* ctx = dynamic_cast<ExecContext*>(vm->currentVMExecContext()); |
140 |
VMIntExpr* expr = dynamic_cast<VMIntExpr*>(args->arg(0)); |
VMIntExpr* expr = dynamic_cast<VMIntExpr*>(args->arg(0)); |
141 |
vmint us = expr->evalInt(); |
vmint us = expr->evalInt(VM_MICRO); |
142 |
if (us < 0) { |
if (us < 0) { |
143 |
wrnMsg("wait(): argument may not be negative! Aborting script!"); |
wrnMsg("wait(): argument may not be negative! Aborting script!"); |
144 |
this->result.flags = STMT_ABORT_SIGNALLED; |
this->result.flags = STMT_ABORT_SIGNALLED; |