00001 /* 00002 * Copyright (C) 2004 Ivo Danihelka (ivo@danihelka.net) 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 */ 00009 #include "Scripter.h" 00010 00011 #include "ScriptState.h" 00012 00013 #include "def-script.h" 00014 00015 //----------------------------------------------------------------- 00016 Scripter::Scripter() 00017 { 00018 m_script = new ScriptState(); 00019 m_script->registerLeader(this); 00020 00021 m_script->registerFunc("file_include", script_file_include); 00022 m_script->registerFunc("file_exists", script_file_exists); 00023 } 00024 //----------------------------------------------------------------- 00025 Scripter::~Scripter() 00026 { 00027 delete m_script; 00028 } 00029 //----------------------------------------------------------------- 00030 /** 00031 * Include this script file. 00032 */ 00033 void 00034 Scripter::scriptInclude(const Path &filename) 00035 { 00036 m_script->doFile(filename); 00037 } 00038 //----------------------------------------------------------------- 00039 /** 00040 * Run this command. 00041 */ 00042 void 00043 Scripter::scriptDo(const std::string &input) 00044 { 00045 m_script->doString(input); 00046 } 00047