[Scummvm-cvs-logs] SF.net SVN: scummvm:[42770] tools/branches/gsoc2009-gui

Remere at users.sourceforge.net Remere at users.sourceforge.net
Sat Jul 25 18:27:18 CEST 2009


Revision: 42770
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42770&view=rev
Author:   Remere
Date:     2009-07-25 16:27:18 +0000 (Sat, 25 Jul 2009)

Log Message:
-----------
*Renamed some files...

Added Paths:
-----------
    tools/branches/gsoc2009-gui/main_cli.cpp
    tools/branches/gsoc2009-gui/tools_cli.cpp
    tools/branches/gsoc2009-gui/tools_cli.h

Removed Paths:
-------------
    tools/branches/gsoc2009-gui/cli_main.cpp
    tools/branches/gsoc2009-gui/cli_tools.cpp
    tools/branches/gsoc2009-gui/cli_tools.h

Deleted: tools/branches/gsoc2009-gui/cli_main.cpp
===================================================================
--- tools/branches/gsoc2009-gui/cli_main.cpp	2009-07-25 16:09:57 UTC (rev 42769)
+++ tools/branches/gsoc2009-gui/cli_main.cpp	2009-07-25 16:27:18 UTC (rev 42770)
@@ -1,30 +0,0 @@
-/* cli_main.cpp - Main entry point for the CLI tool, very thin
- * Copyright (C) 2009 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL
- * $Id
- *
- */
-
-#include "cli_tools.h"
-
-int main(int argc, char *argv[]) {
-	ToolsCLI cli;
-	return cli.run(argc, argv);
-}
-
-

Deleted: tools/branches/gsoc2009-gui/cli_tools.cpp
===================================================================
--- tools/branches/gsoc2009-gui/cli_tools.cpp	2009-07-25 16:09:57 UTC (rev 42769)
+++ tools/branches/gsoc2009-gui/cli_tools.cpp	2009-07-25 16:27:18 UTC (rev 42770)
@@ -1,146 +0,0 @@
-/* cli_tools - CLI interface for the tools
- * Copyright (C) 2009 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL
- * $Id
- *
- */
-
-#include <iostream>
-
-#include "cli_tools.h"
-
-ToolsCLI::ToolsCLI() {
-}
-
-ToolsCLI::~ToolsCLI() {
-}
-
-int ToolsCLI::run(int argc, char *argv[]) {
-	// No matter what we ouput, we should begin with a newline
-	std::cout << "\n"; 
-
-	if (argc == 1) {
-		// Run without any arguments
-		printHelp();
-		return 0;
-	}
-
-	std::deque<char *> arguments(argv, argv + argc);
-	arguments.pop_front(); // Pop our own name
-
-	ToolType type = TOOLTYPE_ALL;
-
-	// Check first argument
-	std::string option = arguments.front();
-	if (option == "--tool" || option == "-t") {
-		arguments.pop_front();
-		for (ToolList::iterator iter = _tools.begin(); iter != _tools.end(); ++iter) {
-			Tool *tool = *iter;
-			if (arguments.front() == tool->getName()) {
-				// Run the tool, first argument will be name, very nice!
-				return tool->run(arguments.size(), &arguments.front());
-			}
-		}
-		std::cout << "\tUnknown tool, make sure you input one of the following:\n";
-		printTools();
-	} else if (option == "--help" || option == "-h") {
-		printHelp();
-	} else if (option == "--list" || option == "-l") {
-		printTools();
-	} else {
-		// Allow user to the narrow choices
-		if(option == "compress") {
-			type = TOOLTYPE_COMPRESSION;
-			arguments.pop_front();
-		} else if(option == "extract") {
-			type = TOOLTYPE_EXTRACTION;
-			arguments.pop_front();
-		}
-
-		// Find out what tools take this file as input
-		ToolList choices = inspectInput(type, arguments);
-		Tool *tool = NULL;
-
-		if (choices.size() > 1) {
-			std::cout << "\tMultiple tools accept this input:\n\n";
-
-			// Present a list of possible tools
-			int i = 1;
-			for (ToolList::iterator choice = choices.begin(); choice != choices.end(); ++choice, ++i) {
-				std::cout << "\t" << i << ") " << (*choice)->getName() << "\n";
-			}
-
-			std::cout << "Which tool to use: ";
-			i = 0;
-			while(true) {
-
-				// Read input
-				std::cin >> i;
-
-				// Valid ?
-				if(std::cin && i >= 1 && i < choices.size())
-					break;
-
-				std::cout << "Invalid input, try again: ";
-
-				// Clear any error flags
-				std::cin.clear();
-
-				// Skip invalid input characters
-				std::cin.ignore(1000, '\n');
-			}
-
-			// Account for the fact arrays start at 0
-			tool = choices[i - 1];
-		} else {
-			tool = choices.front();
-		}
-
-		std::cout << "\tRunning using " << tool->getName() << "\n";
-		
-		// Run the tool, with the remaining arguments
-		// We also add the name of the tool so it can displayed (requires an evil cast but it's safe)
-		std::string name = tool->getName();
-		arguments.push_front(const_cast<char *>(name.c_str()));
-		return tool->run(arguments.size(), &arguments.front());
-	}
-
-	return 0;
-}
-
-void ToolsCLI::printHelp() {
-	std::cout << 
-		"\tScumm VM Tools master interface\n" <<
-		"\n" <<
-		"\tCommon use:\n" <<
-		"\ttools [--tool <tool name>] [compression options] [-o output directory] <input args>\n" <<
-		"\ttools [extract|compress] <input args>\n" <<
-		"\n" <<
-		"\tOther Options:\n" <<
-		"\t--help\tDisplay this text\n" <<
-		"\t--list\tList all tools that are available\n" <<
-		"";
-}
-
-void ToolsCLI::printTools() {
-	for (ToolList::iterator tool = _tools.begin(); tool != _tools.end(); ++tool)
-		// There *really* should be a short version of the help text available
-		std::cout << "\t" << (*tool)->getName() << ": " << (*tool)->getHelp() << "\n";
-}
-
-

Deleted: tools/branches/gsoc2009-gui/cli_tools.h
===================================================================
--- tools/branches/gsoc2009-gui/cli_tools.h	2009-07-25 16:09:57 UTC (rev 42769)
+++ tools/branches/gsoc2009-gui/cli_tools.h	2009-07-25 16:27:18 UTC (rev 42770)
@@ -1,42 +0,0 @@
-/* cli_tools - CLI interface for the tools
- * Copyright (C) 2009 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL
- * $Id
- *
- */
-
-
-#ifndef CLI_TOOLS_H
-#define CLI_TOOLS_H
-
-#include "tools.h"
-
-// Does nothing
-
-class ToolsCLI : public Tools {
-public:
-	ToolsCLI();
-	~ToolsCLI();
-
-	int run(int argc, char *argv[]);
-
-	void printHelp();
-	void printTools();
-};
-
-#endif

Added: tools/branches/gsoc2009-gui/main_cli.cpp
===================================================================
--- tools/branches/gsoc2009-gui/main_cli.cpp	                        (rev 0)
+++ tools/branches/gsoc2009-gui/main_cli.cpp	2009-07-25 16:27:18 UTC (rev 42770)
@@ -0,0 +1,30 @@
+/* main_cli.cpp - Main entry point for the CLI tool, very thin
+ * Copyright (C) 2009 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL
+ * $Id
+ *
+ */
+
+#include "tools_cli.h"
+
+int main(int argc, char *argv[]) {
+	ToolsCLI cli;
+	return cli.run(argc, argv);
+}
+
+


Property changes on: tools/branches/gsoc2009-gui/main_cli.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Added: tools/branches/gsoc2009-gui/tools_cli.cpp
===================================================================
--- tools/branches/gsoc2009-gui/tools_cli.cpp	                        (rev 0)
+++ tools/branches/gsoc2009-gui/tools_cli.cpp	2009-07-25 16:27:18 UTC (rev 42770)
@@ -0,0 +1,146 @@
+/* tools_cli - CLI interface for the tools
+ * Copyright (C) 2009 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL
+ * $Id
+ *
+ */
+
+#include <iostream>
+
+#include "tools_cli.h"
+
+ToolsCLI::ToolsCLI() {
+}
+
+ToolsCLI::~ToolsCLI() {
+}
+
+int ToolsCLI::run(int argc, char *argv[]) {
+	// No matter what we ouput, we should begin with a newline
+	std::cout << "\n"; 
+
+	if (argc == 1) {
+		// Run without any arguments
+		printHelp();
+		return 0;
+	}
+
+	std::deque<char *> arguments(argv, argv + argc);
+	arguments.pop_front(); // Pop our own name
+
+	ToolType type = TOOLTYPE_ALL;
+
+	// Check first argument
+	std::string option = arguments.front();
+	if (option == "--tool" || option == "-t") {
+		arguments.pop_front();
+		for (ToolList::iterator iter = _tools.begin(); iter != _tools.end(); ++iter) {
+			Tool *tool = *iter;
+			if (arguments.front() == tool->getName()) {
+				// Run the tool, first argument will be name, very nice!
+				return tool->run(arguments.size(), &arguments.front());
+			}
+		}
+		std::cout << "\tUnknown tool, make sure you input one of the following:\n";
+		printTools();
+	} else if (option == "--help" || option == "-h") {
+		printHelp();
+	} else if (option == "--list" || option == "-l") {
+		printTools();
+	} else {
+		// Allow user to the narrow choices
+		if(option == "compress") {
+			type = TOOLTYPE_COMPRESSION;
+			arguments.pop_front();
+		} else if(option == "extract") {
+			type = TOOLTYPE_EXTRACTION;
+			arguments.pop_front();
+		}
+
+		// Find out what tools take this file as input
+		ToolList choices = inspectInput(type, arguments);
+		Tool *tool = NULL;
+
+		if (choices.size() > 1) {
+			std::cout << "\tMultiple tools accept this input:\n\n";
+
+			// Present a list of possible tools
+			int i = 1;
+			for (ToolList::iterator choice = choices.begin(); choice != choices.end(); ++choice, ++i) {
+				std::cout << "\t" << i << ") " << (*choice)->getName() << "\n";
+			}
+
+			std::cout << "Which tool to use: ";
+			i = 0;
+			while(true) {
+
+				// Read input
+				std::cin >> i;
+
+				// Valid ?
+				if(std::cin && i >= 1 && (size_t)i < choices.size())
+					break;
+
+				std::cout << "Invalid input, try again: ";
+
+				// Clear any error flags
+				std::cin.clear();
+
+				// Skip invalid input characters
+				std::cin.ignore(1000, '\n');
+			}
+
+			// Account for the fact arrays start at 0
+			tool = choices[i - 1];
+		} else {
+			tool = choices.front();
+		}
+
+		std::cout << "\tRunning using " << tool->getName() << "\n";
+		
+		// Run the tool, with the remaining arguments
+		// We also add the name of the tool so it can displayed (requires an evil cast but it's safe)
+		std::string name = tool->getName();
+		arguments.push_front(const_cast<char *>(name.c_str()));
+		return tool->run(arguments.size(), &arguments.front());
+	}
+
+	return 0;
+}
+
+void ToolsCLI::printHelp() {
+	std::cout << 
+		"\tScumm VM Tools master interface\n" <<
+		"\n" <<
+		"\tCommon use:\n" <<
+		"\ttools [--tool <tool name>] [compression options] [-o output directory] <input args>\n" <<
+		"\ttools [extract|compress] <input args>\n" <<
+		"\n" <<
+		"\tOther Options:\n" <<
+		"\t--help\tDisplay this text\n" <<
+		"\t--list\tList all tools that are available\n" <<
+		"";
+}
+
+void ToolsCLI::printTools() {
+	for (ToolList::iterator tool = _tools.begin(); tool != _tools.end(); ++tool)
+		// There *really* should be a short version of the help text available
+		std::cout << "\t" << (*tool)->getName() << ": " << (*tool)->getHelp() << "\n";
+}
+
+


Property changes on: tools/branches/gsoc2009-gui/tools_cli.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Added: tools/branches/gsoc2009-gui/tools_cli.h
===================================================================
--- tools/branches/gsoc2009-gui/tools_cli.h	                        (rev 0)
+++ tools/branches/gsoc2009-gui/tools_cli.h	2009-07-25 16:27:18 UTC (rev 42770)
@@ -0,0 +1,42 @@
+/* tools_cli - CLI interface for the tools
+ * Copyright (C) 2009 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL
+ * $Id
+ *
+ */
+
+
+#ifndef CLI_TOOLS_H
+#define CLI_TOOLS_H
+
+#include "tools.h"
+
+// Does nothing
+
+class ToolsCLI : public Tools {
+public:
+	ToolsCLI();
+	~ToolsCLI();
+
+	int run(int argc, char *argv[]);
+
+	void printHelp();
+	void printTools();
+};
+
+#endif


Property changes on: tools/branches/gsoc2009-gui/tools_cli.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list