331
332
ENDop(PUSHSYSVAR)
335
/* The function call operation is only very roughly implemented. While the plumbing
336
* to reach this instruction is fine, the instruction itself currently supports only
337
* functions with a single argument AND with a name that we know.
338
* TODO: later, we can add here the real logic, that involves looking up function
339
* names, loading them dynamically ... and all that...
340
* implementation begun 2009-03-10 by rgerhards
342
BEGINop(FUNC_CALL) /* remember to set the instruction also in the ENDop macro! */
346
CODESTARTop(FUNC_CALL)
347
vmstk.PopNumber(pThis->pStk, &numOperands);
348
if(numOperands->val.num != 1)
349
ABORT_FINALIZE(RS_RET_INVLD_NBR_ARGUMENTS);
350
vmstk.PopString(pThis->pStk, &operand1); /* guess there's just one ;) */
351
if(!rsCStrSzStrCmp(pOp->operand.pVar->val.pStr, (uchar*) "strlen", 6)) { /* only one supported so far ;) */
352
RUNLOG_VAR("%s", rsCStrGetSzStr(operand1->val.pStr));
353
iStrlen = strlen((char*) rsCStrGetSzStr(operand1->val.pStr));
354
RUNLOG_VAR("%d", iStrlen);
356
ABORT_FINALIZE(RS_RET_INVLD_FUNC);
357
PUSHRESULTop(operand1, iStrlen); // TODO: dummy, FIXME
358
var.Destruct(&numOperands); /* no longer needed */
334
363
/* ------------------------------ end instruction set implementation ------------------------------ */