All pastes #153073 Raw Edit

Someone

public cpp v1 · immutable
#153073 ·published 2006-08-29 11:12 UTC
rendered paste body
/*	Copyright (C) 2003-2006 Cies Breijs <cies # kde ! nl>	This program is free software; you can redistribute it and/or	modify it under the terms of version 2 of the GNU General Public	License as published by the Free Software Foundation.	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.*/// general stuff#include <kaboutdata.h>#include <kapplication.h>#include <kcmdlineargs.h>#include <klocale.h>// for gui execution#include "mainwindow.h"// for nogui execution#include <stdio.h>#include <stdlib.h>#include <QString>#include <QFile>#include <QTextStream>#include <QDebug>#include "interpreter/interpreter.h"#include "interpreter/echoer.h"void messageOutput(QtMsgType type, const char *msg) {	// message handler for nogui execution	switch (type) {		case QtDebugMsg:    fprintf(stderr, "debug: %s\n", msg);    break;		case QtWarningMsg:  fprintf(stderr, "warning: %s\n", msg);  break;		case QtCriticalMsg: fprintf(stderr, "critical: %s\n", msg); break;		case QtFatalMsg:    fprintf(stderr, "fatal: %s\n", msg);    abort();	}}static const char description[] =	I18N_NOOP("KTurtle is an educational programming environment.");static const char version[]   = "0.8 beta";static const char copyright[] = "(C) 2006 Cies Breijs";static const char website[]   = "http://edu.kde.org/kturtle";static KCmdLineOptions options[] = {	{"input <file>", I18N_NOOP("File to open"), 0},	{"i", 0, 0},	{"nogui", I18N_NOOP("Starts KTurtle without a GUI (i.e. for unit testing)"), 0},	{"n", 0, 0},	{ "+[ouput file]", I18N_NOOP("A file to write the output to (only works in nonGUI mode)"), 0 },	KCmdLineLastOption};int main(int argc, char* argv[]){	KAboutData about("kturtle", I18N_NOOP("KTurtle"), version, description, KAboutData::License_GPL, copyright, 0, website);	about.addAuthor("Cies Breijs",	      I18N_NOOP("Initiator and core developer"),	                "cies # kde.nl");	// include the only resources, namely: the default language (en_US) files// 	Q_INIT_RESOURCE(resources);	KCmdLineArgs::init(argc, argv, &about);	KCmdLineArgs::addCmdLineOptions(options);	KCmdLineArgs* args = KCmdLineArgs::parsedArgs();	KApplication app;	if (args->isSet("nogui")) {		///////////////// run without a gui /////////////////		qDebug() << "A command line interface to the KTurtle interpreter mainly for (unit-) testing";		qDebug() << "Copyright (c) 2005-2006 by Cies Breijs\n";		if (argc <= 1) {			qDebug() << "Error; no file name specified...";			qDebug() << "Use the --help flag for more information.";		} else {