Planeshift
pawsscript.h
Go to the documentation of this file.
1 /*
2  * Author: Andrew Robberts
3  *
4  * Copyright (C) 2007 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  * http://www.atomicblue.org)
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 
20 #ifndef PAWS_SCRIPT_H
21 #define PAWS_SCRIPT_H
22 
23 #include <csutil/array.h>
24 #include "util/mathscript.h"
25 
26 class pawsWidget;
27 
33 {
36  csString property;
37 };
38 
40 {
41 private:
42  MathScript* script;
43  MathEnvironment env;
44  csArray<pawsScriptResult> scriptResults;
45 
46  static void ChangedResultsVarCallback(void* arg);
47 public:
48  pawsScriptStatement(const char* script);
49  virtual ~pawsScriptStatement();
50 
51  void AddLHSResult(pawsWidget* widget, const char* property, const char* name);
52  void AddRHSVar(iScriptableVar* v, const char* name);
53 
54  void Execute();
55 };
56 
58 {
59 private:
60  pawsScriptStatement* statement;
62  csString scriptText;
63 
64  bool NextChar(const char* script, size_t &currIndex, char &c, char &n);
65  bool Parse(const char* script);
66 
67  pawsWidget* FindWidget(pawsWidget* widget, const char* name);
68 public:
69  pawsScript(pawsWidget* widget, const char* script);
70  ~pawsScript();
71 
72  void Execute();
73 };
74 
77 #endif // PAWS_SCRIPT_H
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
A specific MathEnvironment to be used in a MathScript.
Definition: mathscript.h:188
A MathScript is a mini-program to run.
Definition: mathscript.h:442
This holds information about a specific variable in a specific MathEnvironment to be used for MathScr...
Definition: mathscript.h:270
MathVar * var
Definition: pawsscript.h:35
pawsWidget * widget
Definition: pawsscript.h:34
csString property
Definition: pawsscript.h:36