|
/* VCalcParserTypes.h
*
* Copyright (c) 2004-2006 by toxcct. All rights reserved.
* Consult your license regarding permissions and restrictions.
*/
/**
* @file VCalcParserTypes.h
* @brief VisualCalc Parser Types.
*
* Defines some types used by the VisualCalc Parser.
*/
#if !defined(__AFX_VCALCPARSERTYPES_H_INCLUDED__)
#define __AFX_VCALCPARSERTYPES_H_INCLUDED__
#if _MSC_VER > 1000
#pragma once
#endif
#if !defined(__cplusplus)
#error C++ compiler required
#endif
// If compiling a DLL project
#if defined(VCALCPARSER_DLL)
// If not compiling with a Visual C++ compiler
#if !defined(_MSC_VER)
#error Microsoft Visual C++ compiler required
#endif
#ifdef VCALCPARSER_EXPORTS
#define VCALCPARSER_API __declspec(dllexport)
#else
#define VCALCPARSER_API __declspec(dllimport)
#endif
#else
#define VCALCPARSER_API
#endif
#include "VCalcParserException.h"
/**
* @typedef VALUES_TYPE
* @brief Type of the results.
*
* Type defined to handle operands and results.
*/
typedef long double VALUES_TYPE;
/**
* @enum TokenValue
* @brief Type of the Tokens.
*
* Type defined for recognized separation tokens on the input stream.
*/
typedef enum {
TV_NUMBER, /**< If a number is read (integer of floating point) */
TV_IDENTIFIER, /**< If an identifier is read (variable or function) */
TV_END, /**< If the end of the expression was reached */
TV_SEQ = ',', /**< If a '<B>,</B>' is read (function parameters list) */
TV_PLUS = '+', /**< If a '<B>+</B>' is read (Addition or unary plus) */
TV_MINUS = '-', /**< If a '<B>-</B>' is read (Subtraction or unary minus) */
TV_MUL = '*', /**< If a '<B>*</B>' is read (multiplication) */
TV_DIV = '/', /**< If a '<B>/</B>' is read (Division) */
TV_POW = '^', /**< If a '<B>^</B>' is read (Power) */
TV_MOD = '%', /**< If a '<B>%</B>' is read (Modulus) */
TV_FACT = '!', /**< If a '<B>!</B>' is read (Factorial) */
TV_DEG = '�', /**< If a '<B>�</B>' is read (degrees to radians) */
TV_LP = '(', /**< If a '<B>(</B>' is read (opening parenthesis) */
TV_RP = ')', /**< If a '<B>)</B>' is read (closing parenthesis) */
TV_ASSIGN = '=' /**< If a '<B>=</B>' is read (Assignation) */
} TokenValue;
/**
* @struct AnswerItem
* @brief Type for an entry in the answers history.
*
* Type defined to store a formula typed by the user (which resulted in a valid answer)
* and its relating value.<br>
* An invalid formula (which by definition throws an error) isn't stored until the user
* corrects his mistake.
*/
typedef struct {
std::string m_strFormula;
VALUES_TYPE m_valResult;
} AnswerItem;
#endif // !defined(__AFX_VCALCPARSERTYPES_H_INCLUDED__)
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.