[rkward-cvs] SF.net SVN: rkward:[2781] trunk/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Wed Mar 10 11:56:17 UTC 2010
Revision: 2781
http://rkward.svn.sourceforge.net/rkward/?rev=2781&view=rev
Author: tfry
Date: 2010-03-10 11:56:17 +0000 (Wed, 10 Mar 2010)
Log Message:
-----------
Initialize output file with an appropriate encoding specification.
See http://www.mail-archive.com/rkward-devel@lists.sourceforge.net/msg00621.html
Modified Paths:
--------------
trunk/rkward/ChangeLog
trunk/rkward/rkward/rbackend/rembedinternal.cpp
trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R
trunk/rkward/rkward/windows/rkhtmlwindow.cpp
Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog 2010-03-10 11:47:00 UTC (rev 2780)
+++ trunk/rkward/ChangeLog 2010-03-10 11:56:17 UTC (rev 2781)
@@ -1,3 +1,4 @@
+- Initialize the output file with an appropriate encoding specification
- Add SVG support to export (graphics) plugin
- Add basic settings format settings for graphics output TODO: somehow, SVG does not work correctly in khtmlpart, thus not the default for now. Can we do anything about this?
- Convert all plugins to use ECMAscript instead of PHP; RKWard no longer depends on PHP
Modified: trunk/rkward/rkward/rbackend/rembedinternal.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rembedinternal.cpp 2010-03-10 11:47:00 UTC (rev 2780)
+++ trunk/rkward/rkward/rbackend/rembedinternal.cpp 2010-03-10 11:56:17 UTC (rev 2781)
@@ -2,7 +2,7 @@
rembedinternal - description
-------------------
begin : Sun Jul 25 2004
- copyright : (C) 2004, 2005, 2006, 2007, 2008, 2009 by Thomas Friedrichsmeier
+ copyright : (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -712,6 +712,22 @@
return R_NilValue;
}
+// returns the MIME-name of the current locale encoding (from Qt)
+SEXP doLocaleName () {
+ RK_TRACE (RBACKEND);
+
+ RK_ASSERT (REmbedInternal::this_pointer->current_locale_codec);
+ SEXP res = allocVector(STRSXP, 1);
+ PROTECT (res);
+#ifdef R_2_9
+ SET_STRING_ELT (res, 0, mkChar (REmbedInternal::this_pointer->current_locale_codec->name ().data ()));
+#else
+ SET_VECTOR_ELT (res, 0, mkChar (REmbedInternal::this_pointer->current_locale_codec->name ().data ()));
+#endif
+ UNPROTECT (1);
+ return res;
+}
+
#include "rkstructuregetter.cpp"
SEXP doGetStructure (SEXP toplevel, SEXP name, SEXP envlevel, SEXP namespacename) {
@@ -805,12 +821,13 @@
// { "rk.do.condition", (DL_FUNC) &doCondition, 1 },
{ "rk.do.error", (DL_FUNC) &doError, 1 },
{ "rk.do.command", (DL_FUNC) &doSubstackCall, 1 },
- { "rk.update.locale", (DL_FUNC) &doUpdateLocale, 0 },
{ "rk.get.structure", (DL_FUNC) &doGetStructure, 4 },
{ "rk.get.structure.global", (DL_FUNC) &doGetGlobalEnvStructure, 3 },
{ "rk.copy.no.eval", (DL_FUNC) &doCopyNoEval, 3 },
{ "rk.edit.files", (DL_FUNC) &doEditFiles, 3 },
{ "rk.show.files", (DL_FUNC) &doShowFiles, 4 },
+ { "rk.update.locale", (DL_FUNC) &doUpdateLocale, 0 },
+ { "rk.locale.name", (DL_FUNC) &doLocaleName, 0 },
{ 0, 0, 0 }
};
R_registerRoutines (R_getEmbeddingDllInfo(), NULL, callMethods, NULL, NULL);
Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R 2010-03-10 11:47:00 UTC (rev 2780)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R 2010-03-10 11:56:17 UTC (rev 2781)
@@ -114,10 +114,17 @@
return (.rk.output.html.file)
}
-"rk.set.output.html.file" <- function (x) {
+"rk.set.output.html.file" <- function (x, no.init=FALSE) {
stopifnot (is.character (x))
.rk.do.call ("set.output.file", x);
assign (".rk.output.html.file", x, as.environment ("package:rkward"))
+
+ if (!(no.init | file.exists (x))) {
+ .rk.cat.output (paste ("<?xml version=\"1.0\" encoding=\"", .Call ("rk.locale.name"), "\"?>\n", sep=""));
+ .rk.cat.output ("<html><head><title>RKWard Output</title></head>\n<body>\n")
+ # This initial output mostly to indicate the output is really there, just empty for now
+ .rk.cat.output (paste ("<pre>RKWard output initialized", date (), "</pre>\n"));
+ }
}
# renames a named object in a data.frame/list without changing it's position
Modified: trunk/rkward/rkward/windows/rkhtmlwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkhtmlwindow.cpp 2010-03-10 11:47:00 UTC (rev 2780)
+++ trunk/rkward/rkward/windows/rkhtmlwindow.cpp 2010-03-10 11:56:17 UTC (rev 2781)
@@ -2,7 +2,7 @@
rkhtmlwindow - description
-------------------
begin : Wed Oct 12 2005
- copyright : (C) 2005, 2006, 2007, 2009 by Thomas Friedrichsmeier
+ copyright : (C) 2005, 2006, 2007, 2009, 2010 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -36,6 +36,7 @@
#include <QHostInfo>
#include "../rkglobals.h"
+#include "../rbackend/rinterface.h"
#include "rkhelpsearchwindow.h"
#include "../rkward.h"
#include "../rkconsole.h"
@@ -397,7 +398,7 @@
khtmlpart->begin();
if (window_mode == HTMLOutputWindow) {
- khtmlpart->write (i18n ("<HTML><BODY><H1>RKWard output</H1>\n<P>The output is empty.</P>\n</BODY></HTML>"));
+ khtmlpart->write (i18n ("<HTML><BODY><H1>RKWard output file could not be found</H1>\n</BODY></HTML>"));
} else {
khtmlpart->write ("<html><body><h1>" + i18n ("Page does not exist or is broken") + "</h1></body></html>");
}
@@ -420,6 +421,9 @@
QFile file (out_dir.absoluteFilePath (*it));
file.remove ();
}
+
+ // initialize the now empty file
+ RKGlobals::rInterface ()->issueCommand ("rk.set.output.html.file (\"" + out_file.fileName () + "\")\n", RCommand::App);
refresh ();
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list