Skip to content
This repository has been archived by the owner on Sep 17, 2018. It is now read-only.

Commit

Permalink
Porting over some changes from our PyPy integration branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
tav committed Oct 31, 2009
1 parent cc6c473 commit 52a384c
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 0 deletions.
43 changes: 43 additions & 0 deletions WebCore/bindings/python/PyPy.cpp
Original file line number Diff line number Diff line change
@@ -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);
}

}
19 changes: 19 additions & 0 deletions WebCore/bindings/python/PyPy.h
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions WebCore/libnaaga/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#! /bin/sh

g++ naaga.c -dynamiclib -o libnaaga.dylib
18 changes: 18 additions & 0 deletions WebCore/libnaaga/naaga.c
Original file line number Diff line number Diff line change
@@ -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) {
}
3 changes: 3 additions & 0 deletions WebCore/libnaaga/naaga.h
Original file line number Diff line number Diff line change
@@ -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.