diff -Nru rust-stdweb-internal-runtime-0.1.0/Cargo.toml rust-stdweb-internal-runtime-0.1.3/Cargo.toml --- rust-stdweb-internal-runtime-0.1.0/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 +++ rust-stdweb-internal-runtime-0.1.3/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "stdweb-internal-runtime" -version = "0.1.0" +version = "0.1.3" authors = ["Jan Bujak "] build = "build.rs" description = "Internal runtime for the `stdweb` crate" @@ -23,3 +23,11 @@ categories = ["api-bindings", "gui", "web-programming"] license = "MIT/Apache-2.0" repository = "https://github.com/koute/stdweb" +[package.metadata.docs.rs] +all-features = false +features = ["docs-rs"] +no-default-features = true + +[features] +default = [] +docs-rs = [] diff -Nru rust-stdweb-internal-runtime-0.1.0/Cargo.toml.orig rust-stdweb-internal-runtime-0.1.3/Cargo.toml.orig --- rust-stdweb-internal-runtime-0.1.0/Cargo.toml.orig 2018-08-24 23:19:08.000000000 +0000 +++ rust-stdweb-internal-runtime-0.1.3/Cargo.toml.orig 2018-12-13 18:52:18.000000000 +0000 @@ -1,6 +1,6 @@ [package] name = "stdweb-internal-runtime" -version = "0.1.0" +version = "0.1.3" authors = ["Jan Bujak "] repository = "https://github.com/koute/stdweb" homepage = "https://github.com/koute/stdweb" @@ -12,3 +12,12 @@ description = "Internal runtime for the `stdweb` crate" build = "build.rs" + +[features] +default = [] +"docs-rs" = [] + +[package.metadata.docs.rs] +features = ["docs-rs"] +all-features = false +no-default-features = true diff -Nru rust-stdweb-internal-runtime-0.1.0/.cargo_vcs_info.json rust-stdweb-internal-runtime-0.1.3/.cargo_vcs_info.json --- rust-stdweb-internal-runtime-0.1.0/.cargo_vcs_info.json 1970-01-01 00:00:00.000000000 +0000 +++ rust-stdweb-internal-runtime-0.1.3/.cargo_vcs_info.json 1970-01-01 00:00:00.000000000 +0000 @@ -0,0 +1,5 @@ +{ + "git": { + "sha1": "b8dbb8b8d41069c60f446cc2a2ddb74c87cf5636" + } +} diff -Nru rust-stdweb-internal-runtime-0.1.0/debian/cargo-checksum.json rust-stdweb-internal-runtime-0.1.3/debian/cargo-checksum.json --- rust-stdweb-internal-runtime-0.1.0/debian/cargo-checksum.json 2018-09-18 17:23:12.000000000 +0000 +++ rust-stdweb-internal-runtime-0.1.3/debian/cargo-checksum.json 2019-01-22 09:01:33.000000000 +0000 @@ -1 +1 @@ -{"package":"0e93e3ace205c4c1926b882cf8d8209e86acd445fda5fcf850455c3d178651c7","files":{}} +{"package":"a2a2f4a2eb556337b2d1a302630bbddf989ae383c70393e89b48152b9896cbda","files":{}} diff -Nru rust-stdweb-internal-runtime-0.1.0/debian/changelog rust-stdweb-internal-runtime-0.1.3/debian/changelog --- rust-stdweb-internal-runtime-0.1.0/debian/changelog 2018-09-18 17:23:12.000000000 +0000 +++ rust-stdweb-internal-runtime-0.1.3/debian/changelog 2019-01-22 09:01:33.000000000 +0000 @@ -1,3 +1,9 @@ +rust-stdweb-internal-runtime (0.1.3-1) unstable; urgency=medium + + * Package stdweb-internal-runtime 0.1.3 from crates.io using debcargo 2.2.9 + + -- Wolfgang Silbermayr Tue, 22 Jan 2019 10:01:33 +0100 + rust-stdweb-internal-runtime (0.1.0-1) unstable; urgency=medium * Package stdweb-internal-runtime 0.1.0 from crates.io using debcargo 2.2.7 diff -Nru rust-stdweb-internal-runtime-0.1.0/debian/control rust-stdweb-internal-runtime-0.1.3/debian/control --- rust-stdweb-internal-runtime-0.1.0/debian/control 2018-09-18 17:23:12.000000000 +0000 +++ rust-stdweb-internal-runtime-0.1.3/debian/control 2019-01-22 09:01:33.000000000 +0000 @@ -8,7 +8,8 @@ libstd-rust-dev Maintainer: Debian Rust Maintainers Uploaders: - kpcyrd + kpcyrd , + Wolfgang Silbermayr Standards-Version: 4.2.0 Vcs-Git: https://salsa.debian.org/rust-team/debcargo-conf.git [src/stdweb-internal-runtime] Vcs-Browser: https://salsa.debian.org/rust-team/debcargo-conf/tree/master/src/stdweb-internal-runtime @@ -21,12 +22,16 @@ ${misc:Depends} Provides: librust-stdweb-internal-runtime+default-dev (= ${binary:Version}), + librust-stdweb-internal-runtime+docs-rs-dev (= ${binary:Version}), librust-stdweb-internal-runtime-0-dev (= ${binary:Version}), librust-stdweb-internal-runtime-0+default-dev (= ${binary:Version}), + librust-stdweb-internal-runtime-0+docs-rs-dev (= ${binary:Version}), librust-stdweb-internal-runtime-0.1-dev (= ${binary:Version}), librust-stdweb-internal-runtime-0.1+default-dev (= ${binary:Version}), - librust-stdweb-internal-runtime-0.1.0-dev (= ${binary:Version}), - librust-stdweb-internal-runtime-0.1.0+default-dev (= ${binary:Version}) + librust-stdweb-internal-runtime-0.1+docs-rs-dev (= ${binary:Version}), + librust-stdweb-internal-runtime-0.1.3-dev (= ${binary:Version}), + librust-stdweb-internal-runtime-0.1.3+default-dev (= ${binary:Version}), + librust-stdweb-internal-runtime-0.1.3+docs-rs-dev (= ${binary:Version}) Description: Internal runtime for the `stdweb` crate - Rust source code This package contains the source for the Rust stdweb-internal-runtime crate, packaged by debcargo for use with cargo and dh-cargo. diff -Nru rust-stdweb-internal-runtime-0.1.0/debian/copyright rust-stdweb-internal-runtime-0.1.3/debian/copyright --- rust-stdweb-internal-runtime-0.1.0/debian/copyright 2018-09-18 17:23:12.000000000 +0000 +++ rust-stdweb-internal-runtime-0.1.3/debian/copyright 2019-01-22 09:01:33.000000000 +0000 @@ -4,13 +4,14 @@ Source: https://github.com/koute/stdweb Files: * -Copyright: 2018 Jan Bujak +Copyright: 2018-2019 Jan Bujak License: MIT or Apache-2.0 Files: debian/* Copyright: - 2018 Debian Rust Maintainers + 2018-2019 Debian Rust Maintainers 2018 kpcyrd + 2019 Wolfgang Silbermayr License: MIT or Apache-2.0 License: Apache-2.0 diff -Nru rust-stdweb-internal-runtime-0.1.0/debian/copyright.debcargo.hint rust-stdweb-internal-runtime-0.1.3/debian/copyright.debcargo.hint --- rust-stdweb-internal-runtime-0.1.0/debian/copyright.debcargo.hint 2018-09-18 17:23:12.000000000 +0000 +++ rust-stdweb-internal-runtime-0.1.3/debian/copyright.debcargo.hint 2019-01-22 09:01:33.000000000 +0000 @@ -14,8 +14,9 @@ Files: debian/* Copyright: - 2018 Debian Rust Maintainers - 2018 kpcyrd + 2018-2019 Debian Rust Maintainers + 2018-2019 kpcyrd + 2018-2019 Wolfgang Silbermayr License: MIT or Apache-2.0 License: Apache-2.0 diff -Nru rust-stdweb-internal-runtime-0.1.0/debian/debcargo.toml rust-stdweb-internal-runtime-0.1.3/debian/debcargo.toml --- rust-stdweb-internal-runtime-0.1.0/debian/debcargo.toml 2018-09-18 17:23:12.000000000 +0000 +++ rust-stdweb-internal-runtime-0.1.3/debian/debcargo.toml 2019-01-22 09:01:33.000000000 +0000 @@ -1,2 +1,5 @@ overlay = "." -uploaders = ["kpcyrd "] +uploaders = [ + "kpcyrd ", + "Wolfgang Silbermayr ", +] diff -Nru rust-stdweb-internal-runtime-0.1.0/src/lib.rs rust-stdweb-internal-runtime-0.1.3/src/lib.rs --- rust-stdweb-internal-runtime-0.1.0/src/lib.rs 2018-08-24 23:37:33.000000000 +0000 +++ rust-stdweb-internal-runtime-0.1.3/src/lib.rs 2018-11-19 22:00:17.000000000 +0000 @@ -1 +1,2 @@ +#[cfg(not(feature = "docs-rs"))] include!( concat!( env!( "OUT_DIR" ), env!( "PATH_SEPARATOR" ), "runtime.rs" ) ); diff -Nru rust-stdweb-internal-runtime-0.1.0/src/runtime.js rust-stdweb-internal-runtime-0.1.3/src/runtime.js --- rust-stdweb-internal-runtime-0.1.0/src/runtime.js 2018-07-18 18:56:18.000000000 +0000 +++ rust-stdweb-internal-runtime-0.1.3/src/runtime.js 2018-12-06 17:55:56.000000000 +0000 @@ -85,61 +85,67 @@ return output; } else if( kind === 9 ) { return Module.STDWEB_PRIVATE.acquire_js_reference( HEAP32[ address / 4 ] ); - } else if( kind === 10 ) { + } else if( kind === 10 || kind === 12 || kind === 13 ) { var adapter_pointer = HEAPU32[ address / 4 ]; var pointer = HEAPU32[ (address + 4) / 4 ]; var deallocator_pointer = HEAPU32[ (address + 8) / 4 ]; + var num_ongoing_calls = 0; + var drop_queued = false; var output = function() { - if( pointer === 0 ) { - throw new ReferenceError( "Already dropped Rust function called!" ); + if( pointer === 0 || drop_queued === true ) { + if (kind === 10) { + throw new ReferenceError( "Already dropped Rust function called!" ); + } else if (kind === 12) { + throw new ReferenceError( "Already dropped FnMut function called!" ); + } else { + throw new ReferenceError( "Already called or dropped FnOnce function called!" ); + } } - var args = Module.STDWEB_PRIVATE.alloc( 16 ); - Module.STDWEB_PRIVATE.serialize_array( args, arguments ); - Module.STDWEB_PRIVATE.dyncall( "vii", adapter_pointer, [pointer, args] ); - var result = Module.STDWEB_PRIVATE.tmp; - Module.STDWEB_PRIVATE.tmp = null; - - return result; - }; - - output.drop = function() { - output.drop = Module.STDWEB_PRIVATE.noop; var function_pointer = pointer; - pointer = 0; - - Module.STDWEB_PRIVATE.dyncall( "vi", deallocator_pointer, [function_pointer] ); - }; - - return output; - } else if( kind === 13 ) { - var adapter_pointer = HEAPU32[ address / 4 ]; - var pointer = HEAPU32[ (address + 4) / 4 ]; - var deallocator_pointer = HEAPU32[ (address + 8) / 4 ]; - var output = function() { - if( pointer === 0 ) { - throw new ReferenceError( "Already called or dropped FnOnce function called!" ); + if (kind === 13) { + output.drop = Module.STDWEB_PRIVATE.noop; + pointer = 0; } - output.drop = Module.STDWEB_PRIVATE.noop; - var function_pointer = pointer; - pointer = 0; + if (num_ongoing_calls !== 0) { + if (kind === 12 || kind === 13) { + throw new ReferenceError( "FnMut function called multiple times concurrently!" ); + } + } var args = Module.STDWEB_PRIVATE.alloc( 16 ); Module.STDWEB_PRIVATE.serialize_array( args, arguments ); - Module.STDWEB_PRIVATE.dyncall( "vii", adapter_pointer, [function_pointer, args] ); - var result = Module.STDWEB_PRIVATE.tmp; - Module.STDWEB_PRIVATE.tmp = null; + + try { + num_ongoing_calls += 1; + Module.STDWEB_PRIVATE.dyncall( "vii", adapter_pointer, [function_pointer, args] ); + var result = Module.STDWEB_PRIVATE.tmp; + Module.STDWEB_PRIVATE.tmp = null; + } finally { + num_ongoing_calls -= 1; + } + + if( drop_queued === true && num_ongoing_calls === 0 ) { + output.drop(); + } return result; }; output.drop = function() { + if (num_ongoing_calls !== 0) { + drop_queued = true; + return; + } + output.drop = Module.STDWEB_PRIVATE.noop; var function_pointer = pointer; pointer = 0; - Module.STDWEB_PRIVATE.dyncall( "vi", deallocator_pointer, [function_pointer] ); + if (function_pointer != 0) { + Module.STDWEB_PRIVATE.dyncall( "vi", deallocator_pointer, [function_pointer] ); + } }; return output; @@ -183,13 +189,8 @@ HEAPU32[ (address + 8) / 4 ] = key_array_pointer; for( var i = 0; i < length; ++i ) { var key = keys[ i ]; - var key_length = Module.STDWEB_PRIVATE.utf8_len( key ); - var key_pointer = Module.STDWEB_PRIVATE.alloc( key_length ); - Module.STDWEB_PRIVATE.to_utf8( key, key_pointer ); - var key_address = key_array_pointer + i * 8; - HEAPU32[ key_address / 4 ] = key_pointer; - HEAPU32[ (key_address + 4) / 4 ] = key_length; + Module.STDWEB_PRIVATE.to_utf8_string( key_address, key ); Module.STDWEB_PRIVATE.from_js( value_array_pointer + i * 16, value[ key ] ); } @@ -206,18 +207,50 @@ } }; -Module.STDWEB_PRIVATE.from_js = function from_js( address, value ) { - var kind = Object.prototype.toString.call( value ); - if( kind === "[object String]" ) { +// New browsers and recent Node +var cachedEncoder = ( typeof TextEncoder === "function" + ? new TextEncoder( "utf-8" ) + // Old Node (before v11) + : ( typeof util === "object" && util && typeof util.TextEncoder === "function" + ? new util.TextEncoder( "utf-8" ) + // Old browsers + : null ) ); + +if ( cachedEncoder != null ) { + Module.STDWEB_PRIVATE.to_utf8_string = function to_utf8_string( address, value ) { + var buffer = cachedEncoder.encode( value ); + var length = buffer.length; + var pointer = 0; + + if ( length > 0 ) { + pointer = Module.STDWEB_PRIVATE.alloc( length ); + HEAPU8.set( buffer, pointer ); + } + + HEAPU32[ address / 4 ] = pointer; + HEAPU32[ (address + 4) / 4 ] = length; + }; + +} else { + Module.STDWEB_PRIVATE.to_utf8_string = function to_utf8_string( address, value ) { var length = Module.STDWEB_PRIVATE.utf8_len( value ); var pointer = 0; - if( length > 0 ) { + + if ( length > 0 ) { pointer = Module.STDWEB_PRIVATE.alloc( length ); Module.STDWEB_PRIVATE.to_utf8( value, pointer ); } - HEAPU8[ address + 12 ] = 4; + HEAPU32[ address / 4 ] = pointer; HEAPU32[ (address + 4) / 4 ] = length; + }; +} + +Module.STDWEB_PRIVATE.from_js = function from_js( address, value ) { + var kind = Object.prototype.toString.call( value ); + if( kind === "[object String]" ) { + HEAPU8[ address + 12 ] = 4; + Module.STDWEB_PRIVATE.to_utf8_string( address, value ); } else if( kind === "[object Number]" ) { if( value === (value|0) ) { HEAPU8[ address + 12 ] = 2; @@ -245,48 +278,64 @@ } }; -// This is ported from Rust's stdlib; it's faster than -// the string conversion from Emscripten. -Module.STDWEB_PRIVATE.to_js_string = function to_js_string( index, length ) { - index = index|0; - length = length|0; - var end = (index|0) + (length|0); - var output = ""; - while( index < end ) { - var x = HEAPU8[ index++ ]; - if( x < 128 ) { - output += String.fromCharCode( x ); - continue; - } - var init = (x & (0x7F >> 2)); - var y = 0; - if( index < end ) { - y = HEAPU8[ index++ ]; - } - var ch = (init << 6) | (y & 63); - if( x >= 0xE0 ) { - var z = 0; +// New browsers and recent Node +var cachedDecoder = ( typeof TextDecoder === "function" + ? new TextDecoder( "utf-8" ) + // Old Node (before v11) + : ( typeof util === "object" && util && typeof util.TextDecoder === "function" + ? new util.TextDecoder( "utf-8" ) + // Old browsers + : null ) ); + +if ( cachedDecoder != null ) { + Module.STDWEB_PRIVATE.to_js_string = function to_js_string( index, length ) { + return cachedDecoder.decode( HEAPU8.subarray( index, index + length ) ); + }; + +} else { + // This is ported from Rust's stdlib; it's faster than + // the string conversion from Emscripten. + Module.STDWEB_PRIVATE.to_js_string = function to_js_string( index, length ) { + index = index|0; + length = length|0; + var end = (index|0) + (length|0); + var output = ""; + while( index < end ) { + var x = HEAPU8[ index++ ]; + if( x < 128 ) { + output += String.fromCharCode( x ); + continue; + } + var init = (x & (0x7F >> 2)); + var y = 0; if( index < end ) { - z = HEAPU8[ index++ ]; + y = HEAPU8[ index++ ]; } - var y_z = ((y & 63) << 6) | (z & 63); - ch = init << 12 | y_z; - if( x >= 0xF0 ) { - var w = 0; + var ch = (init << 6) | (y & 63); + if( x >= 0xE0 ) { + var z = 0; if( index < end ) { - w = HEAPU8[ index++ ]; + z = HEAPU8[ index++ ]; } - ch = (init & 7) << 18 | ((y_z << 6) | (w & 63)); + var y_z = ((y & 63) << 6) | (z & 63); + ch = init << 12 | y_z; + if( x >= 0xF0 ) { + var w = 0; + if( index < end ) { + w = HEAPU8[ index++ ]; + } + ch = (init & 7) << 18 | ((y_z << 6) | (w & 63)); - output += String.fromCharCode( 0xD7C0 + (ch >> 10) ); - ch = 0xDC00 + (ch & 0x3FF); + output += String.fromCharCode( 0xD7C0 + (ch >> 10) ); + ch = 0xDC00 + (ch & 0x3FF); + } } + output += String.fromCharCode( ch ); + continue; } - output += String.fromCharCode( ch ); - continue; - } - return output; -}; + return output; + }; +} Module.STDWEB_PRIVATE.id_to_ref_map = {}; Module.STDWEB_PRIVATE.id_to_refcount_map = {};