1 /*
2  * Copyright (C) 2004 Ivo Danihelka (ivo@danihelka.net)
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  */
9 #include "Scripter.h"
10 
11 #include "ScriptState.h"
12 
13 #include "def-script.h"
14 
15 //-----------------------------------------------------------------
Scripter()16 Scripter::Scripter()
17 {
18     m_script = new ScriptState();
19     m_script->registerLeader(this);
20 
21     m_script->registerFunc("file_include", script_file_include);
22     m_script->registerFunc("file_exists", script_file_exists);
23 }
24 //-----------------------------------------------------------------
~Scripter()25 Scripter::~Scripter()
26 {
27     delete m_script;
28 }
29 //-----------------------------------------------------------------
30 /**
31  * Include this script file.
32  */
33     void
scriptInclude(const Path & filename)34 Scripter::scriptInclude(const Path &filename)
35 {
36     m_script->doFile(filename);
37 }
38 //-----------------------------------------------------------------
39 /**
40  * Run this command.
41  */
42     void
scriptDo(const std::string & input)43 Scripter::scriptDo(const std::string &input)
44 {
45     m_script->doString(input);
46 }
47 
48