2013-07-24 23:59:18 +00:00
|
|
|
/*
|
2013-07-25 14:42:02 +00:00
|
|
|
abCOpNot.c
|
2013-07-24 23:59:18 +00:00
|
|
|
By: Jeremy Rand
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2013-07-25 14:42:02 +00:00
|
|
|
#include "abCError.h"
|
|
|
|
#include "abCStack.h"
|
2013-07-24 23:59:18 +00:00
|
|
|
|
2013-07-25 15:21:21 +00:00
|
|
|
#include "expr/abCExpr.h"
|
|
|
|
#include "expr/abCExprInt.h"
|
|
|
|
|
|
|
|
#include "ops/abCOp.h"
|
|
|
|
#include "ops/abCOpNot.h"
|
|
|
|
|
2013-07-24 23:59:18 +00:00
|
|
|
|
|
|
|
#define OP_NAME "NOT"
|
|
|
|
|
|
|
|
|
|
|
|
static void notExecute(void);
|
|
|
|
|
|
|
|
|
|
|
|
void abCalcOpNotInit(void)
|
|
|
|
{
|
|
|
|
abCalcOpRegister(OP_NAME, notExecute);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void notExecute(void)
|
|
|
|
{
|
|
|
|
abCalcExpr result;
|
|
|
|
AB_CALC_OP_ONE_ARG(OP_NAME);
|
|
|
|
|
|
|
|
if (expr->type != abCalcExprTypeInt) {
|
|
|
|
abCalcRaiseError(abCalcBadArgTypeError, OP_NAME);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-07-25 02:28:20 +00:00
|
|
|
abCalcExprIntSet(&result, ~(expr->u.integer));
|
2013-07-24 23:59:18 +00:00
|
|
|
|
|
|
|
abCalcStackExprPop(NULL);
|
|
|
|
abCalcStackExprPush(&result);
|
|
|
|
}
|