From 4dd55d2fafdf8e8c93d16023f4d09de533113557 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 19 Jan 2014 12:14:58 -0800 Subject: [PATCH] CYONify pointers as the address of their values. --- Execute.cpp | 7 ++++++- JavaScript.hpp | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Execute.cpp b/Execute.cpp index be05f7b..7b39bb9 100644 --- a/Execute.cpp +++ b/Execute.cpp @@ -127,6 +127,7 @@ static JSClassRef Struct_; JSStringRef Array_s; JSStringRef cy_s; +JSStringRef cyi_s; JSStringRef length_s; JSStringRef message_s; JSStringRef name_s; @@ -1244,7 +1245,10 @@ static JSValueRef Pointer_callAsFunction_toCYON(JSContextRef context, JSObjectRe JSObjectRef Array(CYGetCachedObject(context, CYJSString("Array_prototype"))); JSObjectRef toCYON(CYCastJSObject(context, CYGetProperty(context, Array, toCYON_s))); return CYCallAsFunction(context, toCYON, _this, count, arguments); - } else { + } else try { + CYPool pool; + return CYCastJSValue(context, pool.strcat("&", CYPoolCCYON(pool, context, CYGetProperty(context, _this, cyi_s)), NULL)); + } catch (const CYException &e) { char string[32]; sprintf(string, "%p", internal->value_); return CYCastJSValue(context, string); @@ -1473,6 +1477,7 @@ void CYInitializeDynamic() { Array_s = JSStringCreateWithUTF8CString("Array"); cy_s = JSStringCreateWithUTF8CString("$cy"); + cyi_s = JSStringCreateWithUTF8CString("$cyi"); length_s = JSStringCreateWithUTF8CString("length"); message_s = JSStringCreateWithUTF8CString("message"); name_s = JSStringCreateWithUTF8CString("name"); diff --git a/JavaScript.hpp b/JavaScript.hpp index 70887c4..4ce43b6 100644 --- a/JavaScript.hpp +++ b/JavaScript.hpp @@ -39,6 +39,7 @@ extern JSStringRef Array_s; extern JSStringRef cy_s; +extern JSStringRef cyi_s; extern JSStringRef length_s; extern JSStringRef message_s; extern JSStringRef name_s; -- 2.47.2