+void Pointer::PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const {
+ bool guess(false);
+ *reinterpret_cast<void **>(data) = CYCastPointer<void *>(context, value, &guess);
+ if (!guess || pool == NULL || !JSValueIsObject(context, value))
+ return;
+ JSObjectRef object(CYCastJSObject(context, value));
+ if (CYHasProperty(context, object, length_s)) {
+ size_t length(CYArrayLength(context, object));
+ ffi_type *element(type.GetFFI(*pool));
+ size_t size(element->size * length);
+ uint8_t *base(pool->malloc<uint8_t>(size, element->alignment));
+ CYArrayCopy(pool, context, base, length, type, element, value, object);
+ *reinterpret_cast<void **>(data) = base;
+ }
+}
+
+void Array::PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const {
+ if (size == 0)
+ return;
+ uint8_t *base(reinterpret_cast<uint8_t *>(data));
+ JSObjectRef object(JSValueIsObject(context, value) ? (JSObjectRef) value : NULL);
+ CYArrayCopy(pool, context, base, size, type, ffi->elements[0], value, object);
+}
+
+void Enum::PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const {
+ return type.PoolFFI(pool, context, ffi, data, value);
+}
+