summaryrefslogtreecommitdiffstats
path: root/src/extension/script
diff options
context:
space:
mode:
authorsu_v <suv-sf@users.sourceforge.net>2013-08-29 21:06:10 +0000
committer~suv <suv-sf@users.sourceforge.net>2013-08-29 21:06:10 +0000
commit4d331e73a76dce7d703716093923ca01b3cc5936 (patch)
treeb444657ba269b25f60684e66858a138b74fe240d /src/extension/script
parentFix compiler warnings (diff)
parentUpdating outdated test. Fixes bug #1202271. (diff)
downloadinkscape-4d331e73a76dce7d703716093923ca01b3cc5936.tar.gz
inkscape-4d331e73a76dce7d703716093923ca01b3cc5936.zip
merge from trunk (r12487)
(bzr r11668.1.75)
Diffstat (limited to 'src/extension/script')
-rw-r--r--src/extension/script/InkscapeScript.cpp223
-rw-r--r--src/extension/script/InkscapeScript.h102
-rw-r--r--src/extension/script/Makefile_insert6
-rw-r--r--src/extension/script/makefile.in17
4 files changed, 0 insertions, 348 deletions
diff --git a/src/extension/script/InkscapeScript.cpp b/src/extension/script/InkscapeScript.cpp
deleted file mode 100644
index 02cd28fa5..000000000
--- a/src/extension/script/InkscapeScript.cpp
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * This is a simple mechanism to bind Inkscape to Java, and thence
- * to all of the nice things that can be layered upon that.
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2007-2008 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#include "InkscapeScript.h"
-
-
-#include <bind/javabind.h>
-
-
-namespace Inkscape
-{
-namespace Extension
-{
-namespace Script
-{
-
-
-typedef Inkscape::Bind::Value Value;
-
-
-/**
- *
- */
-InkscapeScript::InkscapeScript()
-{
-}
-
-
-
-
-/**
- *
- */
-InkscapeScript::~InkscapeScript()
-{
-}
-
-
-
-
-/**
- * Interprets the script in the 'script' buffer,
- * storing the stdout output in 'output', and any
- * error messages in 'error.' Language is one of the
- * enumerated types in ScriptLanguage above.
- */
-bool InkscapeScript::interpretScript(const Glib::ustring &script,
- Glib::ustring & /*output*/,
- Glib::ustring & /*error*/,
- ScriptLanguage language)
-{
- const char *langname=NULL;
- //if() instead of switch() lets us scope vars
- if (language == InkscapeScript::JAVASCRIPT)
- {
- langname="javascript";
- }
- else if (language == InkscapeScript::PYTHON)
- {
- langname="python";
- }
- else if (language == InkscapeScript::RUBY)
- {
- langname="ruby";
- }
- else
- {
- g_warning("interpretScript: Unknown Script Language type: %d\n",
- language);
- return false;
- }
-
- Inkscape::Bind::JavaBindery *binder =
- Inkscape::Bind::JavaBindery::getInstance();
- if (!binder->loadJVM()) //idempotent
- {
- g_warning("interpretScript: unable to start JVM\n");
- return false;
- }
- std::vector<Value> parms;
- Value retval;
- Value parm;
- parm.setString(langname);
- parms.push_back(parm);
- parm.setString(script);
- parms.push_back(parm);
-
- //binder->stdOutClear();
- //binder->stdErrClear();
- bool ret = binder->callStatic(Value::BIND_BOOLEAN,
- "org/inkscape/cmn/ScriptRunner",
- "run",
- "(Ljava/lang/String;Ljava/lang/String;)Z",
- parms,
- retval);
- //output = binder->stdOutGet();
- //error = binder->stdErrGet();
-
- if (!ret)
- {
- g_warning("interpretScript: failed\n");
- return false;
- }
-
- return true;
-}
-
-
-/**
- * Interprets the script in the named file,
- * storing the stdout output in 'output', and any
- * error messages in 'error.' Language is one of the
- * enumerated types in ScriptLanguage above.
- */
-bool InkscapeScript::interpretFile(const Glib::ustring &fname,
- Glib::ustring & /*output*/,
- Glib::ustring & /*error*/,
- ScriptLanguage language)
-{
- const char *langname=NULL;
- //if() instead of switch() lets us scope vars
- if (language == InkscapeScript::JAVASCRIPT)
- {
- langname="Javascript";
- }
- else if (language == InkscapeScript::PYTHON)
- {
- langname="Python";
- }
- else if (language == InkscapeScript::RUBY)
- {
- langname="Ruby";
- }
- else
- {
- g_warning("interpretFile: Unknown Script Language type: %d\n",
- language);
- return false;
- }
-
- Inkscape::Bind::JavaBindery *binder =
- Inkscape::Bind::JavaBindery::getInstance();
- if (!binder->loadJVM()) //idempotent
- {
- g_warning("interpretFile: unable to start JVM\n");
- return false;
- }
- std::vector<Value> parms;
- Value retval;
- Value parm;
- parm.setString(langname);
- parms.push_back(parm);
- parm.setString(fname);
- parms.push_back(parm);
-
- //binder->stdOutClear();
- //binder->stdErrClear();
- bool ret = binder->callStatic(Value::BIND_BOOLEAN,
- "org/inkscape/cmn/ScriptRunner",
- "runFile",
- "(Ljava/lang/String;Ljava/lang/String;)Z",
- parms,
- retval);
- //output = binder->stdOutGet();
- //error = binder->stdErrGet();
-
- if (!ret)
- {
- g_warning("interpretFile: failed\n");
- return false;
- }
-
- return true;
-}
-
-
-
-
-
-
-
-
-
-} // namespace Script
-} // namespace Extension
-} // namespace Inkscape
-
-//#########################################################################
-//# E N D O F F I L E
-//#########################################################################
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/src/extension/script/InkscapeScript.h b/src/extension/script/InkscapeScript.h
deleted file mode 100644
index 8d6346582..000000000
--- a/src/extension/script/InkscapeScript.h
+++ /dev/null
@@ -1,102 +0,0 @@
-#ifndef SEEN_INKSCAPE_SCRIPT_H
-#define SEEN_INKSCAPE_SCRIPT_H
-
-/*
- * Authors:
- * Bob Jamison <rjamison@titan.com>
- *
- * Copyright (C) 2004-2008 Bob Jamison
- *
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#include "config.h"
-
-namespace Glib {
-class ustring;
-}
-
-namespace Inkscape
-{
-namespace Extension
-{
-namespace Script
-{
-
-
-
-/**
- * Inkscape Scripting container.
- * This class is used to run scripts, either from a file or buffer.
- */
-class InkscapeScript
-{
-public:
-
- /**
- * Which type of language?
- */
- typedef enum
- {
- JAVASCRIPT,
- PYTHON,
- RUBY
- } ScriptLanguage;
-
- /**
- * Creates a generic script interpreter.
- */
- InkscapeScript();
-
- /**
- * Destructor
- */
- virtual ~InkscapeScript();
-
- /**
- * Interprets the script in the 'script' buffer,
- * storing the stdout output in 'output', and any
- * error messages in 'error.' Language is one of the
- * enumerated types in ScriptLanguage above.
- */
- bool interpretScript(const Glib::ustring &script,
- Glib::ustring &output,
- Glib::ustring &error,
- ScriptLanguage language);
-
- /**
- * Interprets the script in the named file,
- * storing the stdout output in 'output', and any
- * error messages in 'error.' Language is one of the
- * enumerated types in ScriptLanguage above.
- */
- bool interpretFile(const Glib::ustring &fname,
- Glib::ustring &output,
- Glib::ustring &error,
- ScriptLanguage language);
-
-
-
-}; //class InkscapeScript
-
-
-
-
-} // namespace Script
-} // namespace Extension
-} // namespace Inkscape
-
-
-
-#endif /* __INKSCAPE_SCRIPT_H__ */
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/src/extension/script/Makefile_insert b/src/extension/script/Makefile_insert
deleted file mode 100644
index c0bd91e81..000000000
--- a/src/extension/script/Makefile_insert
+++ /dev/null
@@ -1,6 +0,0 @@
-## Makefile.am fragment sourced by src/Makefile.am.
-
-ink_common_sources += \
- extension/script/InkscapeScript.h \
- extension/script/InkscapeScript.cpp
-
diff --git a/src/extension/script/makefile.in b/src/extension/script/makefile.in
deleted file mode 100644
index f4857a9e3..000000000
--- a/src/extension/script/makefile.in
+++ /dev/null
@@ -1,17 +0,0 @@
-# Convenience stub makefile to call the real Makefile.
-
-@SET_MAKE@
-
-OBJEXT = @OBJEXT@
-
-# Explicit so that it's the default rule.
-all:
- cd ../.. && $(MAKE) extension/script/all
-
-clean %.a %.$(OBJEXT):
- cd ../.. && $(MAKE) extension/script/$@
-
-.PHONY: all clean
-
-.SUFFIXES:
-.SUFFIXES: .a .$(OBJEXT)