a basic interpreter free basic

源代码在线查看: function.h

软件大小: 65 K
上传用户: yingyingyingyin
关键词: basic interpreter free
下载地址: 免注册下载 普通下载 VIP

相关代码

				#pragma once
				#include "Common.h"
				/*
				 * Class CFunction - Type for a single function (builtin or defined)
				 */
				class CFunction
				{
				private:
					// Name of a function
					string m_Name;
				
					// Is this a builtin function?
					bool m_Builtin;
				
					// For defined functions, store the expression to be
					// evaluated at runtime
					string m_Expression;
				
					// For builtins, provide a coderef
					float (*m_Coderef)(float Value);
				
					// Symbol used for parameter
					CSymbol *m_Symbol;
				
				public:
					CFunction(void);
					CFunction(string Name, float (*coderef)(float));
					CFunction(string Name, string Expression);
					~CFunction(void);
					// Set the name of a function
					void SetName(string Name);
					// Get the name of the current function
					string GetName(void);
					// Set the builtin flag to either true or false
					void SetBuiltin(bool Value);
					// Returns true if the function is a builtin
					bool GetBuiltin(void);
					// Set the expression to run when the function is called
					void SetExpression(string Expression);
					// Get the runtime expression of the function
					string GetExpression(void);
					// Set the coderef for a builtin function
					void SetCoderef(float (*coderef)(float));
				
					// Execute the builtin function by coderef
					float ExecuteBuiltin(float Value);
					// Set the symbol used as a parameter
					void SetSymbol(CSymbol * Symbol);
					// Get the symbol used for the function parameter
					CSymbol * GetSymbol(void);
				};
							

相关资源