Changeset 993 for code/branches/core2/src/orxonox/core
- Timestamp:
- Apr 5, 2008, 3:40:10 AM (17 years ago)
- Location:
- code/branches/core2/src/orxonox/core
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core2/src/orxonox/core/CommandExecutor.cc
r972 r993 45 45 ConsoleCommandShortcutGeneric(keyword3, createExecutor((FunctorStatic*)0, "bind", AccessLevel::User)); 46 46 47 ConsoleCommandShortcutExtern(exec, AccessLevel::None); 48 49 void exec(const std::string& filename) 50 { 51 static std::set<std::string> executingFiles; 52 53 std::set<std::string>::const_iterator it = executingFiles.find(filename); 54 if (it != executingFiles.end()) 55 { 56 COUT(1) << "Error: Recurring exec command in \"" << filename << "\". Stopped execution." << std::endl; 57 return; 58 } 59 60 // Open the file 61 std::ifstream file; 62 file.open(filename.c_str(), std::fstream::in); 63 64 if (!file.is_open()) 65 { 66 COUT(1) << "Error: Couldn't execute file \"" << filename << "\"." << std::endl; 67 return; 68 } 69 70 executingFiles.insert(filename); 71 72 // Iterate through the file and put the lines into the CommandExecutor 73 char line[1024]; 74 while (file.good() && !file.eof()) 75 { 76 file.getline(line, 1024); 77 CommandExecutor::execute(line); 78 } 79 80 executingFiles.erase(filename); 81 } 82 47 83 48 84 /////////////////////// -
code/branches/core2/src/orxonox/core/CommandExecutor.h
r972 r993 60 60 CS_Error 61 61 }; 62 63 void exec(const std::string& filename); 62 64 63 65 enum KeybindMode {}; // temporary -
code/branches/core2/src/orxonox/core/ConsoleCommand.h
r949 r993 43 43 44 44 45 #define ConsoleCommandShortcut( function, accesslevel) \45 #define ConsoleCommandShortcut(classname, function, accesslevel) \ 46 46 ConsoleCommandShortcutGeneric(function##consolecommand__, orxonox::createExecutor(orxonox::createFunctor(&classname::function), #function, accesslevel)) 47 48 #define ConsoleCommandShortcutExtern(function, accesslevel) \ 49 ConsoleCommandShortcutGeneric(function##consolecommand__, orxonox::createExecutor(orxonox::createFunctor(&function), #function, accesslevel)) 47 50 48 51 #define ConsoleCommandShortcutGeneric(fakevariable, executor) \ -
code/branches/core2/src/orxonox/core/CorePrereqs.h
r952 r993 93 93 class CommandEvaluation; 94 94 class CommandExecutor; 95 class ConfigFile; 96 class ConfigFileEntry; 97 class ConfigFileEntryComment; 98 class ConfigFileEntryValue; 99 class ConfigFileManager; 100 class ConfigFileSection; 95 101 class ConfigValueContainer; 96 102 class DebugLevel;
Note: See TracChangeset
for help on using the changeset viewer.