Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added stubs for marshalling between .NET objects and JSCore objects

Signed-off-by: Peter Nelson <peter@peterdn.com>
  • Loading branch information...
commit 366245130a9ed87769b232030130b796d3e8ba65 1 parent f2bbd52
@peterdn peterdn authored
Showing with 65 additions and 0 deletions.
  1. +55 −0 JSCore/JSCoreObjectWrapper.cpp
  2. +10 −0 JSCore/JSCoreObjectWrapper.h
View
55 JSCore/JSCoreObjectWrapper.cpp
@@ -0,0 +1,55 @@
+#include "stdafx.h"
+
+#include "JSCoreObjectWrapper.h"
+
+
+JSClassDefinition wrapperClass =
+{
+ 0, /* int version; */
+ kJSClassAttributeNone, /* JSClassAttributes attributes; */
+
+ "wrapper", /* const char* className; */
+ NULL, /* JSClassRef parentClass; */
+
+ NULL, /* const JSStaticValue* staticValues; */
+ NULL, /* const JSStaticFunction* staticFunctions; */
+
+ NULL, /* JSObjectInitializeCallback initialize; */
+ NULL, /* JSObjectFinalizeCallback finalize; */
+ wrapper_HasProperty, /* JSObjectHasPropertyCallback hasProperty; */
+ wrapper_GetProperty, /* JSObjectGetPropertyCallback getProperty; */
+ wrapper_SetProperty /* JSObjectSetPropertyCallback setProperty; */
+ /* JSObjectDeletePropertyCallback deleteProperty; */
+ /* JSObjectGetPropertyNamesCallback getPropertyNames; */
+ /* JSObjectCallAsFunctionCallback callAsFunction; */
+ /* JSObjectCallAsConstructorCallback callAsConstructor; */
+ /* JSObjectHasInstanceCallback hasInstance; */
+ /* JSObjectConvertToTypeCallback convertToType; */
+};
+
+bool wrapper_HasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName)
+{
+ void * ptr = JSObjectGetPrivate(object);
+ GCHandle handle = GCHandle::FromIntPtr(IntPtr(ptr));
+ Object ^ obj = handle.Target;
+
+ // TODO: reflection magicks
+
+ return false;
+}
+
+JSValueRef wrapper_GetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
+{
+ void * ptr = JSObjectGetPrivate(object);
+ GCHandle handle = GCHandle::FromIntPtr(IntPtr(ptr));
+ Object ^ obj = handle.Target;
+
+ // TODO: reflection magicks
+
+ return NULL;
+}
+
+bool wrapper_SetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
+{
+ return false;
+}
View
10 JSCore/JSCoreObjectWrapper.h
@@ -0,0 +1,10 @@
+#pragma once
+
+using namespace System;
+using namespace System::Runtime::InteropServices;
+
+extern JSClassDefinition wrapperClass;
+
+bool wrapper_HasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName);
+JSValueRef wrapper_GetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
+bool wrapper_SetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
Please sign in to comment.
Something went wrong with that request. Please try again.