123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- #ifndef VIRTUALMATH_STATEMENT_H
- #define VIRTUALMATH_STATEMENT_H
- #include "__macro.h"
- #define MAX_SIZE (1024)
- struct Statement;
- typedef struct VirtualMathValue{
- enum ValueType{
- number=1,
- string,
- } type;
- union data{
- struct Number{
- NUMBER_TYPE num;
- } num;
- struct String{
- char *str;
- } str;
- }data;
- struct VirtualMathValue *next;
- struct VirtualMathValue *last;
- } Value;
- typedef struct VirtualMathLinkValue{
- struct VirtualMathValue *value;
- struct VirtualMathLinkValue *father;
- struct VirtualMathLinkValue *next;
- struct VirtualMathLinkValue *last;
- } LinkValue;
- typedef struct VirtualMathResult{
- enum ResultType{
- statement_end = 1,
- } type;
- struct VirtualMathLinkValue *value;
- } Result;
- typedef struct VirtualMathVar{
- char *name;
- struct VirtualMathLinkValue *value;
- struct VirtualMathVar *next;
- } Var;
- typedef struct VirtualMathHashTable{
- struct VirtualMathVar **hashtable;
- int count;
- struct VirtualMathHashTable *next;
- struct VirtualMathHashTable *last;
- } HashTable;
- typedef struct VirtualMathVarList{
- struct VirtualMathHashTable *hashtable;
- struct VirtualMathVarList *next;
- } VarList;
- typedef struct Statement{
- enum StatementType{
- start = 1,
- base_value,
- base_var,
- operation,
- } type;
- union StatementU{
- struct base_value{
- struct VirtualMathValue *value;
- } base_value;
- struct base_var{
- char *name;
- struct Statement *times;
- } base_var;
- struct operation{
- enum OperationType{
- ADD = 1,
- SUB,
- MUL,
- DIV,
- ASS,
- } OperationType;
- struct Statement *left;
- struct Statement *right;
- } operation;
- }u;
- struct Statement *next;
- } Statement;
- #endif //VIRTUALMATH_STATEMENT_H
|