function.h

来自「Shorthand是一个强大的脚本语言」· C头文件 代码 · 共 53 行

H
53
字号
#ifndef __function_h
#define __function_h
///////////////////////////////////////////////////////////////////////////////
// $Header: /shorthand/src/function.h 3     8/28/02 6:27a Arm $
//-----------------------------------------------------------------------------
// Project: ShortHand interpreter
// Author: Andrei Remenchuk <andrei@remenchuk.com>
//-----------------------------------------------------------------------------
// except.h: ShortHand functions support
///////////////////////////////////////////////////////////////////////////////

#include "array.h"
#include "cstring.h"
#include "value.h"

class ShhModule;
class ShhValueList;

class ShhFunction
{
protected:

    /** function name */
    string m_name;
    
    /** MINIMUM number of arguments */
    int m_argc;

public:
    ShhFunction(const char* name, int argc = 0) : m_name(name), m_argc(argc) {}

    virtual ShhValue execute(ShhModule* module, const ShhValueList& args) const = 0;

    virtual void paste_location(string& location) = 0;

    virtual ~ShhFunction() {}

friend class ShhFunctionList;
friend class ShhBuiltinList;
};


class ShhFunctionList : public array<ShhFunction, true>
{
public:
    ShhFunction* find(const char* name);
};




#endif // __function_h

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?