diff options
12 files changed, 83 insertions, 70 deletions
diff --git a/gnunet-build/packages/gnunet/gnunet/Buildrules b/gnunet-build/packages/gnunet/gnunet/Buildrules index 6e45ddc..8e84763 100644 --- a/gnunet-build/packages/gnunet/gnunet/Buildrules +++ b/gnunet-build/packages/gnunet/gnunet/Buildrules @@ -32,7 +32,7 @@ pkg_compile() { --enable-logging=verbose \ ac_cv_lib_idn_stringprep_check_version=yes \ ac_cv_func_srandom=no \ - ac_cv_func_getifaddrs=no \ + ac_cv_func_getifaddrs=yes \ ac_cv_lib_socket_socket=no \ CPPFLAGS="-I${SYSROOT}/usr/include" \ LDFLAGS="-L${SYSROOT}/usr/lib" @@ -69,6 +69,7 @@ pkg_compile() { ${OPT_LEVEL} \ -s EXPORTED_FUNCTIONS=@"${F}/imports" \ --memory-init-file 1 \ + --use-preload-plugins \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/peerinfo/gnunet-service-peerinfo.js" \ "${S}/src/peerinfo/gnunet-service-peerinfo.o" \ @@ -119,6 +120,7 @@ pkg_compile() { -s MAIN_MODULE=1 \ -s EXPORTED_FUNCTIONS=@"${F}/imports" \ --memory-init-file 1 \ + --use-preload-plugins \ -s TOTAL_MEMORY=$((80 * 1024 * 1024)) \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/datastore/gnunet-service-datastore.js" \ @@ -157,6 +159,7 @@ pkg_compile() { -s MAIN_MODULE=1 \ -s EXPORTED_FUNCTIONS=@"${F}/imports" \ --memory-init-file 1 \ + --use-preload-plugins \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/ats/gnunet-service-ats.js" \ "${S}/src/ats/gnunet-service-ats"*.o \ @@ -195,6 +198,7 @@ pkg_compile() { -s MAIN_MODULE=1 \ -s EXPORTED_FUNCTIONS=@"${F}/imports" \ --memory-init-file 1 \ + --use-preload-plugins \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/transport/gnunet-service-transport.js" \ "${S}/src/transport/gnunet_service_transport-gnunet-service-transport"*.o \ @@ -224,6 +228,7 @@ pkg_compile() { ${OPT_LEVEL} \ -s EXPORTED_FUNCTIONS=@"${F}/imports" \ --memory-init-file 1 \ + --use-preload-plugins \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/core/gnunet-service-core.js" \ "${S}/src/core/gnunet-service-core"*.o \ @@ -249,6 +254,7 @@ pkg_compile() { ${OPT_LEVEL} \ -s EXPORTED_FUNCTIONS=@"${F}/imports" \ --memory-init-file 1 \ + --use-preload-plugins \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/nse/gnunet-service-nse.js" \ "${S}/src/nse/gnunet-service-nse.o" \ @@ -275,6 +281,7 @@ pkg_compile() { -s MAIN_MODULE=1 \ -s EXPORTED_FUNCTIONS=@"${F}/imports" \ --memory-init-file 1 \ + --use-preload-plugins \ -s TOTAL_MEMORY=$((32 * 1024 * 1024)) \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/dht/gnunet-service-dht.js" \ @@ -308,6 +315,7 @@ pkg_compile() { ${OPT_LEVEL} \ -s EXPORTED_FUNCTIONS=@"${F}/imports" \ --memory-init-file 1 \ + --use-preload-plugins \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/topology/gnunet-daemon-topology.js" \ "${S}/src/topology/gnunet-daemon-topology.o" \ @@ -337,6 +345,7 @@ pkg_compile() { -s MAIN_MODULE=1 \ -s EXPORTED_FUNCTIONS=@"${F}/imports" \ --memory-init-file 1 \ + --use-preload-plugins \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/cadet/gnunet-service-cadet.js" \ "${S}/src/cadet/gnunet_service_cadet"*.o \ @@ -379,6 +388,7 @@ pkg_compile() { -s MAIN_MODULE=1 \ -s EXPORTED_FUNCTIONS=@"${F}/imports" \ --memory-init-file 1 \ + --use-preload-plugins \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/peerstore/gnunet-service-peerstore.js" \ "${S}/src/peerstore/gnunet_service_peerstore"*.o \ @@ -405,6 +415,7 @@ pkg_compile() { -s MAIN_MODULE=1 \ -s EXPORTED_FUNCTIONS=@"${F}/imports" \ --memory-init-file 1 \ + --use-preload-plugins \ -s TOTAL_MEMORY=$((32 * 1024 * 1024)) \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/fs/gnunet-service-fs.js" \ diff --git a/gnunet-build/packages/gnunet/gnunet/files/client-pre.js b/gnunet-build/packages/gnunet/gnunet/files/client-pre.js index 2906cc8..5afee0d 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/client-pre.js +++ b/gnunet-build/packages/gnunet/gnunet/files/client-pre.js @@ -20,12 +20,13 @@ function ccallFunc(func, returnType, argTypes, args) { var ret = 0; if (str !== null && str !== undefined && str !== 0) { // null string // at most 4 bytes per UTF-8 code point, +1 for the trailing '\0' - ret = Runtime.stackAlloc((str.length << 2) + 1); - writeStringToMemory(str, ret); + var len = (str.length << 2) + 1; + ret = stackAlloc(len); + stringToUTF8(str, ret, len); } return ret; }, 'array' : function(arr) { - var ret = Runtime.stackAlloc(arr.length); + var ret = stackAlloc(arr.length); writeArrayToMemory(arr, ret); return ret; }}; @@ -35,7 +36,7 @@ function ccallFunc(func, returnType, argTypes, args) { for (var i = 0; i < args.length; i++) { var converter = toC[argTypes[i]]; if (converter) { - if (stack === 0) stack = Runtime.stackSave(); + if (stack === 0) stack = stackSave(); cArgs[i] = converter(args[i]); } else { cArgs[i] = args[i]; @@ -45,7 +46,7 @@ function ccallFunc(func, returnType, argTypes, args) { var ret = func.apply(null, cArgs); if (returnType === 'string') ret = Pointer_stringify(ret); if (stack !== 0) { - Runtime.stackRestore(stack); + stackRestore(stack); } return ret; } diff --git a/gnunet-build/packages/gnunet/gnunet/files/configuration.js b/gnunet-build/packages/gnunet/gnunet/files/configuration.js index 0d736ac..dcf17d7 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/configuration.js +++ b/gnunet-build/packages/gnunet/gnunet/files/configuration.js @@ -196,7 +196,7 @@ mergeInto(LibraryManager.library, { section = CONFIG[section_name]; for (var option in section) { var value = section[option]; - ccallFunc(Runtime.getFuncWrapper(iter, 'viiii'), 'void', + ccallFunc(getFuncWrapper(iter, 'viiii'), 'void', ['i32', 'string', 'string', 'string'], [iter_cls, section_name, option, value]); } diff --git a/gnunet-build/packages/gnunet/gnunet/files/network.js b/gnunet-build/packages/gnunet/gnunet/files/network.js index d33fdda..ef7c1bf 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/network.js +++ b/gnunet-build/packages/gnunet/gnunet/files/network.js @@ -178,7 +178,7 @@ mergeInto(LibraryManager.library, { } }; {{{ makeSetValue('address', '0', '1', 'i16') }}}; - writeStringToMemory(socket.name.slice(0, 107), address + 2); + stringToUTF8(socket.name, address + 2, 108); {{{ makeSetValue('address_len', '0', '110', 'i32') }}}; return sd; }, diff --git a/gnunet-build/packages/gnunet/gnunet/files/plugin.js b/gnunet-build/packages/gnunet/gnunet/files/plugin.js index 958cb6f..534b4d8 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/plugin.js +++ b/gnunet-build/packages/gnunet/gnunet/files/plugin.js @@ -31,7 +31,7 @@ mergeInto(LibraryManager.library, { _dlclose(handle); return 0; } - var ret = Runtime.dynCall('ii', sym, [arg]); + var ret = dynCall('ii', sym, [arg]); if (0 == ret) { _dlclose(handle); return 0; @@ -56,7 +56,7 @@ mergeInto(LibraryManager.library, { ['string', 'number'], [entry, arg]); if (rc !== 0) - ccallFunc(Runtime.getFuncWrapper(cb, 'viii'), 'void', + ccallFunc(getFuncWrapper(cb, 'viii'), 'void', ['number', 'string', 'number'], [cb_cls, entry, rc]); }); diff --git a/gnunet-build/packages/gnunet/gnunet/files/plugin_datastore_emscripten_int.js b/gnunet-build/packages/gnunet/gnunet/files/plugin_datastore_emscripten_int.js index 7402f0e..47c3a8f 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/plugin_datastore_emscripten_int.js +++ b/gnunet-build/packages/gnunet/gnunet/files/plugin_datastore_emscripten_int.js @@ -36,10 +36,10 @@ mergeInto(LibraryManager.library, { vhash: vhash}); request.onerror = function(e) { console.error('put request failed'); - Runtime.dynCall('viiiii', cont, [cont_cls, key_pointer, size, -1, 0]); + dynCall('viiiii', cont, [cont_cls, key_pointer, size, -1, 0]); }; request.onsuccess = function(e) { - Runtime.dynCall('viiiii', cont, [cont_cls, key_pointer, size, 1, 0]); + dynCall('viiiii', cont, [cont_cls, key_pointer, size, 1, 0]); }; }, emscripten_plugin_get_key_int: function(offset, key_pointer, vhash_pointer, @@ -55,7 +55,7 @@ mergeInto(LibraryManager.library, { .openCursor(key); request.onerror = function(e) { console.error('cursor request failed'); - Runtime.dynCall('iiiiiiiiiii', proc, + dynCall('iiiiiiiiiii', proc, [proc_cls, 0, 0, 0, 0, 0, 0, 0, 0, 0]); }; request.onsuccess = function(e) { @@ -84,11 +84,11 @@ mergeInto(LibraryManager.library, { return; } // got a result - var stack = Runtime.stackSave(); - var expiry = Runtime.stackAlloc(Runtime.getNativeTypeSize('double')); + var stack = stackSave(); + var expiry = stackAlloc(getNativeTypeSize('double')); setValue(expiry, cursor.value.expiry, 'double'); var ret = ccallFunc( - Runtime.getFuncWrapper(datum_processor_wrapper, + getFuncWrapper(datum_processor_wrapper, 'iiiiiiiiiii'), 'number', ['number', 'number', 'array', 'number', 'array', 'number', 'number', @@ -96,7 +96,7 @@ mergeInto(LibraryManager.library, { [proc, proc_cls, cursor.value.key, cursor.value.data.length, cursor.value.data, cursor.value.type, cursor.value.priority, cursor.value.anonymity, expiry, cursor.value.uid]); - Runtime.stackRestore(stack); + stackRestore(stack); if (!ret) { cursor.delete().onerror = function(e) { console.error('delete request failed'); @@ -112,7 +112,7 @@ mergeInto(LibraryManager.library, { return; } // not found - Runtime.dynCall('iiiiiiiiiii', proc, + dynCall('iiiiiiiiiii', proc, [proc_cls, 0, 0, 0, 0, 0, 0, 0, 0, 0]); } }; @@ -123,7 +123,7 @@ mergeInto(LibraryManager.library, { .openCursor(null, 'prev'); request.onerror = function(e) { console.error('cursor request failed'); - Runtime.dynCall('iiiiiiiiiii', proc, + dynCall('iiiiiiiiiii', proc, [proc_cls, 0, 0, 0, 0, 0, 0, 0, 0, 0]); }; request.onsuccess = function(e) { @@ -136,22 +136,22 @@ mergeInto(LibraryManager.library, { var request = transaction.objectStore('datastore').put(value); request.onerror = function(e) { console.error('put request failed'); - Runtime.dynCall('iiiiiiiiiii', proc, + dynCall('iiiiiiiiiii', proc, [proc_cls, 0, 0, 0, 0, 0, 0, 0, 0, 0]); }; request.onsuccess = function(e) { - var stack = Runtime.stackSave(); - var expiry = Runtime.stackAlloc(Runtime.getNativeTypeSize('double')); + var stack = stackSave(); + var expiry = stackAlloc(getNativeTypeSize('double')); setValue(expiry, cursor.value.expiry, 'double'); var ret = ccallFunc( - Runtime.getFuncWrapper(datum_processor_wrapper, 'iiiiiiiiiii'), + getFuncWrapper(datum_processor_wrapper, 'iiiiiiiiiii'), 'number', ['number', 'number', 'array', 'number', 'array', 'number', 'number', 'number', 'number', 'number'], [proc, proc_cls, cursor.value.key, cursor.value.data.length, cursor.value.data, cursor.value.type, cursor.value.priority, cursor.value.anonymity, expiry, cursor.value.uid]); - Runtime.stackRestore(stack); + stackRestore(stack); if (!ret) { cursor.delete().onerror = function(e) { console.error('delete request failed'); @@ -159,7 +159,7 @@ mergeInto(LibraryManager.library, { } }; } else { - Runtime.dynCall('iiiiiiiiiii', proc, + dynCall('iiiiiiiiiii', proc, [proc_cls, 0, 0, 0, 0, 0, 0, 0, 0, 0]); } }; @@ -170,18 +170,18 @@ mergeInto(LibraryManager.library, { .openCursor(IDBKeyRange.upperBound(now, true)); request.onerror = function(e) { console.error('cursor request failed'); - Runtime.dynCall('iiiiiiiiiii', proc, + dynCall('iiiiiiiiiii', proc, [proc_cls, 0, 0, 0, 0, 0, 0, 0, 0, 0]); }; request.onsuccess = function(e) { var cursor = e.target.result; if (cursor) { // got a result - var stack = Runtime.stackSave(); - var expiry = Runtime.stackAlloc(Runtime.getNativeTypeSize('double')); + var stack = stackSave(); + var expiry = stackAlloc(getNativeTypeSize('double')); setValue(expiry, cursor.value.expiry, 'double'); var ret = ccallFunc( - Runtime.getFuncWrapper(datum_processor_wrapper, + getFuncWrapper(datum_processor_wrapper, 'iiiiiiiiiii'), 'number', ['number', 'number', 'array', 'number', 'array', 'number', 'number', @@ -189,14 +189,14 @@ mergeInto(LibraryManager.library, { [proc, proc_cls, cursor.value.key, cursor.value.data.length, cursor.value.data, cursor.value.type, cursor.value.priority, cursor.value.anonymity, expiry, cursor.value.uid]); - Runtime.stackRestore(stack); + stackRestore(stack); if (!ret) { cursor.delete().onerror = function(e) { console.error('delete request failed'); } } } else { - Runtime.dynCall('iiiiiiiiiii', proc, + dynCall('iiiiiiiiiii', proc, [proc_cls, 0, 0, 0, 0, 0, 0, 0, 0, 0]); } }; @@ -206,7 +206,7 @@ mergeInto(LibraryManager.library, { var request = transaction.objectStore('datastore').get(uid); request.onerror = function(e) { console.warning('get request failed'); - Runtime.dynCall('viii', cont, [cont_cls, -1, 0]); + dynCall('viii', cont, [cont_cls, -1, 0]); }; request.onsuccess = function(e) { var value = e.target.result; @@ -220,10 +220,10 @@ mergeInto(LibraryManager.library, { var request = transaction.objectStore('datastore').put(value); request.onerror = function(e) { console.error('put request failed'); - Runtime.dynCall('viii', cont, [cont_cls, -1, 0]); + dynCall('viii', cont, [cont_cls, -1, 0]); }; request.onsuccess = function(e) { - Runtime.dynCall('viii', cont, [cont_cls, 1, 0]); + dynCall('viii', cont, [cont_cls, 1, 0]); }; }; }, emscripten_plugin_get_zero_anonymity_int: function(offset, type, proc, @@ -234,7 +234,7 @@ mergeInto(LibraryManager.library, { .openCursor([0, type]); request.onerror = function(e) { console.error('cursor request failed'); - Runtime.dynCall('iiiiiiiiiii', proc, + dynCall('iiiiiiiiiii', proc, [proc_cls, 0, 0, 0, 0, 0, 0, 0, 0, 0]); }; request.onsuccess = function(e) { @@ -248,11 +248,11 @@ mergeInto(LibraryManager.library, { return; } // got a result - var stack = Runtime.stackSave(); - var expiry = Runtime.stackAlloc(Runtime.getNativeTypeSize('double')); + var stack = stackSave(); + var expiry = stackAlloc(getNativeTypeSize('double')); setValue(expiry, cursor.value.expiry, 'double'); var ret = ccallFunc( - Runtime.getFuncWrapper(datum_processor_wrapper, + getFuncWrapper(datum_processor_wrapper, 'iiiiiiiiiii'), 'number', ['number', 'number', 'array', 'number', 'array', 'number', 'number', @@ -260,7 +260,7 @@ mergeInto(LibraryManager.library, { [proc, proc_cls, cursor.value.key, cursor.value.data.length, cursor.value.data, cursor.value.type, cursor.value.priority, cursor.value.anonymity, expiry, cursor.value.uid]); - Runtime.stackRestore(stack); + stackRestore(stack); if (!ret) { cursor.delete().onerror = function(e) { console.error('delete request failed'); @@ -276,7 +276,7 @@ mergeInto(LibraryManager.library, { return; } // not found - Runtime.dynCall('iiiiiiiiiii', proc, + dynCall('iiiiiiiiiii', proc, [proc_cls, 0, 0, 0, 0, 0, 0, 0, 0, 0]); } }; @@ -286,7 +286,7 @@ mergeInto(LibraryManager.library, { var request = index.openKeyCursor(null, 'nextunique'); request.onerror = function(e) { console.error('cursor request failed'); - Runtime.dynCall('viii', proc, [proc_cls, 0, 0]); + dynCall('viii', proc, [proc_cls, 0, 0]); }; request.onsuccess = function(e) { var cursor = e.target.result; @@ -296,14 +296,14 @@ mergeInto(LibraryManager.library, { console.error('count request failed'); }; request.onsuccess = function(e) { - ccallFunc(Runtime.getFuncWrapper(proc, 'viii'), + ccallFunc(getFuncWrapper(proc, 'viii'), 'void', ['number', 'array', 'number'], [proc_cls, cursor.key, e.target.result]); }; cursor.continue(); } else { - Runtime.dynCall('viii', proc, [proc_cls, 0, 0]); + dynCall('viii', proc, [proc_cls, 0, 0]); } }; } diff --git a/gnunet-build/packages/gnunet/gnunet/files/plugin_peerstore_emscripten_int.js b/gnunet-build/packages/gnunet/gnunet/files/plugin_peerstore_emscripten_int.js index 1a309b5..f1e576e 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/plugin_peerstore_emscripten_int.js +++ b/gnunet-build/packages/gnunet/gnunet/files/plugin_peerstore_emscripten_int.js @@ -31,13 +31,13 @@ mergeInto(LibraryManager.library, { cursor.continue(); } else { if (cont) { - Runtime.dynCall('vii', cont, [cont_cls, count]); + dynCall('vii', cont, [cont_cls, count]); } } }; request.onerror = function(e) { Module.print('cursor request failed'); - Runtime.dynCall('vii', cont, [cont_cls, -1]); + dynCall('vii', cont, [cont_cls, -1]); }; }, peerstore_emscripten_iterate_records_int: function(sub_system_pointer, @@ -71,26 +71,26 @@ mergeInto(LibraryManager.library, { request.onsuccess = function(e) { var cursor = e.target.result; if (cursor) { - var stack = Runtime.stackSave(); - var expiry = Runtime.stackAlloc(Runtime.getNativeTypeSize("double")); + var stack = stackSave(); + var expiry = stackAlloc(getNativeTypeSize("double")); setValue(expiry, cursor.value.expiry, "double"); ccallFunc( - Runtime.getFuncWrapper(wrapper, "viiiiiiii"), + getFuncWrapper(wrapper, "viiiiiiii"), "void", ["number", "number", "string", "array", "string", "array", "number", "number"], [iter, iter_cls, cursor.value.subsystem, cursor.value.peer, cursor.value.key, cursor.value.value, cursor.value.value.length, expiry]); - Runtime.stackRestore(stack); + stackRestore(stack); cursor.continue(); } else { - Runtime.dynCall('viii', iter, [iter_cls, 0, 0]); + dynCall('viii', iter, [iter_cls, 0, 0]); } }; request.onerror = function(e) { Module.print('cursor request failed'); - Runtime.dynCall('viii', iter, [iter_cls, 0, -1]); + dynCall('viii', iter, [iter_cls, 0, -1]); }; }, peerstore_emscripten_store_record_int: function(sub_system_pointer, @@ -114,10 +114,10 @@ mergeInto(LibraryManager.library, { expiry: expiry}); request.onerror = function(e) { Module.print('put request failed'); - Runtime.dynCall('vii', cont, [cont_cls, -1]); + dynCall('vii', cont, [cont_cls, -1]); }; request.onsuccess = function(e) { - Runtime.dynCall('vii', cont, [cont_cls, 1]); + dynCall('vii', cont, [cont_cls, 1]); }; }; if (options == 1) { @@ -136,7 +136,7 @@ mergeInto(LibraryManager.library, { }; request.onerror = function(e) { Module.print('cursor request failed'); - Runtime.dynCall('vii', cont, [cont_cls, -1]); + dynCall('vii', cont, [cont_cls, -1]); }; } else { put(); diff --git a/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_http_client_emscripten_int.js b/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_http_client_emscripten_int.js index 3821a52..da8c478 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_http_client_emscripten_int.js +++ b/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_http_client_emscripten_int.js @@ -29,13 +29,13 @@ mergeInto(LibraryManager.library, { xhr.onload = function(e) { Module.print('put onload readyState ' + xhr.readyState + ' status ' + xhr.status); if (cont) { - Runtime.dynCall('viiiii', cont, [cont_cls, target, 1, data_size, data_size]); + dynCall('viiiii', cont, [cont_cls, target, 1, data_size, data_size]); } }; xhr.onerror = function(e) { Module.print('put onerror readyState ' + xhr.readyState + ' status ' + xhr.status); if (cont) { - Runtime.dynCall('viiiii', cont, [cont_cls, target, -1, data_size, data_size]); + dynCall('viiiii', cont, [cont_cls, target, -1, data_size, data_size]); } }; }, @@ -57,7 +57,7 @@ mergeInto(LibraryManager.library, { xhr.onload = function(e) { var response = new Uint8Array(e.target.response); Module.print('xhr' + get + ' got ' + response.length + ' bytes'); - ccallFunc(Runtime.getFuncWrapper(client_receive, 'iiiii'), 'number', + ccallFunc(getFuncWrapper(client_receive, 'iiiii'), 'number', ['array', 'number', 'number', 'number'], [response, response.length, 1, s]); xhr.resend(); @@ -66,7 +66,7 @@ mergeInto(LibraryManager.library, { Module.print('xhr' + get + ' status:' + xhr.status + ':' + xhr.statusText); ccallFunc( - Runtime.getFuncWrapper(session_disconnect, 'iii'), + getFuncWrapper(session_disconnect, 'iii'), 'number', ['number', 'number'], [plugin, s]); diff --git a/gnunet-build/packages/gnunet/gnunet/files/pre.js b/gnunet-build/packages/gnunet/gnunet/files/pre.js index e95fb23..2da36af 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/pre.js +++ b/gnunet-build/packages/gnunet/gnunet/files/pre.js @@ -75,7 +75,7 @@ gnunet_prerun = function() { } addRunDependency('window-init'); } -if (typeof(Module) === "undefined") Module = { 'preInit': [] }; +if (typeof(Module['preInit']) === "undefined") Module = { 'preInit': [] }; Module['preInit'].push(gnunet_prerun); Module['arguments'] = ["-L", "DEBUG"]; @@ -150,12 +150,13 @@ function ccallFunc(func, returnType, argTypes, args) { var ret = 0; if (str !== null && str !== undefined && str !== 0) { // null string // at most 4 bytes per UTF-8 code point, +1 for the trailing '\0' - ret = Runtime.stackAlloc((str.length << 2) + 1); - writeStringToMemory(str, ret); + var len = (str.length << 2) + 1; + ret = stackAlloc(len); + stringToUTF8(str, ret, len); } return ret; }, 'array' : function(arr) { - var ret = Runtime.stackAlloc(arr.length); + var ret = stackAlloc(arr.length); writeArrayToMemory(arr, ret); return ret; }}; @@ -165,7 +166,7 @@ function ccallFunc(func, returnType, argTypes, args) { for (var i = 0; i < args.length; i++) { var converter = toC[argTypes[i]]; if (converter) { - if (stack === 0) stack = Runtime.stackSave(); + if (stack === 0) stack = stackSave(); cArgs[i] = converter(args[i]); } else { cArgs[i] = args[i]; @@ -175,7 +176,7 @@ function ccallFunc(func, returnType, argTypes, args) { var ret = func.apply(null, cArgs); if (returnType === 'string') ret = Pointer_stringify(ret); if (stack !== 0) { - Runtime.stackRestore(stack); + stackRestore(stack); } return ret; } diff --git a/src/cljs/gnunet_web/core.cljs b/src/cljs/gnunet_web/core.cljs index d33bc2f..e483c81 100644 --- a/src/cljs/gnunet_web/core.cljs +++ b/src/cljs/gnunet_web/core.cljs @@ -39,7 +39,7 @@ (callback {:peer (vec (read-memory peer-id-pointer 32)) :state state}))) -(def monitor-callback-pointer (+++ (.addFunction js/Runtime monitor-callback))) +(def monitor-callback-pointer (+++ (js/addFunction monitor-callback))) (defn monitor-peers [callback] diff --git a/src/cljs/gnunet_web/filesharing.cljs b/src/cljs/gnunet_web/filesharing.cljs index fb69e8f..5ea1381 100644 --- a/src/cljs/gnunet_web/filesharing.cljs +++ b/src/cljs/gnunet_web/filesharing.cljs @@ -71,7 +71,7 @@ (read-memory data data-size))}))) (def metadata-iterator-pointer - (+++ (.addFunction js/Runtime metadata-iterator))) + (+++ (js/addFunction metadata-iterator))) (defn parse-progress-publish [status info-pointer] @@ -177,7 +177,7 @@ (def fs (js/_GNUNET_FS_start_simple - (+++ (.addFunction js/Runtime progress-callback)))) + (+++ (js/addFunction progress-callback)))) (defn start-search [query anonymity] @@ -237,7 +237,7 @@ 1))) (def publish-reader-callback-pointer - (+++ (.addFunction js/Runtime publish-reader-callback))) + (+++ (js/addFunction publish-reader-callback))) (defn new-block-options [{:keys [expiration anonymity priority replication]}] diff --git a/src/cljs/gnunet_web/transport.cljs b/src/cljs/gnunet_web/transport.cljs index d64765b..a93ec41 100644 --- a/src/cljs/gnunet_web/transport.cljs +++ b/src/cljs/gnunet_web/transport.cljs @@ -67,7 +67,7 @@ (unregister-object cls))) (def get-hello-callback-pointer - (+++ (.addFunction js/Runtime get-hello-callback))) + (+++ (js/addFunction get-hello-callback))) (defn get-my-peer-id [callback] @@ -95,7 +95,7 @@ (gcrypt/utf8ByteArrayToString (to-array (drop 8 address))))))}))) -(def monitor-callback-pointer (+++ (.addFunction js/Runtime monitor-callback))) +(def monitor-callback-pointer (+++ (js/addFunction monitor-callback))) (defn monitor-peers [callback] |