Skip to content

Instantly share code, notes, and snippets.

View tav's full-sized avatar

tav

View GitHub Profile
import os def run_execve(program, args=None, env=None): if args is None: args = [program] if env is None: env = {} # we cannot directly call ll_execve() because it replaces the # current process. fd_read, fd_write = os.pipe() childpid = os.fork() if childpid == 0: # in the child os.close(fd_read) os.dup2(fd_write, 1) # stdout os.close(fd_write) os.execve(program, args, env) assert 0, "should not arrive here" else: # in the parent os.close(fd_write) child_stdout = [] while True: data = os.read(fd_read, 4096) if not data: break # closed child_stdout.append(data) pid, status = os.waitpid(childpid, 0) os.close(fd_read) print "#", child_stdout print pid, status return status, ''.join(child_stdout) # run_execve('/usr/bin/which', ['/usr/bin/which', 'true']) run_execve('/bin/echo', ['/bin/echo', 'true'])
the basic idea is that we encapsulate Objects and primitive types into an API that allows dynamic binding of properties, methods, etc
[09:28] marshall_law: our entire runtime uses the binding API for all exposing
[09:28] marshall_law: so it's basically the common runtime model for Python, Ruby, and Javascript
[09:28] marshall_law: the language runtimes entire job is to adapt their language runtime to our binding API
[09:29] tav: is there any dom specific integration ?
[09:29] marshall_law: we have some custom code that exposes the window object etc back into each language runtime yes
[09:29] marshall_law: we expose window, and document i believe
[09:30] marshall_law: and of course, Titanium)
[09:36] tav: i was going to ask how you handle dom events
[09:36] marshall_law: we don't do anything special for DOM events..
<script type="text/python">
def dom_from_python(s):
document.getElementById('name').innerHTML = s
def foo():
return u'tav'
</script>
<div>
rumi:webkit_titanium tav$ ./WebKitTools/Scripts/build-webkit --debug ARCHS="i386" ONLY_ACTIVE_ARCH=NO > foolog.txt
** BUILD FAILED **
The following build commands failed:
WebKit:
CompileC /Users/tav/work/third_party/generic/webkit_titanium/WebKitBuild/WebKit.build/Debug/WebKit.build/Objects-normal/i386/WebScriptElement.o /Users/tav/work/third_party/generic/webkit_titanium/WebKit/mac/WebView/WebScriptElement.mm normal i386 objective-c++ com.apple.compilers.gcc.4_2
(1 failure)
CompileC /Users/tav/work/third_party/generic/webkit_titanium/WebKitBuild/WebKit.build/Debug/WebKit.build/Objects-normal/i386/WebScriptElement.o /Users/tav/work/third_party/generic/webkit_titanium/WebKit/mac/WebView/WebScriptElement.mm normal i386 objective-c++ com.apple.compilers.gcc.4_2
cd /Users/tav/work/third_party/generic/webkit_titanium/WebKit
/Developer/usr/bin/gcc-4.2 -x objective-c++ -arch i386 -fmessage-length=0 -pipe -Wno-trigraphs -fno-exceptions -fno-rtti -fpascal-strings -fasm-blocks -O0 -Werror -Wnon-virtual-dtor -Wnewline-eof -DDISABLE_THREAD_CHECK -DENABLE_WEBKIT_UNSET_DYLD_FRAMEWORK_PATH -DENABLE_DATABASE -DENABLE_DOM_STORAGE -DENABLE_ICONDATABASE -DENABLE_JAVASCRIPT_DEBUGGER -DENABLE_OFFLINE_WEB_APPLICATIONS -DENABLE_SVG -DENABLE_SVG_ANIMATION -DENABLE_SVG_AS_IMAGE -DENABLE_SVG_DOM_OBJC_BINDINGS -DENABLE_SVG_FONTS -DENABLE_SVG_FOREIGN_OBJECT -DENABLE_SVG_USE -DENABLE_VIDEO -DENABLE_WORKERS -DENABLE_XPATH -DENABLE_XSLT -DFRAMEWORK_NAME=WebKit -DWEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSI
[user]
email = [email protected]
name = tav
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = auto
[github]
Ld /Users/tav/work/third_party/generic/webkit_titanium/WebKitBuild/titanium_pr4/Debug/WebCore.framework/Versions/A/WebCore normal i386
cd /Users/tav/work/third_party/generic/webkit_titanium/WebCore
setenv MACOSX_DEPLOYMENT_TARGET 10.5
/Developer/usr/bin/g++-4.0 -arch i386 -dynamiclib -L/Users/tav/work/third_party/generic/webkit_titanium/WebKitBuild/titanium_pr4/Debug -F/Users/tav/work/third_party/generic/webkit_titanium/WebKitBuild/titanium_pr4/Debug -F/System/Library/Frameworks/Carbon.framework/Frameworks -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks -filelist /Users/tav/work/third_party/generic/webkit_titanium/WebKitBuild/titanium_pr4/WebCore.build/Debug/WebCore.build/Objects-normal/i386/WebCore.LinkFileList -Wl,--no-demangle -exported_symbols_list /Users/tav/work/third_party/generic/webkit_titanium/WebKitBuild/titanium_pr4/Debug/DerivedSources/WebCore/WebCore.exp -install_name /Users/tav/work/third_party/generic/webkit_titanium/WebKitBuild/titanium_pr4/Debug/WebCore.fram
Ld /Users/tav/work/third_party/generic/webkit_titanium/WebKitBuild/titanium_pr4/Debug/WebCore.framework/Versions/A/WebCore normal i386
cd /Users/tav/work/third_party/generic/webkit_titanium/WebCore
setenv MACOSX_DEPLOYMENT_TARGET 10.5
/Developer/usr/bin/g++-4.0 -arch i386 -dynamiclib -L/Users/tav/work/third_party/generic/webkit_titanium/WebKitBuild/titanium_pr4/Debug -L/Users/tav/work/third_party/generic/webkit_titanium/WebCore/libnaaga -F/Users/tav/work/third_party/generic/webkit_titanium/WebKitBuild/titanium_pr4/Debug -F/System/Library/Frameworks/Carbon.framework/Frameworks -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks -filelist /Users/tav/work/third_party/generic/webkit_titanium/WebKitBuild/titanium_pr4/WebCore.build/Debug/WebCore.build/Objects-normal/i386/WebCore.LinkFileList -Wl,--no-demangle -exported_symbols_list /Users/tav/work/third_party/generic/webkit_titanium/WebKitBuild/titanium_pr4/Debug/DerivedSources/WebCore/WebCore.exp -install_name /Users/tav/work/third_pa
#include "naaga.h"
#define EXPORT __attribute__((visibility("default")))
EXPORT
char *RPython_StartupCode() {
}
EXPORT
char *RPython_StartupCode();
long interpret(char *foo, char *bar);