view src/kryshen/tema/GlobalContext.java @ 15:e9d13c7ffeb1

Update header comment.
author Mikhail Kryshen <mikhail@kryshen.net>
date Tue, 24 Mar 2009 18:51:47 +0300
parents 6c41a0b43e58
children 7b11f5174e29
line source
1 /*
2 * Copyright 2006-2009 Mikhail Kryshen
3 *
4 * This file is part of Tema.
5 *
6 * Tema is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
10 *
11 * Tema 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 Lesser General Public License for more details.
15 *
16 * You should have received a copy of the
17 * GNU Lesser General Public License along with Tema.
18 * If not, see <http://www.gnu.org/licenses/>.
19 */
21 package kryshen.tema;
23 import java.io.File;
24 import kryshen.tema.functions.Database;
25 import kryshen.tema.functions.Define;
26 import kryshen.tema.functions.IO;
27 import kryshen.tema.functions.ImageConverter;
28 import kryshen.tema.functions.Control;
29 import kryshen.tema.functions.Standard;
30 import kryshen.tema.functions.Strings;
32 /**
33 * Context to hold exported variables and standard Tema definitions.
34 *
35 * @author Mikhail Kryshen
36 */
37 class GlobalContext extends Context {
39 GlobalContext() {
40 super(new File(System.getProperty("user.dir")));
42 // Register all standard functions.
43 // TODO: arithmetics
45 set("tema", Standard.TEMA);
46 set("echo", Standard.ECHO);
47 set("", Standard.ECHO);
48 set("!", Standard.SKIP);
49 set("silent", Standard.SILENT);
50 set("set", Standard.SET);
51 set("unset", Standard.UNSET);
52 set("export", Standard.EXPORT);
53 set("assign", Standard.ASSIGN);
54 set("invoke", Standard.INVOKE);
55 set("load", Standard.LOAD);
57 set("to_upper", Strings.TO_UPPER);
58 set("to_lower", Strings.TO_LOWER);
59 set("substring", Strings.SUBSTRING);
60 set("equal", Strings.EQUAL);
61 set("xml_escape", Strings.XML_ESCAPE);
62 set("xml_cdata", Strings.XML_CDATA);
63 set("char", Strings.CHAR);
64 set("replace", Strings.REPLACE);
65 set("regex_match", Strings.REGEX_MATCH);
66 set("regex_replace_first", Strings.REGEX_REPLACE_FIRST);
67 set("regex_replace_all", Strings.REGEX_REPLACE_ALL);
69 set("define", Define.DEFINE);
71 set("write", IO.WRITE);
72 set("read", IO.READ);
73 set("include", IO.INCLUDE);
74 set("copy", IO.COPY);
75 set("file", IO.FILE);
77 set("false", Control.FALSE);
78 set("true", Control.TRUE);
79 set("not", Control.NOT);
80 set("optional", Control.OPTIONAL);
81 set("if", Control.IF);
82 set("if_else", Control.IF_ELSE);
83 set("while", Control.WHILE);
85 set("db_connect", Database.CONNECT);
86 set("db_prepare", Database.PREPARE);
87 set("db_query", Database.QUERY);
89 set("convert_image", ImageConverter.CONVERT_IMAGE);
91 // Other functions are defined in classes Database and Define.
92 }
93 }