Permalink
Browse files

Porting over some changes from our PyPy integration branch.

  • Loading branch information...
1 parent cc6c473 commit 52a384cd39ead937337a26198c704fd369bde9f2 @tav committed Oct 31, 2009
View
43 WebCore/bindings/python/PyPy.cpp
@@ -0,0 +1,43 @@
+#include "config.h"
+
+#include "PlatformString.h"
+
+#include <ScriptSourceCode.h>
+
+#include "PlatformString.h"
+#include <wtf/Platform.h>
+#include <parser/SourceProvider.h>
+#include "ScriptController.h"
+#include <parser/SourceCode.h>
+#include "PyPy.h"
+#include <stdio.h>
+
+extern "C" char *RPython_StartupCode();
+extern "C" long interpret(const char *, char *);
+
+namespace WebCore {
+ class String;
+
+ int started_up = 0;
+
+ bool PyPyScriptEvaluator::matchesMimeType(const String& mimeType)
+ {
+ if (mimeType == String("python")) {
+ return(true);
+ }
+ return(false);
+ }
+
+ void PyPyScriptEvaluator::evaluate(const String& mimeType, const ScriptSourceCode& sourceCode, void *context)
+ {
+ if (mimeType == String("python")) {
+ if (!started_up) {
+ started_up = 1;
+ RPython_StartupCode();
+ }
+ }
+
+ interpret(sourceCode.jsSourceCode().toString().UTF8String().c_str(), (char*)context);
+ }
+
+}
View
19 WebCore/bindings/python/PyPy.h
@@ -0,0 +1,19 @@
+#ifndef PyPy_h
+#define PyPy_h
+
+#include <ScriptEvaluator.h>
+
+namespace WebCore {
+ class String;
+ class ScriptSourceCode;
+
+ class PyPyScriptEvaluator: public ScriptEvaluator {
+ public:
+ ~PyPyScriptEvaluator(){}
+
+ bool matchesMimeType(const String& mimeType);
+ void evaluate(const String& mimeType, const ScriptSourceCode& sourceCode, void *context);
+ };
+}
+
+#endif
View
3 WebCore/libnaaga/build.sh
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+g++ naaga.c -dynamiclib -o libnaaga.dylib
View
18 WebCore/libnaaga/naaga.c
@@ -0,0 +1,18 @@
+#include "naaga.h"
+
+/*
+
+#define EXPORT __attribute__((visibility("default")))
+
+*/
+
+
+//EXPORT
+
+extern "C" char *RPython_StartupCode() {
+}
+
+// EXPORT
+
+extern "C" long interpret(char *foo, char *bar) {
+}
View
3 WebCore/libnaaga/naaga.h
@@ -0,0 +1,3 @@
+extern "C" char *RPython_StartupCode();
+
+extern "C" long interpret(char *foo, char *bar);

0 comments on commit 52a384c

Please sign in to comment.