📄 equalcalc.h
字号:
/************************************************************************************************************************************************************** **** equal III the graphic builder **** **** Copyright (C) 2003 Oleksiy Pylypenko **** **** This file may be distributed and/or modified under the terms of the **** GNU General Public License version 2 as published by the Free Software **** Foundation and appearing in the file license included in the **** packaging of this file. **** **** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE **** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. **** **** Contact earthman@inbox.ru if any conditions of this licensing are **** not clear to you. **** **** ********************************************************************************* *****************************************************************************/#ifndef _EQUALCALC_H_#define _EQUALCALC_H_#include "parser.h"#include "fpu87.h"class EqualCalculator{public: ParsingContext acontext; vector<UserFunction> functions;// pti_vec builtTree; ExecutionContext execContext; x86_Executor executor;public: class errDefineFunction{}; EqualCalculator(void); ~EqualCalculator(); void Init(void); void Free(void); void DefineFunction(string name,vector<string> llist,vector<string> rlist,string definition,double priority); void DefineVariable(string name,double *ptr); pti_vec CompileSystem(string expression); double *PrepareCalculate(bPTI &atree); inline int Calculate(void){ execContext.codes->execute(); return execContext.codes->IsException(); }};#endif// _EQUALCALC_H_#ifndef _FPU_87_#define _FPU_87_#include "parser.h"// some FPU instructions/// RT errors(RT - RuntimeErrors)class errNoHandlerInExcutingModel{};class errNotEnoguhtArguments{};class errVariableNotFound{};class fpuArithmetic;// x86 executor// maybe it's better to call it x87 :-)class x86_Executor : public FunctionExecutor{ typedef void (*handlerFunction)(fpuArithmetic &myfpu); typedef map<string,handlerFunction> hendlersMap; hendlersMap hMap;public: string GetHandlerName(const FunctionDeclaration &decl); string GetBHandlerName(const BracketDeclaration &decl); void AddHandler(char *name,int l,int r,handlerFunction func); void AddBHandler(char *name,handlerFunction func); x86_Executor(); ~x86_Executor(); double Execute(const FunctionDeclaration &decl,stack<double> params); double Execute(const BracketDeclaration &decl,stack<double> params); void RBuild(const bPTI &bpti,ExecutionContext &context,fpuArithmetic &arith,stack<double *> &astack); double *Build(const bPTI &bpti,ExecutionContext &context);};/*+ x87 executor*/#endif //_FPU_87_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -