comparison interps/glass/variable.h @ 996:859f9b4339e6

<Gregor> tar xf egobot.tar.xz
author HackBot
date Sun, 09 Dec 2012 19:30:08 +0000
parents
children
comparison
equal deleted inserted replaced
995:6883f5911eb7 996:859f9b4339e6
1 /*
2 * Copyright (c) 2005 Gregor Richards
3 *
4 * This file is part of Glass.
5 *
6 * Glass is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * Glass is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Glass; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #ifndef VARIABLE_H
22 #define VARIABLE_H
23
24 #include <string>
25 using namespace std;
26
27 class Func;
28 class Klass;
29 class KlassI;
30
31 #define VAR_VARIABLEP 0
32 #define VAR_NUMBER 1
33 #define VAR_STRING 2
34 #define VAR_KLASS 3
35 #define VAR_KLASSI 4
36 #define VAR_FUNC 5
37 #define VAR_FUNCI 6
38
39 class Variable {
40 public:
41 void init();
42 Variable();
43 Variable(int stype, double val);
44 Variable(int stype, string val);
45 Variable(int stype, void *val);
46 Variable(int stype, void *vala, void *valb);
47 Variable(Variable &copy);
48
49 void mkcopy(Variable &copy);
50
51 int type;
52
53 double nval;
54 string sval; // doubles as variable-pointer value
55 Klass *kval;
56 KlassI *kival;
57 Func *fval; // must also have kival set for a function in a klassi
58 };
59
60 #endif