ESLA
Embeddable Scriting LAnguage
Stanford University, Rock Fracture Project research group
© 2003
00001 /************************************************************************* 00002 * ESLA: Embeddable Scripting LAnguage 00003 * Copyright (C) 2003 Frantz Maerten 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License as 00007 * published by the Free Software Foundation; either version 2 of the 00008 * License, or (at your option) any later version. 00009 * 00010 * If you modify this software, you should contact the author, include 00011 * a notice giving the name of the person performing the modification, 00012 * the date of modification, and the reason for such modification. 00013 * 00014 * Note that the GNU General Public License does not permit 00015 * incorporating the Software into proprietary programs. 00016 * 00017 * Contact: Frantz Maerten 00018 * frantz@pangea.stanford.edu 00019 * 00020 * Dept. of Geological & Environmental Sciences 00021 * Stanford University 00022 * Stanford, CA 94305-2115 00023 * USA 00024 *************************************************************************/ 00025 00026 00027 #ifndef FUNCTION_ACTION 00028 #define FUNCTION_ACTION 00029 00030 #include "../esla_namespace.h" 00031 #include "common.h" 00032 #include "gen_action.h" 00033 #include "local_string_var_registry.h" 00034 #include "local_fct_registry.h" 00035 #include <string> 00036 00037 BEGIN_LIB_NAMESPACE 00038 00039 class FunctionAction: public GenAction { 00040 public: 00041 virtual RET_TYPE set_parameters(IfStream*, const std::string& params) ; 00042 virtual RET_TYPE execute(const std::string&, std::string&) ; 00043 virtual RET_TYPE execute() ; 00044 00045 virtual std::string args() const ; 00046 virtual std::string command_name() const ; 00047 00048 virtual bool has_return() const ; 00049 virtual RET_TYPE get_return(std::string&) const ; 00050 00051 std::string syntax() const ; 00052 00053 protected: 00054 virtual bool bind(const std::string& expression) ; 00055 virtual bool rebind(const std::string& name, const std::string& new_value) ; 00056 virtual std::string resolve(const std::string& name) ; 00057 virtual bool parse(const std::string& expr, std::string& res) ; 00058 00059 private: 00060 RET_TYPE decode(const std::string&) ; 00061 LocalStringVarRegistry var_registry_ ; 00062 std::string name_ ; 00063 Tokens vars_ ; 00064 ListActions list_ ; 00065 std::string tmp_ ; 00066 std::string var_return_ ; 00067 bool has_return_ ; 00068 } ; 00069 inline bool FunctionAction::has_return() const { 00070 return has_return_ ; 00071 } 00072 00073 //---------------------------------- 00074 DECLARE_SMART_OBJECT(FunctionAction) ; 00075 //---------------------------------- 00076 00077 END_LIB_NAMESPACE 00078 00079 #endif