Axe the constexpr expression evaluator

This avoids redundancy between them (and also having to port fixes and features)
The error messages have been preserved through a string reporting mechanism
This commit is contained in:
ISSOtm
2020-01-20 23:12:41 +01:00
parent 52d62c6b21
commit 1d78cd0f03
12 changed files with 101 additions and 500 deletions

View File

@@ -1,35 +0,0 @@
/*
* This file is part of RGBDS.
*
* Copyright (c) 1997-2018, Carsten Sorensen and RGBDS contributors.
*
* SPDX-License-Identifier: MIT
*/
#ifndef RGBDS_ASM_CONSTEXPR_H
#define RGBDS_ASM_CONSTEXPR_H
#include <stdint.h>
struct ConstExpression {
union {
int32_t nVal;
struct sSymbol *pSym;
} u;
uint32_t isSym;
};
void constexpr_Symbol(struct ConstExpression *expr, char *tzSym);
void constexpr_BankSymbol(struct ConstExpression *expr, char *tzSym);
void constexpr_BankSection(struct ConstExpression *expr, char *tzSym);
void constexpr_Number(struct ConstExpression *expr, int32_t i);
void constexpr_UnaryOp(struct ConstExpression *expr,
int32_t op,
const struct ConstExpression *src);
void constexpr_BinaryOp(struct ConstExpression *expr,
int32_t op,
const struct ConstExpression *src1,
const struct ConstExpression *src2);
int32_t constexpr_GetConstantValue(struct ConstExpression *expr);
#endif /* RGBDS_ASM_CONSTEXPR_H */

View File

@@ -19,6 +19,7 @@
struct Expression {
bool isKnown; // Whether the expression's value is known
int32_t nVal; // If the expression's value is known, it's here
char *reason; // Why the expression is not known, if it isn't
uint8_t *tRPN; // Array of bytes serializing the RPN expression
uint32_t nRPNCapacity; // Size of the `tRPN` buffer
uint32_t nRPNLength; // Used size of the `tRPN` buffer