2013-07-25 02:28:20 +00:00
|
|
|
/*
|
2013-07-25 14:42:02 +00:00
|
|
|
abCOpSl.c
|
2013-07-25 02:28:20 +00:00
|
|
|
By: Jeremy Rand
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2013-07-25 14:42:02 +00:00
|
|
|
#include "abCError.h"
|
|
|
|
#include "abCStack.h"
|
2013-07-25 02:28:20 +00:00
|
|
|
|
2013-07-25 15:21:21 +00:00
|
|
|
#include "expr/abCExpr.h"
|
|
|
|
#include "expr/abCExprInt.h"
|
|
|
|
|
|
|
|
#include "ops/abCOp.h"
|
|
|
|
#include "ops/abCOpSl.h"
|
|
|
|
|
2013-07-25 02:28:20 +00:00
|
|
|
|
2013-07-27 02:27:29 +00:00
|
|
|
#define SL_NAME "SL"
|
2013-07-25 02:28:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
static void slExecute(void);
|
|
|
|
|
|
|
|
|
|
|
|
void abCalcOpSlInit(void)
|
|
|
|
{
|
2013-07-27 02:27:29 +00:00
|
|
|
abCalcOpRegister(SL_NAME, slExecute);
|
2013-07-25 02:28:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void slExecute(void)
|
|
|
|
{
|
|
|
|
abCalcExpr result;
|
2013-07-27 02:27:29 +00:00
|
|
|
AB_CALC_OP_ONE_ARG(SL_NAME);
|
2013-07-25 02:28:20 +00:00
|
|
|
|
|
|
|
if (expr->type != abCalcExprTypeInt) {
|
2013-07-27 02:27:29 +00:00
|
|
|
abCalcRaiseError(abCalcBadArgTypeError, SL_NAME);
|
2013-07-25 02:28:20 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
abCalcExprIntSet(&result, (expr->u.integer << 1));
|
|
|
|
|
|
|
|
abCalcStackExprPop(NULL);
|
|
|
|
abCalcStackExprPush(&result);
|
|
|
|
}
|