1 line
16 KiB
JavaScript
1 line
16 KiB
JavaScript
|
export function __cargo_web_snippet_1c30acb32a1994a07c75e804ae9855b43f191d63(Module) { Module.STDWEB_PRIVATE = {}; Module.STDWEB_PRIVATE.to_utf8 = function to_utf8( str, addr ) { var HEAPU8 = Module.HEAPU8; for( var i = 0; i < str.length; ++i ) { var u = str.charCodeAt( i ); if( u >= 0xD800 && u <= 0xDFFF ) { u = 0x10000 + ((u & 0x3FF) << 10) | (str.charCodeAt( ++i ) & 0x3FF); } if( u <= 0x7F ) { HEAPU8[ addr++ ] = u; } else if( u <= 0x7FF ) { HEAPU8[ addr++ ] = 0xC0 | (u >> 6); HEAPU8[ addr++ ] = 0x80 | (u & 63); } else if( u <= 0xFFFF ) { HEAPU8[ addr++ ] = 0xE0 | (u >> 12); HEAPU8[ addr++ ] = 0x80 | ((u >> 6) & 63); HEAPU8[ addr++ ] = 0x80 | (u & 63); } else if( u <= 0x1FFFFF ) { HEAPU8[ addr++ ] = 0xF0 | (u >> 18); HEAPU8[ addr++ ] = 0x80 | ((u >> 12) & 63); HEAPU8[ addr++ ] = 0x80 | ((u >> 6) & 63); HEAPU8[ addr++ ] = 0x80 | (u & 63); } else if( u <= 0x3FFFFFF ) { HEAPU8[ addr++ ] = 0xF8 | (u >> 24); HEAPU8[ addr++ ] = 0x80 | ((u >> 18) & 63); HEAPU8[ addr++ ] = 0x80 | ((u >> 12) & 63); HEAPU8[ addr++ ] = 0x80 | ((u >> 6) & 63); HEAPU8[ addr++ ] = 0x80 | (u & 63); } else { HEAPU8[ addr++ ] = 0xFC | (u >> 30); HEAPU8[ addr++ ] = 0x80 | ((u >> 24) & 63); HEAPU8[ addr++ ] = 0x80 | ((u >> 18) & 63); HEAPU8[ addr++ ] = 0x80 | ((u >> 12) & 63); HEAPU8[ addr++ ] = 0x80 | ((u >> 6) & 63); HEAPU8[ addr++ ] = 0x80 | (u & 63); } } }; Module.STDWEB_PRIVATE.noop = function() {}; Module.STDWEB_PRIVATE.to_js = function to_js( address ) { var kind = Module.HEAPU8[ address + 12 ]; if( kind === 0 ) { return undefined; } else if( kind === 1 ) { return null; } else if( kind === 2 ) { return Module.HEAP32[ address / 4 ]; } else if( kind === 3 ) { return Module.HEAPF64[ address / 8 ]; } else if( kind === 4 ) { var pointer = Module.HEAPU32[ address / 4 ]; var length = Module.HEAPU32[ (address + 4) / 4 ]; return Module.STDWEB_PRIVATE.to_js_string( pointer, length ); } else if( kind === 5 ) { return false; } else if( kind === 6 ) { return true; } else if( kind === 7 ) { var pointer = Module.STDWEB_PRIVATE.arena + Module.HEAPU32[ address / 4 ]; var length = Module.HEAPU32[ (address + 4) / 4 ]; var output = []; for( var i = 0; i < length; ++i ) { output.push( Module.STDWEB_PRIVATE.to_js( pointer + i * 16 ) ); } return output; } else if( kind === 8 ) { var arena = Module.STDWEB_PRIVATE.arena; var value_array_pointer = arena + Module.HEAPU32[ address / 4 ]; var length = Module.HEAPU32[ (address + 4) / 4 ]; var key_array_pointer = arena + Module.HEAPU32[ (address + 8) / 4 ]; var output = {}; for( var i = 0; i < length; ++i ) { var key_pointer = Module.HEAPU32[ (key_array_pointer + i * 8) / 4 ]; var key_length = Module.HEAPU32[ (key_array_pointer + 4 + i * 8) / 4 ]; var key = Module.STDWEB_PRIVATE.to_js_string( key_pointer, key_length ); var value = Module.STDWEB_PRIVATE.to_js( value_array_pointer + i * 16 ); output[ key ] = value; } return output; } else if( kind === 9 ) { return Module.STDWEB_PRIVATE.acquire_js_reference( Module.HEAP32[ address / 4 ] ); } else if( kind === 10 || kind === 12 || kind === 13 ) { var adapter_pointer = Module.HEAPU32[ address / 4 ]; var pointer = Module.HEAPU32[ (address + 4) / 4 ]; var deallocator_pointer = Module.HEAPU32[ (address + 8) / 4 ]; var num_ongoing_calls = 0; var drop_queued = false; var output = function() { if( pointer === 0 || drop_queued === true ) {
|