This repository has been archived by the owner on Sep 17, 2018. It is now read-only.
forked from appcelerator-archive/webkit_titanium_legacy
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Porting over some changes from our PyPy integration branch.
- Loading branch information
Showing
5 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#! /bin/sh | ||
|
||
g++ naaga.c -dynamiclib -o libnaaga.dylib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |