How to use ret method in fast-check-monorepo

Best JavaScript code snippet using fast-check-monorepo

eframe_template.js

Source:eframe_template.js Github

copy

Full Screen

1let wasm_bindgen;2(function() {3 const __exports = {};4 let wasm;5 const heap = new Array(32).fill(undefined);6 heap.push(undefined, null, true, false);7function getObject(idx) { return heap[idx]; }8let heap_next = heap.length;9function dropObject(idx) {10 if (idx < 36) return;11 heap[idx] = heap_next;12 heap_next = idx;13}14function takeObject(idx) {15 const ret = getObject(idx);16 dropObject(idx);17 return ret;18}19function isLikeNone(x) {20 return x === undefined || x === null;21}22let cachegetFloat64Memory0 = null;23function getFloat64Memory0() {24 if (cachegetFloat64Memory0 === null || cachegetFloat64Memory0.buffer !== wasm.memory.buffer) {25 cachegetFloat64Memory0 = new Float64Array(wasm.memory.buffer);26 }27 return cachegetFloat64Memory0;28}29let cachegetInt32Memory0 = null;30function getInt32Memory0() {31 if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {32 cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);33 }34 return cachegetInt32Memory0;35}36let WASM_VECTOR_LEN = 0;37let cachegetUint8Memory0 = null;38function getUint8Memory0() {39 if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {40 cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);41 }42 return cachegetUint8Memory0;43}44const cachedTextEncoder = new TextEncoder('utf-8');45const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'46 ? function (arg, view) {47 return cachedTextEncoder.encodeInto(arg, view);48}49 : function (arg, view) {50 const buf = cachedTextEncoder.encode(arg);51 view.set(buf);52 return {53 read: arg.length,54 written: buf.length55 };56});57function passStringToWasm0(arg, malloc, realloc) {58 if (realloc === undefined) {59 const buf = cachedTextEncoder.encode(arg);60 const ptr = malloc(buf.length);61 getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);62 WASM_VECTOR_LEN = buf.length;63 return ptr;64 }65 let len = arg.length;66 let ptr = malloc(len);67 const mem = getUint8Memory0();68 let offset = 0;69 for (; offset < len; offset++) {70 const code = arg.charCodeAt(offset);71 if (code > 0x7F) break;72 mem[ptr + offset] = code;73 }74 if (offset !== len) {75 if (offset !== 0) {76 arg = arg.slice(offset);77 }78 ptr = realloc(ptr, len, len = offset + arg.length * 3);79 const view = getUint8Memory0().subarray(ptr + offset, ptr + len);80 const ret = encodeString(arg, view);81 offset += ret.written;82 }83 WASM_VECTOR_LEN = offset;84 return ptr;85}86const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });87cachedTextDecoder.decode();88function getStringFromWasm0(ptr, len) {89 return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));90}91function addHeapObject(obj) {92 if (heap_next === heap.length) heap.push(heap.length + 1);93 const idx = heap_next;94 heap_next = heap[idx];95 heap[idx] = obj;96 return idx;97}98function debugString(val) {99 // primitive types100 const type = typeof val;101 if (type == 'number' || type == 'boolean' || val == null) {102 return `${val}`;103 }104 if (type == 'string') {105 return `"${val}"`;106 }107 if (type == 'symbol') {108 const description = val.description;109 if (description == null) {110 return 'Symbol';111 } else {112 return `Symbol(${description})`;113 }114 }115 if (type == 'function') {116 const name = val.name;117 if (typeof name == 'string' && name.length > 0) {118 return `Function(${name})`;119 } else {120 return 'Function';121 }122 }123 // objects124 if (Array.isArray(val)) {125 const length = val.length;126 let debug = '[';127 if (length > 0) {128 debug += debugString(val[0]);129 }130 for(let i = 1; i < length; i++) {131 debug += ', ' + debugString(val[i]);132 }133 debug += ']';134 return debug;135 }136 // Test for built-in137 const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));138 let className;139 if (builtInMatches.length > 1) {140 className = builtInMatches[1];141 } else {142 // Failed to match the standard '[object ClassName]'143 return toString.call(val);144 }145 if (className == 'Object') {146 // we're a user defined class or Object147 // JSON.stringify avoids problems with cycles, and is generally much148 // easier than looping through ownProperties of `val`.149 try {150 return 'Object(' + JSON.stringify(val) + ')';151 } catch (_) {152 return 'Object';153 }154 }155 // errors156 if (val instanceof Error) {157 return `${val.name}: ${val.message}\n${val.stack}`;158 }159 // TODO we could test for more things here, like `Set`s and `Map`s.160 return className;161}162function makeMutClosure(arg0, arg1, dtor, f) {163 const state = { a: arg0, b: arg1, cnt: 1, dtor };164 const real = (...args) => {165 // First up with a closure we increment the internal reference166 // count. This ensures that the Rust closure environment won't167 // be deallocated while we're invoking it.168 state.cnt++;169 const a = state.a;170 state.a = 0;171 try {172 return f(a, state.b, ...args);173 } finally {174 if (--state.cnt === 0) {175 wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);176 } else {177 state.a = a;178 }179 }180 };181 real.original = state;182 return real;183}184function __wbg_adapter_24(arg0, arg1, arg2) {185 wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h9760a9c9e2626dab(arg0, arg1, addHeapObject(arg2));186}187function __wbg_adapter_27(arg0, arg1) {188 wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4a1da0920468fcb4(arg0, arg1);189}190function __wbg_adapter_30(arg0, arg1, arg2) {191 wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h9760a9c9e2626dab(arg0, arg1, addHeapObject(arg2));192}193function __wbg_adapter_33(arg0, arg1) {194 try {195 const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);196 wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hd62005321deefe7f(retptr, arg0, arg1);197 var r0 = getInt32Memory0()[retptr / 4 + 0];198 var r1 = getInt32Memory0()[retptr / 4 + 1];199 if (r1) {200 throw takeObject(r0);201 }202 } finally {203 wasm.__wbindgen_add_to_stack_pointer(16);204 }205}206function __wbg_adapter_36(arg0, arg1, arg2) {207 wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha2f39f81315ed630(arg0, arg1, addHeapObject(arg2));208}209/**210* This is the entry-point for all the web-assembly.211* This is called once from the HTML.212* It loads the app, installs some callbacks, then returns.213* You can add more callbacks like this if you want to call in to your code.214* @param {string} canvas_id215*/216__exports.start = function(canvas_id) {217 try {218 const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);219 const ptr0 = passStringToWasm0(canvas_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);220 const len0 = WASM_VECTOR_LEN;221 wasm.start(retptr, ptr0, len0);222 var r0 = getInt32Memory0()[retptr / 4 + 0];223 var r1 = getInt32Memory0()[retptr / 4 + 1];224 if (r1) {225 throw takeObject(r0);226 }227 } finally {228 wasm.__wbindgen_add_to_stack_pointer(16);229 }230};231function handleError(f, args) {232 try {233 return f.apply(this, args);234 } catch (e) {235 wasm.__wbindgen_exn_store(addHeapObject(e));236 }237}238async function load(module, imports) {239 if (typeof Response === 'function' && module instanceof Response) {240 if (typeof WebAssembly.instantiateStreaming === 'function') {241 try {242 return await WebAssembly.instantiateStreaming(module, imports);243 } catch (e) {244 if (module.headers.get('Content-Type') != 'application/wasm') {245 console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);246 } else {247 throw e;248 }249 }250 }251 const bytes = await module.arrayBuffer();252 return await WebAssembly.instantiate(bytes, imports);253 } else {254 const instance = await WebAssembly.instantiate(module, imports);255 if (instance instanceof WebAssembly.Instance) {256 return { instance, module };257 } else {258 return instance;259 }260 }261}262async function init(input) {263 if (typeof input === 'undefined') {264 let src;265 if (typeof document === 'undefined') {266 src = location.href;267 } else {268 src = document.currentScript.src;269 }270 input = src.replace(/\.js$/, '_bg.wasm');271 }272 const imports = {};273 imports.wbg = {};274 imports.wbg.__wbg_log_02e20a3c32305fb7 = function(arg0, arg1) {275 try {276 console.log(getStringFromWasm0(arg0, arg1));277 } finally {278 wasm.__wbindgen_free(arg0, arg1);279 }280 };281 imports.wbg.__wbg_log_5c7513aa8c164502 = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {282 try {283 console.log(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5), getStringFromWasm0(arg6, arg7));284 } finally {285 wasm.__wbindgen_free(arg0, arg1);286 }287 };288 imports.wbg.__wbg_mark_abc7631bdced64f0 = function(arg0, arg1) {289 performance.mark(getStringFromWasm0(arg0, arg1));290 };291 imports.wbg.__wbindgen_object_drop_ref = function(arg0) {292 takeObject(arg0);293 };294 imports.wbg.__wbg_measure_c528ff64085b7146 = function() { return handleError(function (arg0, arg1, arg2, arg3) {295 try {296 performance.measure(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));297 } finally {298 wasm.__wbindgen_free(arg0, arg1);299 wasm.__wbindgen_free(arg2, arg3);300 }301 }, arguments) };302 imports.wbg.__wbg_new_693216e109162396 = function() {303 const ret = new Error();304 return addHeapObject(ret);305 };306 imports.wbg.__wbg_stack_0ddaca5d1abfb52f = function(arg0, arg1) {307 const ret = getObject(arg1).stack;308 const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);309 const len0 = WASM_VECTOR_LEN;310 getInt32Memory0()[arg0 / 4 + 1] = len0;311 getInt32Memory0()[arg0 / 4 + 0] = ptr0;312 };313 imports.wbg.__wbg_error_09919627ac0992f5 = function(arg0, arg1) {314 try {315 console.error(getStringFromWasm0(arg0, arg1));316 } finally {317 wasm.__wbindgen_free(arg0, arg1);318 }319 };320 imports.wbg.__wbindgen_number_get = function(arg0, arg1) {321 const obj = getObject(arg1);322 const ret = typeof(obj) === 'number' ? obj : undefined;323 getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;324 getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);325 };326 imports.wbg.__wbindgen_string_get = function(arg0, arg1) {327 const obj = getObject(arg1);328 const ret = typeof(obj) === 'string' ? obj : undefined;329 var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);330 var len0 = WASM_VECTOR_LEN;331 getInt32Memory0()[arg0 / 4 + 1] = len0;332 getInt32Memory0()[arg0 / 4 + 0] = ptr0;333 };334 imports.wbg.__wbindgen_cb_drop = function(arg0) {335 const obj = takeObject(arg0).original;336 if (obj.cnt-- == 1) {337 obj.a = 0;338 return true;339 }340 const ret = false;341 return ret;342 };343 imports.wbg.__wbindgen_string_new = function(arg0, arg1) {344 const ret = getStringFromWasm0(arg0, arg1);345 return addHeapObject(ret);346 };347 imports.wbg.__wbindgen_boolean_get = function(arg0) {348 const v = getObject(arg0);349 const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;350 return ret;351 };352 imports.wbg.__wbg_instanceof_WebGl2RenderingContext_e29e70ae6c00bfdd = function(arg0) {353 const ret = getObject(arg0) instanceof WebGL2RenderingContext;354 return ret;355 };356 imports.wbg.__wbg_bindVertexArray_dfe63bf55a9f6e54 = function(arg0, arg1) {357 getObject(arg0).bindVertexArray(getObject(arg1));358 };359 imports.wbg.__wbg_bufferData_8542921547008e80 = function(arg0, arg1, arg2, arg3) {360 getObject(arg0).bufferData(arg1 >>> 0, getObject(arg2), arg3 >>> 0);361 };362 imports.wbg.__wbg_createVertexArray_d502151c473563b2 = function(arg0) {363 const ret = getObject(arg0).createVertexArray();364 return isLikeNone(ret) ? 0 : addHeapObject(ret);365 };366 imports.wbg.__wbg_texImage2D_830d94fcfc70baf0 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {367 getObject(arg0).texImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, getObject(arg9));368 }, arguments) };369 imports.wbg.__wbg_texSubImage2D_f5b8e6e635a5736f = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {370 getObject(arg0).texSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, getObject(arg9));371 }, arguments) };372 imports.wbg.__wbg_texSubImage2D_b26e671fcb768c49 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {373 getObject(arg0).texSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9);374 }, arguments) };375 imports.wbg.__wbg_activeTexture_eec8b0e6c72c6814 = function(arg0, arg1) {376 getObject(arg0).activeTexture(arg1 >>> 0);377 };378 imports.wbg.__wbg_attachShader_0994bf956cb31b2b = function(arg0, arg1, arg2) {379 getObject(arg0).attachShader(getObject(arg1), getObject(arg2));380 };381 imports.wbg.__wbg_bindBuffer_a5f37e5ebd81a1f6 = function(arg0, arg1, arg2) {382 getObject(arg0).bindBuffer(arg1 >>> 0, getObject(arg2));383 };384 imports.wbg.__wbg_bindFramebuffer_6ef149f7d398d19f = function(arg0, arg1, arg2) {385 getObject(arg0).bindFramebuffer(arg1 >>> 0, getObject(arg2));386 };387 imports.wbg.__wbg_bindRenderbuffer_1974e9f4fdd0b3af = function(arg0, arg1, arg2) {388 getObject(arg0).bindRenderbuffer(arg1 >>> 0, getObject(arg2));389 };390 imports.wbg.__wbg_bindTexture_dbddb0b0c3efa1b9 = function(arg0, arg1, arg2) {391 getObject(arg0).bindTexture(arg1 >>> 0, getObject(arg2));392 };393 imports.wbg.__wbg_blendEquationSeparate_ccdda0657b246bb0 = function(arg0, arg1, arg2) {394 getObject(arg0).blendEquationSeparate(arg1 >>> 0, arg2 >>> 0);395 };396 imports.wbg.__wbg_blendFuncSeparate_0aa8a7b4669fb810 = function(arg0, arg1, arg2, arg3, arg4) {397 getObject(arg0).blendFuncSeparate(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4 >>> 0);398 };399 imports.wbg.__wbg_clear_a9fbec6b33c4e095 = function(arg0, arg1) {400 getObject(arg0).clear(arg1 >>> 0);401 };402 imports.wbg.__wbg_clearColor_3973a216e3a63c8f = function(arg0, arg1, arg2, arg3, arg4) {403 getObject(arg0).clearColor(arg1, arg2, arg3, arg4);404 };405 imports.wbg.__wbg_colorMask_c92354ec3511685f = function(arg0, arg1, arg2, arg3, arg4) {406 getObject(arg0).colorMask(arg1 !== 0, arg2 !== 0, arg3 !== 0, arg4 !== 0);407 };408 imports.wbg.__wbg_compileShader_4940032085b41ed2 = function(arg0, arg1) {409 getObject(arg0).compileShader(getObject(arg1));410 };411 imports.wbg.__wbg_createBuffer_b6dbd62c544371ed = function(arg0) {412 const ret = getObject(arg0).createBuffer();413 return isLikeNone(ret) ? 0 : addHeapObject(ret);414 };415 imports.wbg.__wbg_createFramebuffer_f656a97f24d2caf3 = function(arg0) {416 const ret = getObject(arg0).createFramebuffer();417 return isLikeNone(ret) ? 0 : addHeapObject(ret);418 };419 imports.wbg.__wbg_createProgram_6a25e4bb5cfaad4b = function(arg0) {420 const ret = getObject(arg0).createProgram();421 return isLikeNone(ret) ? 0 : addHeapObject(ret);422 };423 imports.wbg.__wbg_createRenderbuffer_e66ea157342e02e9 = function(arg0) {424 const ret = getObject(arg0).createRenderbuffer();425 return isLikeNone(ret) ? 0 : addHeapObject(ret);426 };427 imports.wbg.__wbg_createShader_c17c7cf4768e0737 = function(arg0, arg1) {428 const ret = getObject(arg0).createShader(arg1 >>> 0);429 return isLikeNone(ret) ? 0 : addHeapObject(ret);430 };431 imports.wbg.__wbg_createTexture_0df375980a9c46c9 = function(arg0) {432 const ret = getObject(arg0).createTexture();433 return isLikeNone(ret) ? 0 : addHeapObject(ret);434 };435 imports.wbg.__wbg_deleteShader_b6480fae6d31ca67 = function(arg0, arg1) {436 getObject(arg0).deleteShader(getObject(arg1));437 };438 imports.wbg.__wbg_deleteTexture_8c7434cb1b20f64f = function(arg0, arg1) {439 getObject(arg0).deleteTexture(getObject(arg1));440 };441 imports.wbg.__wbg_detachShader_a3e090b94d09c8a2 = function(arg0, arg1, arg2) {442 getObject(arg0).detachShader(getObject(arg1), getObject(arg2));443 };444 imports.wbg.__wbg_disable_ec8402e41edbe277 = function(arg0, arg1) {445 getObject(arg0).disable(arg1 >>> 0);446 };447 imports.wbg.__wbg_disableVertexAttribArray_8da45bfa7fa5a02d = function(arg0, arg1) {448 getObject(arg0).disableVertexAttribArray(arg1 >>> 0);449 };450 imports.wbg.__wbg_drawElements_a192faf49b4975d6 = function(arg0, arg1, arg2, arg3, arg4) {451 getObject(arg0).drawElements(arg1 >>> 0, arg2, arg3 >>> 0, arg4);452 };453 imports.wbg.__wbg_enable_51cc5ea7d16e475c = function(arg0, arg1) {454 getObject(arg0).enable(arg1 >>> 0);455 };456 imports.wbg.__wbg_enableVertexAttribArray_85c507778523db86 = function(arg0, arg1) {457 getObject(arg0).enableVertexAttribArray(arg1 >>> 0);458 };459 imports.wbg.__wbg_framebufferRenderbuffer_d73f3cb3e5a605a2 = function(arg0, arg1, arg2, arg3, arg4) {460 getObject(arg0).framebufferRenderbuffer(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, getObject(arg4));461 };462 imports.wbg.__wbg_framebufferTexture2D_e07b69d4972eccfd = function(arg0, arg1, arg2, arg3, arg4, arg5) {463 getObject(arg0).framebufferTexture2D(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, getObject(arg4), arg5);464 };465 imports.wbg.__wbg_getAttribLocation_ae4109e1d8e7050f = function(arg0, arg1, arg2, arg3) {466 const ret = getObject(arg0).getAttribLocation(getObject(arg1), getStringFromWasm0(arg2, arg3));467 return ret;468 };469 imports.wbg.__wbg_getError_cc18cbef4864f62f = function(arg0) {470 const ret = getObject(arg0).getError();471 return ret;472 };473 imports.wbg.__wbg_getExtension_22c72750813222f6 = function() { return handleError(function (arg0, arg1, arg2) {474 const ret = getObject(arg0).getExtension(getStringFromWasm0(arg1, arg2));475 return isLikeNone(ret) ? 0 : addHeapObject(ret);476 }, arguments) };477 imports.wbg.__wbg_getParameter_00a3d89e6e005c2f = function() { return handleError(function (arg0, arg1) {478 const ret = getObject(arg0).getParameter(arg1 >>> 0);479 return addHeapObject(ret);480 }, arguments) };481 imports.wbg.__wbg_getProgramInfoLog_234b1b9dbbc9282f = function(arg0, arg1, arg2) {482 const ret = getObject(arg1).getProgramInfoLog(getObject(arg2));483 var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);484 var len0 = WASM_VECTOR_LEN;485 getInt32Memory0()[arg0 / 4 + 1] = len0;486 getInt32Memory0()[arg0 / 4 + 0] = ptr0;487 };488 imports.wbg.__wbg_getProgramParameter_4100b1077a68e2ec = function(arg0, arg1, arg2) {489 const ret = getObject(arg0).getProgramParameter(getObject(arg1), arg2 >>> 0);490 return addHeapObject(ret);491 };492 imports.wbg.__wbg_getShaderInfoLog_a680dbc6e8440e5b = function(arg0, arg1, arg2) {493 const ret = getObject(arg1).getShaderInfoLog(getObject(arg2));494 var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);495 var len0 = WASM_VECTOR_LEN;496 getInt32Memory0()[arg0 / 4 + 1] = len0;497 getInt32Memory0()[arg0 / 4 + 0] = ptr0;498 };499 imports.wbg.__wbg_getShaderParameter_87e97ffc5dc7fb05 = function(arg0, arg1, arg2) {500 const ret = getObject(arg0).getShaderParameter(getObject(arg1), arg2 >>> 0);501 return addHeapObject(ret);502 };503 imports.wbg.__wbg_getSupportedExtensions_f7eec3b83ce8c78d = function(arg0) {504 const ret = getObject(arg0).getSupportedExtensions();505 return isLikeNone(ret) ? 0 : addHeapObject(ret);506 };507 imports.wbg.__wbg_getUniformLocation_201fd94276e7dc6f = function(arg0, arg1, arg2, arg3) {508 const ret = getObject(arg0).getUniformLocation(getObject(arg1), getStringFromWasm0(arg2, arg3));509 return isLikeNone(ret) ? 0 : addHeapObject(ret);510 };511 imports.wbg.__wbg_linkProgram_edd275997033948d = function(arg0, arg1) {512 getObject(arg0).linkProgram(getObject(arg1));513 };514 imports.wbg.__wbg_pixelStorei_db7d39661916037c = function(arg0, arg1, arg2) {515 getObject(arg0).pixelStorei(arg1 >>> 0, arg2);516 };517 imports.wbg.__wbg_renderbufferStorage_6ded6b343c662a60 = function(arg0, arg1, arg2, arg3, arg4) {518 getObject(arg0).renderbufferStorage(arg1 >>> 0, arg2 >>> 0, arg3, arg4);519 };520 imports.wbg.__wbg_scissor_3ea2048f24928f06 = function(arg0, arg1, arg2, arg3, arg4) {521 getObject(arg0).scissor(arg1, arg2, arg3, arg4);522 };523 imports.wbg.__wbg_shaderSource_bbfeb057b5f88df5 = function(arg0, arg1, arg2, arg3) {524 getObject(arg0).shaderSource(getObject(arg1), getStringFromWasm0(arg2, arg3));525 };526 imports.wbg.__wbg_texParameteri_7414cf15f83e1d52 = function(arg0, arg1, arg2, arg3) {527 getObject(arg0).texParameteri(arg1 >>> 0, arg2 >>> 0, arg3);528 };529 imports.wbg.__wbg_uniform1i_22f9e77ed65e1503 = function(arg0, arg1, arg2) {530 getObject(arg0).uniform1i(getObject(arg1), arg2);531 };532 imports.wbg.__wbg_uniform2f_fa5841b64e0ac5e9 = function(arg0, arg1, arg2, arg3) {533 getObject(arg0).uniform2f(getObject(arg1), arg2, arg3);534 };535 imports.wbg.__wbg_useProgram_039f85866d3a975b = function(arg0, arg1) {536 getObject(arg0).useProgram(getObject(arg1));537 };538 imports.wbg.__wbg_vertexAttribPointer_4375ff065dcf90ed = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {539 getObject(arg0).vertexAttribPointer(arg1 >>> 0, arg2, arg3 >>> 0, arg4 !== 0, arg5, arg6);540 };541 imports.wbg.__wbg_viewport_06c29be651af660a = function(arg0, arg1, arg2, arg3, arg4) {542 getObject(arg0).viewport(arg1, arg2, arg3, arg4);543 };544 imports.wbg.__wbg_instanceof_Window_0e6c0f1096d66c3c = function(arg0) {545 const ret = getObject(arg0) instanceof Window;546 return ret;547 };548 imports.wbg.__wbg_document_99eddbbc11ec831e = function(arg0) {549 const ret = getObject(arg0).document;550 return isLikeNone(ret) ? 0 : addHeapObject(ret);551 };552 imports.wbg.__wbg_location_fa9019d2eb2195e8 = function(arg0) {553 const ret = getObject(arg0).location;554 return addHeapObject(ret);555 };556 imports.wbg.__wbg_navigator_1f72d7edb7b4c387 = function(arg0) {557 const ret = getObject(arg0).navigator;558 return addHeapObject(ret);559 };560 imports.wbg.__wbg_innerWidth_aebdd1c86de7b6aa = function() { return handleError(function (arg0) {561 const ret = getObject(arg0).innerWidth;562 return addHeapObject(ret);563 }, arguments) };564 imports.wbg.__wbg_innerHeight_67ea5ab43c3043ad = function() { return handleError(function (arg0) {565 const ret = getObject(arg0).innerHeight;566 return addHeapObject(ret);567 }, arguments) };568 imports.wbg.__wbg_devicePixelRatio_cac0b66c0e1e056b = function(arg0) {569 const ret = getObject(arg0).devicePixelRatio;570 return ret;571 };572 imports.wbg.__wbg_performance_71eb0d14ca622227 = function(arg0) {573 const ret = getObject(arg0).performance;574 return isLikeNone(ret) ? 0 : addHeapObject(ret);575 };576 imports.wbg.__wbg_localStorage_6e9ba4e9a3771427 = function() { return handleError(function (arg0) {577 const ret = getObject(arg0).localStorage;578 return isLikeNone(ret) ? 0 : addHeapObject(ret);579 }, arguments) };580 imports.wbg.__wbg_matchMedia_7a04497c9cd2fc1e = function() { return handleError(function (arg0, arg1, arg2) {581 const ret = getObject(arg0).matchMedia(getStringFromWasm0(arg1, arg2));582 return isLikeNone(ret) ? 0 : addHeapObject(ret);583 }, arguments) };584 imports.wbg.__wbg_open_fd57bd436de42549 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {585 const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));586 return isLikeNone(ret) ? 0 : addHeapObject(ret);587 }, arguments) };588 imports.wbg.__wbg_requestAnimationFrame_8e3c7028c69ebaef = function() { return handleError(function (arg0, arg1) {589 const ret = getObject(arg0).requestAnimationFrame(getObject(arg1));590 return ret;591 }, arguments) };592 imports.wbg.__wbg_setInterval_00dcd6d9b783b38f = function() { return handleError(function (arg0, arg1, arg2) {593 const ret = getObject(arg0).setInterval(getObject(arg1), arg2);594 return ret;595 }, arguments) };596 imports.wbg.__wbg_setTimeout_a100c5fd6f7b2032 = function() { return handleError(function (arg0, arg1, arg2) {597 const ret = getObject(arg0).setTimeout(getObject(arg1), arg2);598 return ret;599 }, arguments) };600 imports.wbg.__wbg_writeText_df83b2c8a773a84a = function(arg0, arg1, arg2) {601 const ret = getObject(arg0).writeText(getStringFromWasm0(arg1, arg2));602 return addHeapObject(ret);603 };604 imports.wbg.__wbg_addEventListener_78d3aa7e06ee5b73 = function() { return handleError(function (arg0, arg1, arg2, arg3) {605 getObject(arg0).addEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3));606 }, arguments) };607 imports.wbg.__wbg_matches_7809d58d7a13e2eb = function(arg0) {608 const ret = getObject(arg0).matches;609 return ret;610 };611 imports.wbg.__wbg_identifier_efb4abe3a00599c1 = function(arg0) {612 const ret = getObject(arg0).identifier;613 return ret;614 };615 imports.wbg.__wbg_pageX_20e9ef69ae98e6ca = function(arg0) {616 const ret = getObject(arg0).pageX;617 return ret;618 };619 imports.wbg.__wbg_pageY_8e273493fff14cd6 = function(arg0) {620 const ret = getObject(arg0).pageY;621 return ret;622 };623 imports.wbg.__wbg_force_8c0adc9011c40238 = function(arg0) {624 const ret = getObject(arg0).force;625 return ret;626 };627 imports.wbg.__wbg_instanceof_HtmlInputElement_750fccab172eab35 = function(arg0) {628 const ret = getObject(arg0) instanceof HTMLInputElement;629 return ret;630 };631 imports.wbg.__wbg_setautofocus_ce657398d4bfbbb0 = function(arg0, arg1) {632 getObject(arg0).autofocus = arg1 !== 0;633 };634 imports.wbg.__wbg_setsize_1d5b32171e4916c6 = function(arg0, arg1) {635 getObject(arg0).size = arg1 >>> 0;636 };637 imports.wbg.__wbg_value_14b43f7df5bd6160 = function(arg0, arg1) {638 const ret = getObject(arg1).value;639 const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);640 const len0 = WASM_VECTOR_LEN;641 getInt32Memory0()[arg0 / 4 + 1] = len0;642 getInt32Memory0()[arg0 / 4 + 0] = ptr0;643 };644 imports.wbg.__wbg_setvalue_649eb7de76d4a493 = function(arg0, arg1, arg2) {645 getObject(arg0).value = getStringFromWasm0(arg1, arg2);646 };647 imports.wbg.__wbindgen_object_clone_ref = function(arg0) {648 const ret = getObject(arg0);649 return addHeapObject(ret);650 };651 imports.wbg.__wbg_items_ab2c5110450d2c6a = function(arg0) {652 const ret = getObject(arg0).items;653 return addHeapObject(ret);654 };655 imports.wbg.__wbg_files_506106b5b79463d5 = function(arg0) {656 const ret = getObject(arg0).files;657 return isLikeNone(ret) ? 0 : addHeapObject(ret);658 };659 imports.wbg.__wbg_getData_18bfc326d2fcc5fc = function() { return handleError(function (arg0, arg1, arg2, arg3) {660 const ret = getObject(arg1).getData(getStringFromWasm0(arg2, arg3));661 const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);662 const len0 = WASM_VECTOR_LEN;663 getInt32Memory0()[arg0 / 4 + 1] = len0;664 getInt32Memory0()[arg0 / 4 + 0] = ptr0;665 }, arguments) };666 imports.wbg.__wbg_length_37d5aa06d94e029d = function(arg0) {667 const ret = getObject(arg0).length;668 return ret;669 };670 imports.wbg.__wbg_get_a2af1e42e8d6d040 = function(arg0, arg1) {671 const ret = getObject(arg0)[arg1 >>> 0];672 return isLikeNone(ret) ? 0 : addHeapObject(ret);673 };674 imports.wbg.__wbg_length_ced2607e299e48b0 = function(arg0) {675 const ret = getObject(arg0).length;676 return ret;677 };678 imports.wbg.__wbg_get_bbde85c2e4ce9183 = function(arg0, arg1) {679 const ret = getObject(arg0)[arg1 >>> 0];680 return isLikeNone(ret) ? 0 : addHeapObject(ret);681 };682 imports.wbg.__wbg_now_20d2aadcf3cc17f7 = function(arg0) {683 const ret = getObject(arg0).now();684 return ret;685 };686 imports.wbg.__wbg_length_86a84abd1008e3f0 = function(arg0) {687 const ret = getObject(arg0).length;688 return ret;689 };690 imports.wbg.__wbg_item_5cffd6d67fb3a3a3 = function(arg0, arg1) {691 const ret = getObject(arg0).item(arg1 >>> 0);692 return isLikeNone(ret) ? 0 : addHeapObject(ret);693 };694 imports.wbg.__wbg_get_8a239117b507dd81 = function(arg0, arg1) {695 const ret = getObject(arg0)[arg1 >>> 0];696 return isLikeNone(ret) ? 0 : addHeapObject(ret);697 };698 imports.wbg.__wbg_preventDefault_747982fd5fe3b6d0 = function(arg0) {699 getObject(arg0).preventDefault();700 };701 imports.wbg.__wbg_stopPropagation_63abc0c04280af82 = function(arg0) {702 getObject(arg0).stopPropagation();703 };704 imports.wbg.__wbg_name_705e027681939ce2 = function(arg0, arg1) {705 const ret = getObject(arg1).name;706 const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);707 const len0 = WASM_VECTOR_LEN;708 getInt32Memory0()[arg0 / 4 + 1] = len0;709 getInt32Memory0()[arg0 / 4 + 0] = ptr0;710 };711 imports.wbg.__wbg_lastModified_578207da4ec8a735 = function(arg0) {712 const ret = getObject(arg0).lastModified;713 return ret;714 };715 imports.wbg.__wbg_keyCode_9bdbab45f06fb085 = function(arg0) {716 const ret = getObject(arg0).keyCode;717 return ret;718 };719 imports.wbg.__wbg_altKey_4c4f9abf8a09e7c7 = function(arg0) {720 const ret = getObject(arg0).altKey;721 return ret;722 };723 imports.wbg.__wbg_ctrlKey_37d7587cf9229e4c = function(arg0) {724 const ret = getObject(arg0).ctrlKey;725 return ret;726 };727 imports.wbg.__wbg_shiftKey_94c9fa9845182d9e = function(arg0) {728 const ret = getObject(arg0).shiftKey;729 return ret;730 };731 imports.wbg.__wbg_metaKey_ecd5174305b25455 = function(arg0) {732 const ret = getObject(arg0).metaKey;733 return ret;734 };735 imports.wbg.__wbg_isComposing_fa3e456916264d71 = function(arg0) {736 const ret = getObject(arg0).isComposing;737 return ret;738 };739 imports.wbg.__wbg_key_a8ae33ddc6ff786b = function(arg0, arg1) {740 const ret = getObject(arg1).key;741 const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);742 const len0 = WASM_VECTOR_LEN;743 getInt32Memory0()[arg0 / 4 + 1] = len0;744 getInt32Memory0()[arg0 / 4 + 0] = ptr0;745 };746 imports.wbg.__wbg_clipboard_e99151dcef87806f = function(arg0) {747 const ret = getObject(arg0).clipboard;748 return isLikeNone(ret) ? 0 : addHeapObject(ret);749 };750 imports.wbg.__wbg_userAgent_e5954dbb033ddef9 = function() { return handleError(function (arg0, arg1) {751 const ret = getObject(arg1).userAgent;752 const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);753 const len0 = WASM_VECTOR_LEN;754 getInt32Memory0()[arg0 / 4 + 1] = len0;755 getInt32Memory0()[arg0 / 4 + 0] = ptr0;756 }, arguments) };757 imports.wbg.__wbg_clipboardData_a95ca12e53577c09 = function(arg0) {758 const ret = getObject(arg0).clipboardData;759 return isLikeNone(ret) ? 0 : addHeapObject(ret);760 };761 imports.wbg.__wbg_width_a260098679e33e90 = function(arg0) {762 const ret = getObject(arg0).width;763 return ret;764 };765 imports.wbg.__wbg_height_1f8574470ebe45c9 = function(arg0) {766 const ret = getObject(arg0).height;767 return ret;768 };769 imports.wbg.__wbg_top_da39668ed41161c4 = function(arg0) {770 const ret = getObject(arg0).top;771 return ret;772 };773 imports.wbg.__wbg_left_a1624a1a425102f3 = function(arg0) {774 const ret = getObject(arg0).left;775 return ret;776 };777 imports.wbg.__wbg_instanceof_HtmlCanvasElement_b94545433bb4d2ef = function(arg0) {778 const ret = getObject(arg0) instanceof HTMLCanvasElement;779 return ret;780 };781 imports.wbg.__wbg_width_20b7a9ebdd5f4232 = function(arg0) {782 const ret = getObject(arg0).width;783 return ret;784 };785 imports.wbg.__wbg_setwidth_654d8adcd4979eed = function(arg0, arg1) {786 getObject(arg0).width = arg1 >>> 0;787 };788 imports.wbg.__wbg_height_57f43816c2227a89 = function(arg0) {789 const ret = getObject(arg0).height;790 return ret;791 };792 imports.wbg.__wbg_setheight_2b662384bfacb65c = function(arg0, arg1) {793 getObject(arg0).height = arg1 >>> 0;794 };795 imports.wbg.__wbg_getContext_0c19ba5c037e057f = function() { return handleError(function (arg0, arg1, arg2) {796 const ret = getObject(arg0).getContext(getStringFromWasm0(arg1, arg2));797 return isLikeNone(ret) ? 0 : addHeapObject(ret);798 }, arguments) };799 imports.wbg.__wbg_touches_d4869a7500017809 = function(arg0) {800 const ret = getObject(arg0).touches;801 return addHeapObject(ret);802 };803 imports.wbg.__wbg_changedTouches_21bd59fbbc482ad7 = function(arg0) {804 const ret = getObject(arg0).changedTouches;805 return addHeapObject(ret);806 };807 imports.wbg.__wbg_body_2a1ff14b05042a51 = function(arg0) {808 const ret = getObject(arg0).body;809 return isLikeNone(ret) ? 0 : addHeapObject(ret);810 };811 imports.wbg.__wbg_createElement_3c9b5f3aa42457a1 = function() { return handleError(function (arg0, arg1, arg2) {812 const ret = getObject(arg0).createElement(getStringFromWasm0(arg1, arg2));813 return addHeapObject(ret);814 }, arguments) };815 imports.wbg.__wbg_getElementById_f83c5de20dc455d6 = function(arg0, arg1, arg2) {816 const ret = getObject(arg0).getElementById(getStringFromWasm0(arg1, arg2));817 return isLikeNone(ret) ? 0 : addHeapObject(ret);818 };819 imports.wbg.__wbg_instanceof_WebGlRenderingContext_b0885da52b151d86 = function(arg0) {820 const ret = getObject(arg0) instanceof WebGLRenderingContext;821 return ret;822 };823 imports.wbg.__wbg_bufferData_282e5d315f5503eb = function(arg0, arg1, arg2, arg3) {824 getObject(arg0).bufferData(arg1 >>> 0, getObject(arg2), arg3 >>> 0);825 };826 imports.wbg.__wbg_texImage2D_ca7055ca4feee279 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {827 getObject(arg0).texImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, getObject(arg9));828 }, arguments) };829 imports.wbg.__wbg_texSubImage2D_fe76e590b3e3fa85 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {830 getObject(arg0).texSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, getObject(arg9));831 }, arguments) };832 imports.wbg.__wbg_activeTexture_1ba5758f0a8358b6 = function(arg0, arg1) {833 getObject(arg0).activeTexture(arg1 >>> 0);834 };835 imports.wbg.__wbg_attachShader_0867104b37cae2d6 = function(arg0, arg1, arg2) {836 getObject(arg0).attachShader(getObject(arg1), getObject(arg2));837 };838 imports.wbg.__wbg_bindBuffer_28e62f648e99e251 = function(arg0, arg1, arg2) {839 getObject(arg0).bindBuffer(arg1 >>> 0, getObject(arg2));840 };841 imports.wbg.__wbg_bindFramebuffer_b7a06305d2823b34 = function(arg0, arg1, arg2) {842 getObject(arg0).bindFramebuffer(arg1 >>> 0, getObject(arg2));843 };844 imports.wbg.__wbg_bindRenderbuffer_0fe389ab46c4d00d = function(arg0, arg1, arg2) {845 getObject(arg0).bindRenderbuffer(arg1 >>> 0, getObject(arg2));846 };847 imports.wbg.__wbg_bindTexture_27a724e7303eec67 = function(arg0, arg1, arg2) {848 getObject(arg0).bindTexture(arg1 >>> 0, getObject(arg2));849 };850 imports.wbg.__wbg_blendEquationSeparate_ffbed0120340f7d5 = function(arg0, arg1, arg2) {851 getObject(arg0).blendEquationSeparate(arg1 >>> 0, arg2 >>> 0);852 };853 imports.wbg.__wbg_blendFuncSeparate_c750720abdc9d54e = function(arg0, arg1, arg2, arg3, arg4) {854 getObject(arg0).blendFuncSeparate(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4 >>> 0);855 };856 imports.wbg.__wbg_clear_786a8deca6672a9d = function(arg0, arg1) {857 getObject(arg0).clear(arg1 >>> 0);858 };859 imports.wbg.__wbg_clearColor_2c1d714dee770474 = function(arg0, arg1, arg2, arg3, arg4) {860 getObject(arg0).clearColor(arg1, arg2, arg3, arg4);861 };862 imports.wbg.__wbg_colorMask_0cfe7588f073be4e = function(arg0, arg1, arg2, arg3, arg4) {863 getObject(arg0).colorMask(arg1 !== 0, arg2 !== 0, arg3 !== 0, arg4 !== 0);864 };865 imports.wbg.__wbg_compileShader_1b371763cfd802f7 = function(arg0, arg1) {866 getObject(arg0).compileShader(getObject(arg1));867 };868 imports.wbg.__wbg_createBuffer_48c0376fc0746386 = function(arg0) {869 const ret = getObject(arg0).createBuffer();870 return isLikeNone(ret) ? 0 : addHeapObject(ret);871 };872 imports.wbg.__wbg_createFramebuffer_f6f4aff3c462de89 = function(arg0) {873 const ret = getObject(arg0).createFramebuffer();874 return isLikeNone(ret) ? 0 : addHeapObject(ret);875 };876 imports.wbg.__wbg_createProgram_c2675d2cc83435a6 = function(arg0) {877 const ret = getObject(arg0).createProgram();878 return isLikeNone(ret) ? 0 : addHeapObject(ret);879 };880 imports.wbg.__wbg_createRenderbuffer_5f8fcf55de2b35f5 = function(arg0) {881 const ret = getObject(arg0).createRenderbuffer();882 return isLikeNone(ret) ? 0 : addHeapObject(ret);883 };884 imports.wbg.__wbg_createShader_8d2a55e7777bbea7 = function(arg0, arg1) {885 const ret = getObject(arg0).createShader(arg1 >>> 0);886 return isLikeNone(ret) ? 0 : addHeapObject(ret);887 };888 imports.wbg.__wbg_createTexture_23de5d8f7988e663 = function(arg0) {889 const ret = getObject(arg0).createTexture();890 return isLikeNone(ret) ? 0 : addHeapObject(ret);891 };892 imports.wbg.__wbg_deleteShader_d39446753b2fa1e7 = function(arg0, arg1) {893 getObject(arg0).deleteShader(getObject(arg1));894 };895 imports.wbg.__wbg_deleteTexture_bf4ea3b750a15992 = function(arg0, arg1) {896 getObject(arg0).deleteTexture(getObject(arg1));897 };898 imports.wbg.__wbg_detachShader_e2c6cb7c2c469a33 = function(arg0, arg1, arg2) {899 getObject(arg0).detachShader(getObject(arg1), getObject(arg2));900 };901 imports.wbg.__wbg_disable_ada50e27543b1ebd = function(arg0, arg1) {902 getObject(arg0).disable(arg1 >>> 0);903 };904 imports.wbg.__wbg_disableVertexAttribArray_e1c513cfd55355c9 = function(arg0, arg1) {905 getObject(arg0).disableVertexAttribArray(arg1 >>> 0);906 };907 imports.wbg.__wbg_drawElements_efa6c15e2787a58c = function(arg0, arg1, arg2, arg3, arg4) {908 getObject(arg0).drawElements(arg1 >>> 0, arg2, arg3 >>> 0, arg4);909 };910 imports.wbg.__wbg_enable_981a414a11bbed87 = function(arg0, arg1) {911 getObject(arg0).enable(arg1 >>> 0);912 };913 imports.wbg.__wbg_enableVertexAttribArray_1d5f3ff6e7da7095 = function(arg0, arg1) {914 getObject(arg0).enableVertexAttribArray(arg1 >>> 0);915 };916 imports.wbg.__wbg_framebufferRenderbuffer_ed95c4854179b4ac = function(arg0, arg1, arg2, arg3, arg4) {917 getObject(arg0).framebufferRenderbuffer(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, getObject(arg4));918 };919 imports.wbg.__wbg_framebufferTexture2D_3bb72a24d7618de9 = function(arg0, arg1, arg2, arg3, arg4, arg5) {920 getObject(arg0).framebufferTexture2D(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, getObject(arg4), arg5);921 };922 imports.wbg.__wbg_getAttribLocation_f875dcf14748b9d4 = function(arg0, arg1, arg2, arg3) {923 const ret = getObject(arg0).getAttribLocation(getObject(arg1), getStringFromWasm0(arg2, arg3));924 return ret;925 };926 imports.wbg.__wbg_getError_447f4b8abb16917e = function(arg0) {927 const ret = getObject(arg0).getError();928 return ret;929 };930 imports.wbg.__wbg_getExtension_bea19db80bdbefef = function() { return handleError(function (arg0, arg1, arg2) {931 const ret = getObject(arg0).getExtension(getStringFromWasm0(arg1, arg2));932 return isLikeNone(ret) ? 0 : addHeapObject(ret);933 }, arguments) };934 imports.wbg.__wbg_getParameter_f511b92ebf87c44e = function() { return handleError(function (arg0, arg1) {935 const ret = getObject(arg0).getParameter(arg1 >>> 0);936 return addHeapObject(ret);937 }, arguments) };938 imports.wbg.__wbg_getProgramInfoLog_e70b0120bda14895 = function(arg0, arg1, arg2) {939 const ret = getObject(arg1).getProgramInfoLog(getObject(arg2));940 var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);941 var len0 = WASM_VECTOR_LEN;942 getInt32Memory0()[arg0 / 4 + 1] = len0;943 getInt32Memory0()[arg0 / 4 + 0] = ptr0;944 };945 imports.wbg.__wbg_getProgramParameter_e4fe54d806806081 = function(arg0, arg1, arg2) {946 const ret = getObject(arg0).getProgramParameter(getObject(arg1), arg2 >>> 0);947 return addHeapObject(ret);948 };949 imports.wbg.__wbg_getShaderInfoLog_95d068aeccc5dbb3 = function(arg0, arg1, arg2) {950 const ret = getObject(arg1).getShaderInfoLog(getObject(arg2));951 var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);952 var len0 = WASM_VECTOR_LEN;953 getInt32Memory0()[arg0 / 4 + 1] = len0;954 getInt32Memory0()[arg0 / 4 + 0] = ptr0;955 };956 imports.wbg.__wbg_getShaderParameter_2972af1cb850aeb7 = function(arg0, arg1, arg2) {957 const ret = getObject(arg0).getShaderParameter(getObject(arg1), arg2 >>> 0);958 return addHeapObject(ret);959 };960 imports.wbg.__wbg_getSupportedExtensions_0d5d24aad2788aec = function(arg0) {961 const ret = getObject(arg0).getSupportedExtensions();962 return isLikeNone(ret) ? 0 : addHeapObject(ret);963 };964 imports.wbg.__wbg_getUniformLocation_776a1f58e7904d81 = function(arg0, arg1, arg2, arg3) {965 const ret = getObject(arg0).getUniformLocation(getObject(arg1), getStringFromWasm0(arg2, arg3));966 return isLikeNone(ret) ? 0 : addHeapObject(ret);967 };968 imports.wbg.__wbg_linkProgram_b98c8967f45a44fd = function(arg0, arg1) {969 getObject(arg0).linkProgram(getObject(arg1));970 };971 imports.wbg.__wbg_pixelStorei_707653d2f29a6c67 = function(arg0, arg1, arg2) {972 getObject(arg0).pixelStorei(arg1 >>> 0, arg2);973 };974 imports.wbg.__wbg_renderbufferStorage_56e5cf7c10bbc044 = function(arg0, arg1, arg2, arg3, arg4) {975 getObject(arg0).renderbufferStorage(arg1 >>> 0, arg2 >>> 0, arg3, arg4);976 };977 imports.wbg.__wbg_scissor_056d185c74d7c0ad = function(arg0, arg1, arg2, arg3, arg4) {978 getObject(arg0).scissor(arg1, arg2, arg3, arg4);979 };980 imports.wbg.__wbg_shaderSource_daca520f63ef8fca = function(arg0, arg1, arg2, arg3) {981 getObject(arg0).shaderSource(getObject(arg1), getStringFromWasm0(arg2, arg3));982 };983 imports.wbg.__wbg_texParameteri_1298d8804b59bbc0 = function(arg0, arg1, arg2, arg3) {984 getObject(arg0).texParameteri(arg1 >>> 0, arg2 >>> 0, arg3);985 };986 imports.wbg.__wbg_uniform1i_42b99e992f794a51 = function(arg0, arg1, arg2) {987 getObject(arg0).uniform1i(getObject(arg1), arg2);988 };989 imports.wbg.__wbg_uniform2f_3a04be03a4c69f62 = function(arg0, arg1, arg2, arg3) {990 getObject(arg0).uniform2f(getObject(arg1), arg2, arg3);991 };992 imports.wbg.__wbg_useProgram_022d72a653706891 = function(arg0, arg1) {993 getObject(arg0).useProgram(getObject(arg1));994 };995 imports.wbg.__wbg_vertexAttribPointer_a75ea424ba9fa4e8 = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {996 getObject(arg0).vertexAttribPointer(arg1 >>> 0, arg2, arg3 >>> 0, arg4 !== 0, arg5, arg6);997 };998 imports.wbg.__wbg_viewport_6c864379ded67e8a = function(arg0, arg1, arg2, arg3, arg4) {999 getObject(arg0).viewport(arg1, arg2, arg3, arg4);1000 };1001 imports.wbg.__wbg_setid_ea9f00ecb5da9dde = function(arg0, arg1, arg2) {1002 getObject(arg0).id = getStringFromWasm0(arg1, arg2);1003 };1004 imports.wbg.__wbg_scrollLeft_9aba28808f857e36 = function(arg0) {1005 const ret = getObject(arg0).scrollLeft;1006 return ret;1007 };1008 imports.wbg.__wbg_clientWidth_11f72beceb108bff = function(arg0) {1009 const ret = getObject(arg0).clientWidth;1010 return ret;1011 };1012 imports.wbg.__wbg_clientHeight_205d93d6eadff351 = function(arg0) {1013 const ret = getObject(arg0).clientHeight;1014 return ret;1015 };1016 imports.wbg.__wbg_getBoundingClientRect_ab935d65fdd23c25 = function(arg0) {1017 const ret = getObject(arg0).getBoundingClientRect();1018 return addHeapObject(ret);1019 };1020 imports.wbg.__wbg_scrollTop_f1031b88f039d8df = function(arg0) {1021 const ret = getObject(arg0).scrollTop;1022 return ret;1023 };1024 imports.wbg.__wbg_hidden_809625377ca6c4a3 = function(arg0) {1025 const ret = getObject(arg0).hidden;1026 return ret;1027 };1028 imports.wbg.__wbg_sethidden_7a120b754b048503 = function(arg0, arg1) {1029 getObject(arg0).hidden = arg1 !== 0;1030 };1031 imports.wbg.__wbg_style_dd3ba68ea919f1b0 = function(arg0) {1032 const ret = getObject(arg0).style;1033 return addHeapObject(ret);1034 };1035 imports.wbg.__wbg_offsetTop_c8f74f82dc787ed0 = function(arg0) {1036 const ret = getObject(arg0).offsetTop;1037 return ret;1038 };1039 imports.wbg.__wbg_offsetLeft_3b3b09bce24322ef = function(arg0) {1040 const ret = getObject(arg0).offsetLeft;1041 return ret;1042 };1043 imports.wbg.__wbg_offsetWidth_3afb80444bdcabce = function(arg0) {1044 const ret = getObject(arg0).offsetWidth;1045 return ret;1046 };1047 imports.wbg.__wbg_blur_685fb8c8baa471a1 = function() { return handleError(function (arg0) {1048 getObject(arg0).blur();1049 }, arguments) };1050 imports.wbg.__wbg_focus_42ad8e77a7a0b22a = function() { return handleError(function (arg0) {1051 getObject(arg0).focus();1052 }, arguments) };1053 imports.wbg.__wbg_size_e8d6777bbbbd2991 = function(arg0) {1054 const ret = getObject(arg0).size;1055 return ret;1056 };1057 imports.wbg.__wbg_arrayBuffer_781cc81e507364b8 = function(arg0) {1058 const ret = getObject(arg0).arrayBuffer();1059 return addHeapObject(ret);1060 };1061 imports.wbg.__wbg_href_ee02b91ff794f1c0 = function() { return handleError(function (arg0, arg1) {1062 const ret = getObject(arg1).href;1063 const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);1064 const len0 = WASM_VECTOR_LEN;1065 getInt32Memory0()[arg0 / 4 + 1] = len0;1066 getInt32Memory0()[arg0 / 4 + 0] = ptr0;1067 }, arguments) };1068 imports.wbg.__wbg_origin_890e8002c9eeba35 = function() { return handleError(function (arg0, arg1) {1069 const ret = getObject(arg1).origin;1070 const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);1071 const len0 = WASM_VECTOR_LEN;1072 getInt32Memory0()[arg0 / 4 + 1] = len0;1073 getInt32Memory0()[arg0 / 4 + 0] = ptr0;1074 }, arguments) };1075 imports.wbg.__wbg_protocol_8a7c3a0ad0534fb9 = function() { return handleError(function (arg0, arg1) {1076 const ret = getObject(arg1).protocol;1077 const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);1078 const len0 = WASM_VECTOR_LEN;1079 getInt32Memory0()[arg0 / 4 + 1] = len0;1080 getInt32Memory0()[arg0 / 4 + 0] = ptr0;1081 }, arguments) };1082 imports.wbg.__wbg_host_5a60711dad652364 = function() { return handleError(function (arg0, arg1) {1083 const ret = getObject(arg1).host;1084 const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);1085 const len0 = WASM_VECTOR_LEN;1086 getInt32Memory0()[arg0 / 4 + 1] = len0;1087 getInt32Memory0()[arg0 / 4 + 0] = ptr0;1088 }, arguments) };1089 imports.wbg.__wbg_hostname_52b243e8e2ba0022 = function() { return handleError(function (arg0, arg1) {1090 const ret = getObject(arg1).hostname;1091 const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);1092 const len0 = WASM_VECTOR_LEN;1093 getInt32Memory0()[arg0 / 4 + 1] = len0;1094 getInt32Memory0()[arg0 / 4 + 0] = ptr0;1095 }, arguments) };1096 imports.wbg.__wbg_port_91ba722f8d346400 = function() { return handleError(function (arg0, arg1) {1097 const ret = getObject(arg1).port;1098 const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);1099 const len0 = WASM_VECTOR_LEN;1100 getInt32Memory0()[arg0 / 4 + 1] = len0;1101 getInt32Memory0()[arg0 / 4 + 0] = ptr0;1102 }, arguments) };1103 imports.wbg.__wbg_search_083c5449552cf16e = function() { return handleError(function (arg0, arg1) {1104 const ret = getObject(arg1).search;1105 const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);1106 const len0 = WASM_VECTOR_LEN;1107 getInt32Memory0()[arg0 / 4 + 1] = len0;1108 getInt32Memory0()[arg0 / 4 + 0] = ptr0;1109 }, arguments) };1110 imports.wbg.__wbg_hash_d124cf237fe7b7c1 = function() { return handleError(function (arg0, arg1) {1111 const ret = getObject(arg1).hash;1112 const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);1113 const len0 = WASM_VECTOR_LEN;1114 getInt32Memory0()[arg0 / 4 + 1] = len0;1115 getInt32Memory0()[arg0 / 4 + 0] = ptr0;1116 }, arguments) };1117 imports.wbg.__wbg_appendChild_a86c0da8d152eae4 = function() { return handleError(function (arg0, arg1) {1118 const ret = getObject(arg0).appendChild(getObject(arg1));1119 return addHeapObject(ret);1120 }, arguments) };1121 imports.wbg.__wbg_getItem_eb6e17b18b890a47 = function() { return handleError(function (arg0, arg1, arg2, arg3) {1122 const ret = getObject(arg1).getItem(getStringFromWasm0(arg2, arg3));1123 var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);1124 var len0 = WASM_VECTOR_LEN;1125 getInt32Memory0()[arg0 / 4 + 1] = len0;1126 getInt32Memory0()[arg0 / 4 + 0] = ptr0;1127 }, arguments) };1128 imports.wbg.__wbg_setItem_ed2ea572329ab721 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {1129 getObject(arg0).setItem(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));1130 }, arguments) };1131 imports.wbg.__wbg_data_ccaf50f3288b08c5 = function(arg0, arg1) {1132 const ret = getObject(arg1).data;1133 var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);1134 var len0 = WASM_VECTOR_LEN;1135 getInt32Memory0()[arg0 / 4 + 1] = len0;1136 getInt32Memory0()[arg0 / 4 + 0] = ptr0;1137 };1138 imports.wbg.__wbg_setProperty_ae9adf5d00216c03 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {1139 getObject(arg0).setProperty(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));1140 }, arguments) };1141 imports.wbg.__wbg_type_d73ca5f20cbe175f = function(arg0, arg1) {1142 const ret = getObject(arg1).type;1143 const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);1144 const len0 = WASM_VECTOR_LEN;1145 getInt32Memory0()[arg0 / 4 + 1] = len0;1146 getInt32Memory0()[arg0 / 4 + 0] = ptr0;1147 };1148 imports.wbg.__wbg_clientX_83648828186ba19f = function(arg0) {1149 const ret = getObject(arg0).clientX;1150 return ret;1151 };1152 imports.wbg.__wbg_clientY_ba9e5549993281e3 = function(arg0) {1153 const ret = getObject(arg0).clientY;1154 return ret;1155 };1156 imports.wbg.__wbg_ctrlKey_e4aeb9366ca88d41 = function(arg0) {1157 const ret = getObject(arg0).ctrlKey;1158 return ret;1159 };1160 imports.wbg.__wbg_shiftKey_42596574095ad5e2 = function(arg0) {1161 const ret = getObject(arg0).shiftKey;1162 return ret;1163 };1164 imports.wbg.__wbg_metaKey_ad377163d8beff50 = function(arg0) {1165 const ret = getObject(arg0).metaKey;1166 return ret;1167 };1168 imports.wbg.__wbg_button_78dae8616402469e = function(arg0) {1169 const ret = getObject(arg0).button;1170 return ret;1171 };1172 imports.wbg.__wbg_dataTransfer_a9eebb31aa4055f2 = function(arg0) {1173 const ret = getObject(arg0).dataTransfer;1174 return isLikeNone(ret) ? 0 : addHeapObject(ret);1175 };1176 imports.wbg.__wbg_bindVertexArrayOES_35d97084dfc5f6f4 = function(arg0, arg1) {1177 getObject(arg0).bindVertexArrayOES(getObject(arg1));1178 };1179 imports.wbg.__wbg_createVertexArrayOES_69c38b2b74e927fa = function(arg0) {1180 const ret = getObject(arg0).createVertexArrayOES();1181 return isLikeNone(ret) ? 0 : addHeapObject(ret);1182 };1183 imports.wbg.__wbg_deltaX_692299f5e35cfb0d = function(arg0) {1184 const ret = getObject(arg0).deltaX;1185 return ret;1186 };1187 imports.wbg.__wbg_deltaY_f78bae9413139a24 = function(arg0) {1188 const ret = getObject(arg0).deltaY;1189 return ret;1190 };1191 imports.wbg.__wbg_deltaMode_08c2fcea70146506 = function(arg0) {1192 const ret = getObject(arg0).deltaMode;1193 return ret;1194 };1195 imports.wbg.__wbg_get_590a2cd912f2ae46 = function(arg0, arg1) {1196 const ret = getObject(arg0)[arg1 >>> 0];1197 return addHeapObject(ret);1198 };1199 imports.wbg.__wbg_length_2cd798326f2cc4c1 = function(arg0) {1200 const ret = getObject(arg0).length;1201 return ret;1202 };1203 imports.wbg.__wbg_newnoargs_e23b458e372830de = function(arg0, arg1) {1204 const ret = new Function(getStringFromWasm0(arg0, arg1));1205 return addHeapObject(ret);1206 };1207 imports.wbg.__wbg_call_ae78342adc33730a = function() { return handleError(function (arg0, arg1) {1208 const ret = getObject(arg0).call(getObject(arg1));1209 return addHeapObject(ret);1210 }, arguments) };1211 imports.wbg.__wbg_resolve_a9a87bdd64e9e62c = function(arg0) {1212 const ret = Promise.resolve(getObject(arg0));1213 return addHeapObject(ret);1214 };1215 imports.wbg.__wbg_then_ce526c837d07b68f = function(arg0, arg1) {1216 const ret = getObject(arg0).then(getObject(arg1));1217 return addHeapObject(ret);1218 };1219 imports.wbg.__wbg_then_842e65b843962f56 = function(arg0, arg1, arg2) {1220 const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));1221 return addHeapObject(ret);1222 };1223 imports.wbg.__wbg_self_99737b4dcdf6f0d8 = function() { return handleError(function () {1224 const ret = self.self;1225 return addHeapObject(ret);1226 }, arguments) };1227 imports.wbg.__wbg_window_9b61fbbf3564c4fb = function() { return handleError(function () {1228 const ret = window.window;1229 return addHeapObject(ret);1230 }, arguments) };1231 imports.wbg.__wbg_globalThis_8e275ef40caea3a3 = function() { return handleError(function () {1232 const ret = globalThis.globalThis;1233 return addHeapObject(ret);1234 }, arguments) };1235 imports.wbg.__wbg_global_5de1e0f82bddcd27 = function() { return handleError(function () {1236 const ret = global.global;1237 return addHeapObject(ret);1238 }, arguments) };1239 imports.wbg.__wbindgen_is_undefined = function(arg0) {1240 const ret = getObject(arg0) === undefined;1241 return ret;1242 };1243 imports.wbg.__wbg_buffer_7af23f65f6c64548 = function(arg0) {1244 const ret = getObject(arg0).buffer;1245 return addHeapObject(ret);1246 };1247 imports.wbg.__wbg_newwithbyteoffsetandlength_293152433089cf24 = function(arg0, arg1, arg2) {1248 const ret = new Int8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);1249 return addHeapObject(ret);1250 };1251 imports.wbg.__wbg_newwithbyteoffsetandlength_20bd70cc8d50ee94 = function(arg0, arg1, arg2) {1252 const ret = new Int16Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);1253 return addHeapObject(ret);1254 };1255 imports.wbg.__wbg_newwithbyteoffsetandlength_0d4e0750590b10dd = function(arg0, arg1, arg2) {1256 const ret = new Int32Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);1257 return addHeapObject(ret);1258 };1259 imports.wbg.__wbg_newwithbyteoffsetandlength_ce1e75f0ce5f7974 = function(arg0, arg1, arg2) {1260 const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);1261 return addHeapObject(ret);1262 };1263 imports.wbg.__wbg_new_cc9018bd6f283b6f = function(arg0) {1264 const ret = new Uint8Array(getObject(arg0));1265 return addHeapObject(ret);1266 };1267 imports.wbg.__wbg_set_f25e869e4565d2a2 = function(arg0, arg1, arg2) {1268 getObject(arg0).set(getObject(arg1), arg2 >>> 0);1269 };1270 imports.wbg.__wbg_length_0acb1cf9bbaf8519 = function(arg0) {1271 const ret = getObject(arg0).length;1272 return ret;1273 };1274 imports.wbg.__wbg_newwithbyteoffsetandlength_729246f395bbffc0 = function(arg0, arg1, arg2) {1275 const ret = new Uint16Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);1276 return addHeapObject(ret);1277 };1278 imports.wbg.__wbg_newwithbyteoffsetandlength_bbdb045c2c009495 = function(arg0, arg1, arg2) {1279 const ret = new Uint32Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);1280 return addHeapObject(ret);1281 };1282 imports.wbg.__wbg_newwithbyteoffsetandlength_3f554978d8793b14 = function(arg0, arg1, arg2) {1283 const ret = new Float32Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);1284 return addHeapObject(ret);1285 };1286 imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {1287 const ret = debugString(getObject(arg1));1288 const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);1289 const len0 = WASM_VECTOR_LEN;1290 getInt32Memory0()[arg0 / 4 + 1] = len0;1291 getInt32Memory0()[arg0 / 4 + 0] = ptr0;1292 };1293 imports.wbg.__wbindgen_throw = function(arg0, arg1) {1294 throw new Error(getStringFromWasm0(arg0, arg1));1295 };1296 imports.wbg.__wbindgen_memory = function() {1297 const ret = wasm.memory;1298 return addHeapObject(ret);1299 };1300 imports.wbg.__wbindgen_closure_wrapper851 = function(arg0, arg1, arg2) {1301 const ret = makeMutClosure(arg0, arg1, 230, __wbg_adapter_24);1302 return addHeapObject(ret);1303 };1304 imports.wbg.__wbindgen_closure_wrapper852 = function(arg0, arg1, arg2) {1305 const ret = makeMutClosure(arg0, arg1, 230, __wbg_adapter_27);1306 return addHeapObject(ret);1307 };1308 imports.wbg.__wbindgen_closure_wrapper853 = function(arg0, arg1, arg2) {1309 const ret = makeMutClosure(arg0, arg1, 230, __wbg_adapter_30);1310 return addHeapObject(ret);1311 };1312 imports.wbg.__wbindgen_closure_wrapper862 = function(arg0, arg1, arg2) {1313 const ret = makeMutClosure(arg0, arg1, 230, __wbg_adapter_33);1314 return addHeapObject(ret);1315 };1316 imports.wbg.__wbindgen_closure_wrapper1062 = function(arg0, arg1, arg2) {1317 const ret = makeMutClosure(arg0, arg1, 346, __wbg_adapter_36);1318 return addHeapObject(ret);1319 };1320 if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {1321 input = fetch(input);1322 }1323 const { instance, module } = await load(await input, imports);1324 wasm = instance.exports;1325 init.__wbindgen_wasm_module = module;1326 return wasm;1327}1328wasm_bindgen = Object.assign(init, __exports);...

Full Screen

Full Screen

WebIDLParser.js

Source:WebIDLParser.js Github

copy

Full Screen

1(function () {2 var tokenise = function (str) {3 var tokens = []4 , re = {5 "float": /^-?(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][-+]?[0-9]+)?|[0-9]+[Ee][-+]?[0-9]+)/6 , "integer": /^-?(0([Xx][0-9A-Fa-f]+|[0-7]*)|[1-9][0-9]*)/7 , "identifier": /^[A-Z_a-z][0-9A-Z_a-z]*/8 , "string": /^"[^"]*"/9 , "whitespace": /^(?:[\t\n\r ]+|[\t\n\r ]*((\/\/.*|\/\*(.|\n|\r)*?\*\/)[\t\n\r ]*))+/10 , "other": /^[^\t\n\r 0-9A-Z_a-z]/11 }12 , types = []13 ;14 for (var k in re) types.push(k);15 while (str.length > 0) {16 var matched = false;17 for (var i = 0, n = types.length; i < n; i++) {18 var type = types[i];19 str = str.replace(re[type], function (tok) {20 tokens.push({ type: type, value: tok });21 matched = true;22 return "";23 });24 if (matched) break;25 }26 if (matched) continue;27 throw new Error("Token stream not progressing");28 }29 return tokens;30 };31 32 var parse = function (tokens, opt) {33 var line = 1;34 tokens = tokens.slice();35 36 var FLOAT = "float"37 , INT = "integer"38 , ID = "identifier"39 , STR = "string"40 , OTHER = "other"41 ;42 43 var WebIDLParseError = function (str, line, input, tokens) {44 this.message = str;45 this.line = line;46 this.input = input;47 this.tokens = tokens;48 };49 WebIDLParseError.prototype.toString = function () {50 return this.message + ", line " + this.line + " (tokens: '" + this.input + "')\n" +51 JSON.stringify(this.tokens, null, 4);52 };53 54 var error = function (str) {55 var tok = "", numTokens = 0, maxTokens = 5;56 while (numTokens < maxTokens && tokens.length > numTokens) {57 tok += tokens[numTokens].value;58 numTokens++;59 }60 throw new WebIDLParseError(str, line, tok, tokens.slice(0, 5));61 };62 63 var last_token = null;64 65 var consume = function (type, value) {66 if (!tokens.length || tokens[0].type !== type) return;67 if (typeof value === "undefined" || tokens[0].value === value) {68 last_token = tokens.shift();69 if (type === ID) last_token.value = last_token.value.replace(/^_/, "");70 return last_token;71 }72 };73 74 var ws = function () {75 if (!tokens.length) return;76 if (tokens[0].type === "whitespace") {77 var t = tokens.shift();78 t.value.replace(/\n/g, function (m) { line++; return m; });79 return t;80 }81 };82 83 var all_ws = function (store, pea) { // pea == post extended attribute, tpea = same for types84 var t = { type: "whitespace", value: "" };85 while (true) {86 var w = ws();87 if (!w) break;88 t.value += w.value;89 }90 if (t.value.length > 0) {91 if (store) {92 var w = t.value93 , re = {94 "ws": /^([\t\n\r ]+)/95 , "line-comment": /^\/\/(.*)\n?/m96 , "multiline-comment": /^\/\*((?:.|\n|\r)*?)\*\//97 }98 , wsTypes = []99 ;100 for (var k in re) wsTypes.push(k);101 while (w.length) {102 var matched = false;103 for (var i = 0, n = wsTypes.length; i < n; i++) {104 var type = wsTypes[i];105 w = w.replace(re[type], function (tok, m1) {106 store.push({ type: type + (pea ? ("-" + pea) : ""), value: m1 });107 matched = true;108 return "";109 });110 if (matched) break;111 }112 if (matched) continue;113 throw new Error("Surprising white space construct."); // this shouldn't happen114 }115 }116 return t;117 }118 };119 120 var integer_type = function () {121 var ret = "";122 all_ws();123 if (consume(ID, "unsigned")) ret = "unsigned ";124 all_ws();125 if (consume(ID, "short")) return ret + "short";126 if (consume(ID, "long")) {127 ret += "long";128 all_ws();129 if (consume(ID, "long")) return ret + " long";130 return ret;131 }132 if (ret) error("Failed to parse integer type");133 };134 135 var float_type = function () {136 var ret = "";137 all_ws();138 if (consume(ID, "unrestricted")) ret = "unrestricted ";139 all_ws();140 if (consume(ID, "float")) return ret + "float";141 if (consume(ID, "double")) return ret + "double";142 if (ret) error("Failed to parse float type");143 };144 145 var primitive_type = function () {146 var num_type = integer_type() || float_type();147 if (num_type) return num_type;148 all_ws();149 if (consume(ID, "boolean")) return "boolean";150 if (consume(ID, "byte")) return "byte";151 if (consume(ID, "octet")) return "octet";152 };153 154 var const_value = function () {155 if (consume(ID, "true")) return { type: "boolean", value: true };156 if (consume(ID, "false")) return { type: "boolean", value: false };157 if (consume(ID, "null")) return { type: "null" };158 if (consume(ID, "Infinity")) return { type: "Infinity", negative: false };159 if (consume(ID, "NaN")) return { type: "NaN" };160 var ret = consume(FLOAT) || consume(INT);161 if (ret) return { type: "number", value: 1 * ret.value };162 var tok = consume(OTHER, "-");163 if (tok) {164 if (consume(ID, "Infinity")) return { type: "Infinity", negative: true };165 else tokens.unshift(tok);166 }167 };168 169 var type_suffix = function (obj) {170 while (true) {171 all_ws();172 if (consume(OTHER, "?")) {173 if (obj.nullable) error("Can't nullable more than once");174 obj.nullable = true;175 }176 else if (consume(OTHER, "[")) {177 all_ws();178 consume(OTHER, "]") || error("Unterminated array type");179 if (!obj.array) {180 obj.array = 1;181 obj.nullableArray = [obj.nullable];182 }183 else {184 obj.array++;185 obj.nullableArray.push(obj.nullable);186 }187 obj.nullable = false;188 }189 else return;190 }191 };192 193 var single_type = function () {194 var prim = primitive_type()195 , ret = { sequence: false, generic: null, nullable: false, array: false, union: false }196 , name197 , value198 ;199 if (prim) {200 ret.idlType = prim;201 }202 else if (name = consume(ID)) {203 value = name.value;204 all_ws();205 // Generic types206 if (consume(OTHER, "<")) {207 // backwards compat208 if (value === "sequence") {209 ret.sequence = true;210 }211 ret.generic = value;212 ret.idlType = type() || error("Error parsing generic type " + value);213 all_ws();214 if (!consume(OTHER, ">")) error("Unterminated generic type " + value);215 all_ws();216 if (consume(OTHER, "?")) ret.nullable = true;217 return ret;218 }219 else {220 ret.idlType = value;221 }222 }223 else {224 return;225 }226 type_suffix(ret);227 if (ret.nullable && !ret.array && ret.idlType === "any") error("Type any cannot be made nullable");228 return ret;229 };230 231 var union_type = function () {232 all_ws();233 if (!consume(OTHER, "(")) return;234 var ret = { sequence: false, generic: null, nullable: false, array: false, union: true, idlType: [] };235 var fst = type() || error("Union type with no content");236 ret.idlType.push(fst);237 while (true) {238 all_ws();239 if (!consume(ID, "or")) break;240 var typ = type() || error("No type after 'or' in union type");241 ret.idlType.push(typ);242 }243 if (!consume(OTHER, ")")) error("Unterminated union type");244 type_suffix(ret);245 return ret;246 };247 248 var type = function () {249 return single_type() || union_type();250 };251 252 var argument = function (store) {253 var ret = { optional: false, variadic: false };254 ret.extAttrs = extended_attrs(store);255 all_ws(store, "pea");256 var opt_token = consume(ID, "optional");257 if (opt_token) {258 ret.optional = true;259 all_ws();260 }261 ret.idlType = type();262 if (!ret.idlType) {263 if (opt_token) tokens.unshift(opt_token);264 return;265 }266 var type_token = last_token;267 if (!ret.optional) {268 all_ws();269 if (tokens.length >= 3 &&270 tokens[0].type === "other" && tokens[0].value === "." &&271 tokens[1].type === "other" && tokens[1].value === "." &&272 tokens[2].type === "other" && tokens[2].value === "."273 ) {274 tokens.shift();275 tokens.shift();276 tokens.shift();277 ret.variadic = true;278 }279 }280 all_ws();281 var name = consume(ID);282 if (!name) {283 if (opt_token) tokens.unshift(opt_token);284 tokens.unshift(type_token);285 return;286 }287 ret.name = name.value;288 if (ret.optional) {289 all_ws();290 ret["default"] = default_();291 }292 return ret;293 };294 295 var argument_list = function (store) {296 var ret = []297 , arg = argument(store ? ret : null)298 ;299 if (!arg) return;300 ret.push(arg);301 while (true) {302 all_ws(store ? ret : null);303 if (!consume(OTHER, ",")) return ret;304 var nxt = argument(store ? ret : null) || error("Trailing comma in arguments list");305 ret.push(nxt);306 }307 };308 309 var type_pair = function () {310 all_ws();311 var k = type();312 if (!k) return;313 all_ws()314 if (!consume(OTHER, ",")) return;315 all_ws();316 var v = type();317 if (!v) return;318 return [k, v];319 };320 321 var simple_extended_attr = function (store) {322 all_ws();323 var name = consume(ID);324 if (!name) return;325 var ret = {326 name: name.value327 , "arguments": null328 };329 all_ws();330 var eq = consume(OTHER, "=");331 if (eq) {332 all_ws();333 ret.rhs = consume(ID);334 if (!ret.rhs) return error("No right hand side to extended attribute assignment");335 }336 all_ws();337 if (consume(OTHER, "(")) {338 var args, pair;339 // [Constructor(DOMString str)]340 if (args = argument_list(store)) {341 ret["arguments"] = args;342 }343 // [MapClass(DOMString, DOMString)]344 else if (pair = type_pair()) {345 ret.typePair = pair;346 }347 // [Constructor()]348 else {349 ret["arguments"] = [];350 }351 all_ws();352 consume(OTHER, ")") || error("Unexpected token in extended attribute argument list or type pair");353 }354 return ret;355 };356 357 // Note: we parse something simpler than the official syntax. It's all that ever358 // seems to be used359 var extended_attrs = function (store) {360 var eas = [];361 all_ws(store);362 if (!consume(OTHER, "[")) return eas;363 eas[0] = simple_extended_attr(store) || error("Extended attribute with not content");364 all_ws();365 while (consume(OTHER, ",")) {366 eas.push(simple_extended_attr(store) || error("Trailing comma in extended attribute"));367 all_ws();368 }369 consume(OTHER, "]") || error("No end of extended attribute");370 return eas;371 };372 373 var default_ = function () {374 all_ws();375 if (consume(OTHER, "=")) {376 all_ws();377 var def = const_value();378 if (def) {379 return def;380 }381 else {382 var str = consume(STR) || error("No value for default");383 str.value = str.value.replace(/^"/, "").replace(/"$/, "");384 return str;385 }386 }387 };388 389 var const_ = function (store) {390 all_ws(store, "pea");391 if (!consume(ID, "const")) return;392 var ret = { type: "const", nullable: false };393 all_ws();394 var typ = primitive_type();395 if (!typ) {396 typ = consume(ID) || error("No type for const");397 typ = typ.value;398 }399 ret.idlType = typ;400 all_ws();401 if (consume(OTHER, "?")) {402 ret.nullable = true;403 all_ws();404 }405 var name = consume(ID) || error("No name for const");406 ret.name = name.value;407 all_ws();408 consume(OTHER, "=") || error("No value assignment for const");409 all_ws();410 var cnt = const_value();411 if (cnt) ret.value = cnt;412 else error("No value for const");413 all_ws();414 consume(OTHER, ";") || error("Unterminated const");415 return ret;416 };417 418 var inheritance = function () {419 all_ws();420 if (consume(OTHER, ":")) {421 all_ws();422 var inh = consume(ID) || error ("No type in inheritance");423 return inh.value;424 }425 };426 427 var operation_rest = function (ret, store) {428 all_ws();429 if (!ret) ret = {};430 var name = consume(ID);431 ret.name = name ? name.value : null;432 all_ws();433 consume(OTHER, "(") || error("Invalid operation");434 ret["arguments"] = argument_list(store) || [];435 all_ws();436 consume(OTHER, ")") || error("Unterminated operation");437 all_ws();438 consume(OTHER, ";") || error("Unterminated operation");439 return ret;440 };441 442 var callback = function (store) {443 all_ws(store, "pea");444 var ret;445 if (!consume(ID, "callback")) return;446 all_ws();447 var tok = consume(ID, "interface");448 if (tok) {449 tokens.unshift(tok);450 ret = interface_();451 ret.type = "callback interface";452 return ret;453 }454 var name = consume(ID) || error("No name for callback");455 ret = { type: "callback", name: name.value };456 all_ws();457 consume(OTHER, "=") || error("No assignment in callback");458 all_ws();459 ret.idlType = return_type();460 all_ws();461 consume(OTHER, "(") || error("No arguments in callback");462 ret["arguments"] = argument_list(store) || [];463 all_ws();464 consume(OTHER, ")") || error("Unterminated callback");465 all_ws();466 consume(OTHER, ";") || error("Unterminated callback");467 return ret;468 };469 var attribute = function (store) {470 all_ws(store, "pea");471 var grabbed = []472 , ret = {473 type: "attribute"474 , "static": false475 , stringifier: false476 , inherit: false477 , readonly: false478 };479 if (consume(ID, "static")) {480 ret["static"] = true;481 grabbed.push(last_token);482 }483 else if (consume(ID, "stringifier")) {484 ret.stringifier = true;485 grabbed.push(last_token);486 }487 var w = all_ws();488 if (w) grabbed.push(w);489 if (consume(ID, "inherit")) {490 if (ret["static"] || ret.stringifier) error("Cannot have a static or stringifier inherit");491 ret.inherit = true;492 grabbed.push(last_token);493 var w = all_ws();494 if (w) grabbed.push(w);495 }496 if (consume(ID, "readonly")) {497 ret.readonly = true;498 grabbed.push(last_token);499 var w = all_ws();500 if (w) grabbed.push(w);501 }502 if (!consume(ID, "attribute")) {503 tokens = grabbed.concat(tokens);504 return;505 }506 all_ws();507 ret.idlType = type() || error("No type in attribute");508 if (ret.idlType.sequence) error("Attributes cannot accept sequence types");509 all_ws();510 var name = consume(ID) || error("No name in attribute");511 ret.name = name.value;512 all_ws();513 consume(OTHER, ";") || error("Unterminated attribute");514 return ret;515 };516 517 var return_type = function () {518 var typ = type();519 if (!typ) {520 if (consume(ID, "void")) {521 return "void";522 }523 else error("No return type");524 }525 return typ;526 };527 528 var operation = function (store) {529 all_ws(store, "pea");530 var ret = {531 type: "operation"532 , getter: false533 , setter: false534 , creator: false535 , deleter: false536 , legacycaller: false537 , "static": false538 , stringifier: false539 };540 while (true) {541 all_ws();542 if (consume(ID, "getter")) ret.getter = true;543 else if (consume(ID, "setter")) ret.setter = true;544 else if (consume(ID, "creator")) ret.creator = true;545 else if (consume(ID, "deleter")) ret.deleter = true;546 else if (consume(ID, "legacycaller")) ret.legacycaller = true;547 else break;548 }549 if (ret.getter || ret.setter || ret.creator || ret.deleter || ret.legacycaller) {550 all_ws();551 ret.idlType = return_type();552 operation_rest(ret, store);553 return ret;554 }555 if (consume(ID, "static")) {556 ret["static"] = true;557 ret.idlType = return_type();558 operation_rest(ret, store);559 return ret;560 }561 else if (consume(ID, "stringifier")) {562 ret.stringifier = true;563 all_ws();564 if (consume(OTHER, ";")) return ret;565 ret.idlType = return_type();566 operation_rest(ret, store);567 return ret;568 }569 ret.idlType = return_type();570 all_ws();571 if (consume(ID, "iterator")) {572 all_ws();573 ret.type = "iterator";574 if (consume(ID, "object")) {575 ret.iteratorObject = "object";576 }577 else if (consume(OTHER, "=")) {578 all_ws();579 var name = consume(ID) || error("No right hand side in iterator");580 ret.iteratorObject = name.value;581 }582 all_ws();583 consume(OTHER, ";") || error("Unterminated iterator");584 return ret;585 }586 else {587 operation_rest(ret, store);588 return ret;589 }590 };591 592 var identifiers = function (arr) {593 while (true) {594 all_ws();595 if (consume(OTHER, ",")) {596 all_ws();597 var name = consume(ID) || error("Trailing comma in identifiers list");598 arr.push(name.value);599 }600 else break;601 }602 };603 604 var serialiser = function (store) {605 all_ws(store, "pea");606 if (!consume(ID, "serializer")) return;607 var ret = { type: "serializer" };608 all_ws();609 if (consume(OTHER, "=")) {610 all_ws();611 if (consume(OTHER, "{")) {612 ret.patternMap = true;613 all_ws();614 var id = consume(ID);615 if (id && id.value === "getter") {616 ret.names = ["getter"];617 }618 else if (id && id.value === "inherit") {619 ret.names = ["inherit"];620 identifiers(ret.names);621 }622 else if (id) {623 ret.names = [id.value];624 identifiers(ret.names);625 }626 else {627 ret.names = [];628 }629 all_ws();630 consume(OTHER, "}") || error("Unterminated serializer pattern map");631 }632 else if (consume(OTHER, "[")) {633 ret.patternList = true;634 all_ws();635 var id = consume(ID);636 if (id && id.value === "getter") {637 ret.names = ["getter"];638 }639 else if (id) {640 ret.names = [id.value];641 identifiers(ret.names);642 }643 else {644 ret.names = [];645 }646 all_ws();647 consume(OTHER, "]") || error("Unterminated serializer pattern list");648 }649 else {650 var name = consume(ID) || error("Invalid serializer");651 ret.name = name.value;652 }653 all_ws();654 consume(OTHER, ";") || error("Unterminated serializer");655 return ret;656 }657 else if (consume(OTHER, ";")) {658 // noop, just parsing659 }660 else {661 ret.idlType = return_type();662 all_ws();663 ret.operation = operation_rest(null, store);664 }665 return ret;666 };667 668 var interface_ = function (isPartial, store) {669 all_ws(isPartial ? null : store, "pea");670 if (!consume(ID, "interface")) return;671 all_ws();672 var name = consume(ID) || error("No name for interface");673 var mems = []674 , ret = {675 type: "interface"676 , name: name.value677 , partial: false678 , members: mems679 };680 if (!isPartial) ret.inheritance = inheritance() || null;681 all_ws();682 consume(OTHER, "{") || error("Bodyless interface");683 while (true) {684 all_ws(store ? mems : null);685 if (consume(OTHER, "}")) {686 all_ws();687 consume(OTHER, ";") || error("Missing semicolon after interface");688 return ret;689 }690 var ea = extended_attrs(store ? mems : null);691 all_ws();692 var cnt = const_(store ? mems : null);693 if (cnt) {694 cnt.extAttrs = ea;695 ret.members.push(cnt);696 continue;697 }698 var mem = serialiser(store ? mems : null) ||699 attribute(store ? mems : null) ||700 operation(store ? mems : null) ||701 error("Unknown member");702 mem.extAttrs = ea;703 ret.members.push(mem);704 }705 };706 707 var partial = function (store) {708 all_ws(store, "pea");709 if (!consume(ID, "partial")) return;710 var thing = dictionary(true, store) ||711 interface_(true, store) ||712 error("Partial doesn't apply to anything");713 thing.partial = true;714 return thing;715 };716 717 var dictionary = function (isPartial, store) {718 all_ws(isPartial ? null : store, "pea");719 if (!consume(ID, "dictionary")) return;720 all_ws();721 var name = consume(ID) || error("No name for dictionary");722 var mems = []723 , ret = {724 type: "dictionary"725 , name: name.value726 , partial: false727 , members: mems728 };729 if (!isPartial) ret.inheritance = inheritance() || null;730 all_ws();731 consume(OTHER, "{") || error("Bodyless dictionary");732 while (true) {733 all_ws(store ? mems : null);734 if (consume(OTHER, "}")) {735 all_ws();736 consume(OTHER, ";") || error("Missing semicolon after dictionary");737 return ret;738 }739 var ea = extended_attrs(store ? mems : null);740 all_ws(store ? mems : null, "pea");741 var typ = type() || error("No type for dictionary member");742 all_ws();743 var name = consume(ID) || error("No name for dictionary member");744 ret.members.push({745 type: "field"746 , name: name.value747 , idlType: typ748 , extAttrs: ea749 , "default": default_()750 });751 all_ws();752 consume(OTHER, ";") || error("Unterminated dictionary member");753 }754 };755 756 var exception = function (store) {757 all_ws(store, "pea");758 if (!consume(ID, "exception")) return;759 all_ws();760 var name = consume(ID) || error("No name for exception");761 var mems = []762 , ret = {763 type: "exception"764 , name: name.value765 , members: mems766 };767 ret.inheritance = inheritance() || null;768 all_ws();769 consume(OTHER, "{") || error("Bodyless exception");770 while (true) {771 all_ws(store ? mems : null);772 if (consume(OTHER, "}")) {773 all_ws();774 consume(OTHER, ";") || error("Missing semicolon after exception");775 return ret;776 }777 var ea = extended_attrs(store ? mems : null);778 all_ws(store ? mems : null, "pea");779 var cnt = const_();780 if (cnt) {781 cnt.extAttrs = ea;782 ret.members.push(cnt);783 }784 else {785 var typ = type();786 all_ws();787 var name = consume(ID);788 all_ws();789 if (!typ || !name || !consume(OTHER, ";")) error("Unknown member in exception body");790 ret.members.push({791 type: "field"792 , name: name.value793 , idlType: typ794 , extAttrs: ea795 });796 }797 }798 };799 800 var enum_ = function (store) {801 all_ws(store, "pea");802 if (!consume(ID, "enum")) return;803 all_ws();804 var name = consume(ID) || error("No name for enum");805 var vals = []806 , ret = {807 type: "enum"808 , name: name.value809 , values: vals810 };811 all_ws();812 consume(OTHER, "{") || error("No curly for enum");813 var saw_comma = false;814 while (true) {815 all_ws(store ? vals : null);816 if (consume(OTHER, "}")) {817 all_ws();818 if (saw_comma) error("Trailing comma in enum");819 consume(OTHER, ";") || error("No semicolon after enum");820 return ret;821 }822 var val = consume(STR) || error("Unexpected value in enum");823 ret.values.push(val.value.replace(/"/g, ""));824 all_ws(store ? vals : null);825 if (consume(OTHER, ",")) {826 if (store) vals.push({ type: "," });827 all_ws(store ? vals : null);828 saw_comma = true;829 }830 else {831 saw_comma = false;832 }833 }834 };835 836 var typedef = function (store) {837 all_ws(store, "pea");838 if (!consume(ID, "typedef")) return;839 var ret = {840 type: "typedef"841 };842 all_ws();843 ret.typeExtAttrs = extended_attrs();844 all_ws(store, "tpea");845 ret.idlType = type() || error("No type in typedef");846 all_ws();847 var name = consume(ID) || error("No name in typedef");848 ret.name = name.value;849 all_ws();850 consume(OTHER, ";") || error("Unterminated typedef");851 return ret;852 };853 854 var implements_ = function (store) {855 all_ws(store, "pea");856 var target = consume(ID);857 if (!target) return;858 var w = all_ws();859 if (consume(ID, "implements")) {860 var ret = {861 type: "implements"862 , target: target.value863 };864 all_ws();865 var imp = consume(ID) || error("Incomplete implements statement");866 ret["implements"] = imp.value;867 all_ws();868 consume(OTHER, ";") || error("No terminating ; for implements statement");869 return ret;870 }871 else {872 // rollback873 tokens.unshift(w);874 tokens.unshift(target);875 }876 };877 878 var definition = function (store) {879 return callback(store) ||880 interface_(false, store) ||881 partial(store) ||882 dictionary(false, store) ||883 exception(store) ||884 enum_(store) ||885 typedef(store) ||886 implements_(store)887 ;888 };889 890 var definitions = function (store) {891 if (!tokens.length) return [];892 var defs = [];893 while (true) {894 var ea = extended_attrs(store ? defs : null)895 , def = definition(store ? defs : null);896 if (!def) {897 if (ea.length) error("Stray extended attributes");898 break;899 }900 def.extAttrs = ea;901 defs.push(def);902 }903 return defs;904 };905 var res = definitions(opt.ws);906 if (tokens.length) error("Unrecognised tokens");907 return res;908 };909 var inNode = typeof module !== "undefined" && module.exports910 , obj = {911 parse: function (str, opt) {912 if (!opt) opt = {};913 var tokens = tokenise(str);914 return parse(tokens, opt);915 }916 };917 if (inNode) module.exports = obj;918 else self.WebIDL2 = obj;...

Full Screen

Full Screen

capi_maps.py

Source:capi_maps.py Github

copy

Full Screen

1#!/usr/bin/env python2"""3Copyright 1999,2000 Pearu Peterson all rights reserved,4Pearu Peterson <pearu@ioc.ee>5Permission to use, modify, and distribute this software is given under the6terms of the NumPy License.7NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.8$Date: 2005/05/06 10:57:33 $9Pearu Peterson10"""11from __future__ import division, absolute_import, print_function12__version__ = "$Revision: 1.60 $"[10:-1]13from . import __version__14f2py_version = __version__.version15import copy16import re17import os18import sys19from .crackfortran import markoutercomma20from . import cb_rules21# The eviroment provided by auxfuncs.py is needed for some calls to eval.22# As the needed functions cannot be determined by static inspection of the23# code, it is safest to use import * pending a major refactoring of f2py.24from .auxfuncs import *25__all__ = [26 'getctype', 'getstrlength', 'getarrdims', 'getpydocsign',27 'getarrdocsign', 'getinit', 'sign2map', 'routsign2map', 'modsign2map',28 'cb_sign2map', 'cb_routsign2map', 'common_sign2map'29]30# Numarray and Numeric users should set this False31using_newcore = True32depargs = []33lcb_map = {}34lcb2_map = {}35# forced casting: mainly caused by the fact that Python or Numeric36# C/APIs do not support the corresponding C types.37c2py_map = {'double': 'float',38 'float': 'float', # forced casting39 'long_double': 'float', # forced casting40 'char': 'int', # forced casting41 'signed_char': 'int', # forced casting42 'unsigned_char': 'int', # forced casting43 'short': 'int', # forced casting44 'unsigned_short': 'int', # forced casting45 'int': 'int', # (forced casting)46 'long': 'int',47 'long_long': 'long',48 'unsigned': 'int', # forced casting49 'complex_float': 'complex', # forced casting50 'complex_double': 'complex',51 'complex_long_double': 'complex', # forced casting52 'string': 'string',53 }54c2capi_map = {'double': 'NPY_DOUBLE',55 'float': 'NPY_FLOAT',56 'long_double': 'NPY_DOUBLE', # forced casting57 'char': 'NPY_STRING',58 'unsigned_char': 'NPY_UBYTE',59 'signed_char': 'NPY_BYTE',60 'short': 'NPY_SHORT',61 'unsigned_short': 'NPY_USHORT',62 'int': 'NPY_INT',63 'unsigned': 'NPY_UINT',64 'long': 'NPY_LONG',65 'long_long': 'NPY_LONG', # forced casting66 'complex_float': 'NPY_CFLOAT',67 'complex_double': 'NPY_CDOUBLE',68 'complex_long_double': 'NPY_CDOUBLE', # forced casting69 'string': 'NPY_STRING'}70# These new maps aren't used anyhere yet, but should be by default71# unless building numeric or numarray extensions.72if using_newcore:73 c2capi_map = {'double': 'NPY_DOUBLE',74 'float': 'NPY_FLOAT',75 'long_double': 'NPY_LONGDOUBLE',76 'char': 'NPY_BYTE',77 'unsigned_char': 'NPY_UBYTE',78 'signed_char': 'NPY_BYTE',79 'short': 'NPY_SHORT',80 'unsigned_short': 'NPY_USHORT',81 'int': 'NPY_INT',82 'unsigned': 'NPY_UINT',83 'long': 'NPY_LONG',84 'unsigned_long': 'NPY_ULONG',85 'long_long': 'NPY_LONGLONG',86 'unsigned_long_long': 'NPY_ULONGLONG',87 'complex_float': 'NPY_CFLOAT',88 'complex_double': 'NPY_CDOUBLE',89 'complex_long_double': 'NPY_CDOUBLE',90 'string':'NPY_STRING'91 }92c2pycode_map = {'double': 'd',93 'float': 'f',94 'long_double': 'd', # forced casting95 'char': '1',96 'signed_char': '1',97 'unsigned_char': 'b',98 'short': 's',99 'unsigned_short': 'w',100 'int': 'i',101 'unsigned': 'u',102 'long': 'l',103 'long_long': 'L',104 'complex_float': 'F',105 'complex_double': 'D',106 'complex_long_double': 'D', # forced casting107 'string': 'c'108 }109if using_newcore:110 c2pycode_map = {'double': 'd',111 'float': 'f',112 'long_double': 'g',113 'char': 'b',114 'unsigned_char': 'B',115 'signed_char': 'b',116 'short': 'h',117 'unsigned_short': 'H',118 'int': 'i',119 'unsigned': 'I',120 'long': 'l',121 'unsigned_long': 'L',122 'long_long': 'q',123 'unsigned_long_long': 'Q',124 'complex_float': 'F',125 'complex_double': 'D',126 'complex_long_double': 'G',127 'string': 'S'}128c2buildvalue_map = {'double': 'd',129 'float': 'f',130 'char': 'b',131 'signed_char': 'b',132 'short': 'h',133 'int': 'i',134 'long': 'l',135 'long_long': 'L',136 'complex_float': 'N',137 'complex_double': 'N',138 'complex_long_double': 'N',139 'string': 'z'}140if sys.version_info[0] >= 3:141 # Bytes, not Unicode strings142 c2buildvalue_map['string'] = 'y'143if using_newcore:144 # c2buildvalue_map=???145 pass146f2cmap_all = {'real': {'': 'float', '4': 'float', '8': 'double',147 '12': 'long_double', '16': 'long_double'},148 'integer': {'': 'int', '1': 'signed_char', '2': 'short',149 '4': 'int', '8': 'long_long',150 '-1': 'unsigned_char', '-2': 'unsigned_short',151 '-4': 'unsigned', '-8': 'unsigned_long_long'},152 'complex': {'': 'complex_float', '8': 'complex_float',153 '16': 'complex_double', '24': 'complex_long_double',154 '32': 'complex_long_double'},155 'complexkind': {'': 'complex_float', '4': 'complex_float',156 '8': 'complex_double', '12': 'complex_long_double',157 '16': 'complex_long_double'},158 'logical': {'': 'int', '1': 'char', '2': 'short', '4': 'int',159 '8': 'long_long'},160 'double complex': {'': 'complex_double'},161 'double precision': {'': 'double'},162 'byte': {'': 'char'},163 'character': {'': 'string'}164 }165if os.path.isfile('.f2py_f2cmap'):166 # User defined additions to f2cmap_all.167 # .f2py_f2cmap must contain a dictionary of dictionaries, only. For168 # example, {'real':{'low':'float'}} means that Fortran 'real(low)' is169 # interpreted as C 'float'. This feature is useful for F90/95 users if170 # they use PARAMETERSs in type specifications.171 try:172 outmess('Reading .f2py_f2cmap ...\n')173 f = open('.f2py_f2cmap', 'r')174 d = eval(f.read(), {}, {})175 f.close()176 for k, d1 in list(d.items()):177 for k1 in list(d1.keys()):178 d1[k1.lower()] = d1[k1]179 d[k.lower()] = d[k]180 for k in list(d.keys()):181 if k not in f2cmap_all:182 f2cmap_all[k] = {}183 for k1 in list(d[k].keys()):184 if d[k][k1] in c2py_map:185 if k1 in f2cmap_all[k]:186 outmess(187 "\tWarning: redefinition of {'%s':{'%s':'%s'->'%s'}}\n" % (k, k1, f2cmap_all[k][k1], d[k][k1]))188 f2cmap_all[k][k1] = d[k][k1]189 outmess('\tMapping "%s(kind=%s)" to "%s"\n' %190 (k, k1, d[k][k1]))191 else:192 errmess("\tIgnoring map {'%s':{'%s':'%s'}}: '%s' must be in %s\n" % (193 k, k1, d[k][k1], d[k][k1], list(c2py_map.keys())))194 outmess('Successfully applied user defined changes from .f2py_f2cmap\n')195 except Exception as msg:196 errmess(197 'Failed to apply user defined changes from .f2py_f2cmap: %s. Skipping.\n' % (msg))198cformat_map = {'double': '%g',199 'float': '%g',200 'long_double': '%Lg',201 'char': '%d',202 'signed_char': '%d',203 'unsigned_char': '%hhu',204 'short': '%hd',205 'unsigned_short': '%hu',206 'int': '%d',207 'unsigned': '%u',208 'long': '%ld',209 'unsigned_long': '%lu',210 'long_long': '%ld',211 'complex_float': '(%g,%g)',212 'complex_double': '(%g,%g)',213 'complex_long_double': '(%Lg,%Lg)',214 'string': '%s',215 }216# Auxiliary functions217def getctype(var):218 """219 Determines C type220 """221 ctype = 'void'222 if isfunction(var):223 if 'result' in var:224 a = var['result']225 else:226 a = var['name']227 if a in var['vars']:228 return getctype(var['vars'][a])229 else:230 errmess('getctype: function %s has no return value?!\n' % a)231 elif issubroutine(var):232 return ctype233 elif 'typespec' in var and var['typespec'].lower() in f2cmap_all:234 typespec = var['typespec'].lower()235 f2cmap = f2cmap_all[typespec]236 ctype = f2cmap[''] # default type237 if 'kindselector' in var:238 if '*' in var['kindselector']:239 try:240 ctype = f2cmap[var['kindselector']['*']]241 except KeyError:242 errmess('getctype: "%s %s %s" not supported.\n' %243 (var['typespec'], '*', var['kindselector']['*']))244 elif 'kind' in var['kindselector']:245 if typespec + 'kind' in f2cmap_all:246 f2cmap = f2cmap_all[typespec + 'kind']247 try:248 ctype = f2cmap[var['kindselector']['kind']]249 except KeyError:250 if typespec in f2cmap_all:251 f2cmap = f2cmap_all[typespec]252 try:253 ctype = f2cmap[str(var['kindselector']['kind'])]254 except KeyError:255 errmess('getctype: "%s(kind=%s)" is mapped to C "%s" (to override define dict(%s = dict(%s="<C typespec>")) in %s/.f2py_f2cmap file).\n'256 % (typespec, var['kindselector']['kind'], ctype,257 typespec, var['kindselector']['kind'], os.getcwd()))258 else:259 if not isexternal(var):260 errmess(261 'getctype: No C-type found in "%s", assuming void.\n' % var)262 return ctype263def getstrlength(var):264 if isstringfunction(var):265 if 'result' in var:266 a = var['result']267 else:268 a = var['name']269 if a in var['vars']:270 return getstrlength(var['vars'][a])271 else:272 errmess('getstrlength: function %s has no return value?!\n' % a)273 if not isstring(var):274 errmess(275 'getstrlength: expected a signature of a string but got: %s\n' % (repr(var)))276 len = '1'277 if 'charselector' in var:278 a = var['charselector']279 if '*' in a:280 len = a['*']281 elif 'len' in a:282 len = a['len']283 if re.match(r'\(\s*([*]|[:])\s*\)', len) or re.match(r'([*]|[:])', len):284 if isintent_hide(var):285 errmess('getstrlength:intent(hide): expected a string with defined length but got: %s\n' % (286 repr(var)))287 len = '-1'288 return len289def getarrdims(a, var, verbose=0):290 global depargs291 ret = {}292 if isstring(var) and not isarray(var):293 ret['dims'] = getstrlength(var)294 ret['size'] = ret['dims']295 ret['rank'] = '1'296 elif isscalar(var):297 ret['size'] = '1'298 ret['rank'] = '0'299 ret['dims'] = ''300 elif isarray(var):301 dim = copy.copy(var['dimension'])302 ret['size'] = '*'.join(dim)303 try:304 ret['size'] = repr(eval(ret['size']))305 except Exception:306 pass307 ret['dims'] = ','.join(dim)308 ret['rank'] = repr(len(dim))309 ret['rank*[-1]'] = repr(len(dim) * [-1])[1:-1]310 for i in range(len(dim)): # solve dim for dependecies311 v = []312 if dim[i] in depargs:313 v = [dim[i]]314 else:315 for va in depargs:316 if re.match(r'.*?\b%s\b.*' % va, dim[i]):317 v.append(va)318 for va in v:319 if depargs.index(va) > depargs.index(a):320 dim[i] = '*'321 break322 ret['setdims'], i = '', -1323 for d in dim:324 i = i + 1325 if d not in ['*', ':', '(*)', '(:)']:326 ret['setdims'] = '%s#varname#_Dims[%d]=%s,' % (327 ret['setdims'], i, d)328 if ret['setdims']:329 ret['setdims'] = ret['setdims'][:-1]330 ret['cbsetdims'], i = '', -1331 for d in var['dimension']:332 i = i + 1333 if d not in ['*', ':', '(*)', '(:)']:334 ret['cbsetdims'] = '%s#varname#_Dims[%d]=%s,' % (335 ret['cbsetdims'], i, d)336 elif isintent_in(var):337 outmess('getarrdims:warning: assumed shape array, using 0 instead of %r\n'338 % (d))339 ret['cbsetdims'] = '%s#varname#_Dims[%d]=%s,' % (340 ret['cbsetdims'], i, 0)341 elif verbose:342 errmess(343 'getarrdims: If in call-back function: array argument %s must have bounded dimensions: got %s\n' % (repr(a), repr(d)))344 if ret['cbsetdims']:345 ret['cbsetdims'] = ret['cbsetdims'][:-1]346# if not isintent_c(var):347# var['dimension'].reverse()348 return ret349def getpydocsign(a, var):350 global lcb_map351 if isfunction(var):352 if 'result' in var:353 af = var['result']354 else:355 af = var['name']356 if af in var['vars']:357 return getpydocsign(af, var['vars'][af])358 else:359 errmess('getctype: function %s has no return value?!\n' % af)360 return '', ''361 sig, sigout = a, a362 opt = ''363 if isintent_in(var):364 opt = 'input'365 elif isintent_inout(var):366 opt = 'in/output'367 out_a = a368 if isintent_out(var):369 for k in var['intent']:370 if k[:4] == 'out=':371 out_a = k[4:]372 break373 init = ''374 ctype = getctype(var)375 if hasinitvalue(var):376 init, showinit = getinit(a, var)377 init = ', optional\\n Default: %s' % showinit378 if isscalar(var):379 if isintent_inout(var):380 sig = '%s : %s rank-0 array(%s,\'%s\')%s' % (a, opt, c2py_map[ctype],381 c2pycode_map[ctype], init)382 else:383 sig = '%s : %s %s%s' % (a, opt, c2py_map[ctype], init)384 sigout = '%s : %s' % (out_a, c2py_map[ctype])385 elif isstring(var):386 if isintent_inout(var):387 sig = '%s : %s rank-0 array(string(len=%s),\'c\')%s' % (388 a, opt, getstrlength(var), init)389 else:390 sig = '%s : %s string(len=%s)%s' % (391 a, opt, getstrlength(var), init)392 sigout = '%s : string(len=%s)' % (out_a, getstrlength(var))393 elif isarray(var):394 dim = var['dimension']395 rank = repr(len(dim))396 sig = '%s : %s rank-%s array(\'%s\') with bounds (%s)%s' % (a, opt, rank,397 c2pycode_map[398 ctype],399 ','.join(dim), init)400 if a == out_a:401 sigout = '%s : rank-%s array(\'%s\') with bounds (%s)'\402 % (a, rank, c2pycode_map[ctype], ','.join(dim))403 else:404 sigout = '%s : rank-%s array(\'%s\') with bounds (%s) and %s storage'\405 % (out_a, rank, c2pycode_map[ctype], ','.join(dim), a)406 elif isexternal(var):407 ua = ''408 if a in lcb_map and lcb_map[a] in lcb2_map and 'argname' in lcb2_map[lcb_map[a]]:409 ua = lcb2_map[lcb_map[a]]['argname']410 if not ua == a:411 ua = ' => %s' % ua412 else:413 ua = ''414 sig = '%s : call-back function%s' % (a, ua)415 sigout = sig416 else:417 errmess(418 'getpydocsign: Could not resolve docsignature for "%s".\\n' % a)419 return sig, sigout420def getarrdocsign(a, var):421 ctype = getctype(var)422 if isstring(var) and (not isarray(var)):423 sig = '%s : rank-0 array(string(len=%s),\'c\')' % (a,424 getstrlength(var))425 elif isscalar(var):426 sig = '%s : rank-0 array(%s,\'%s\')' % (a, c2py_map[ctype],427 c2pycode_map[ctype],)428 elif isarray(var):429 dim = var['dimension']430 rank = repr(len(dim))431 sig = '%s : rank-%s array(\'%s\') with bounds (%s)' % (a, rank,432 c2pycode_map[433 ctype],434 ','.join(dim))435 return sig436def getinit(a, var):437 if isstring(var):438 init, showinit = '""', "''"439 else:440 init, showinit = '', ''441 if hasinitvalue(var):442 init = var['=']443 showinit = init444 if iscomplex(var) or iscomplexarray(var):445 ret = {}446 try:447 v = var["="]448 if ',' in v:449 ret['init.r'], ret['init.i'] = markoutercomma(450 v[1:-1]).split('@,@')451 else:452 v = eval(v, {}, {})453 ret['init.r'], ret['init.i'] = str(v.real), str(v.imag)454 except Exception:455 raise ValueError(456 'getinit: expected complex number `(r,i)\' but got `%s\' as initial value of %r.' % (init, a))457 if isarray(var):458 init = '(capi_c.r=%s,capi_c.i=%s,capi_c)' % (459 ret['init.r'], ret['init.i'])460 elif isstring(var):461 if not init:462 init, showinit = '""', "''"463 if init[0] == "'":464 init = '"%s"' % (init[1:-1].replace('"', '\\"'))465 if init[0] == '"':466 showinit = "'%s'" % (init[1:-1])467 return init, showinit468def sign2map(a, var):469 """470 varname,ctype,atype471 init,init.r,init.i,pytype472 vardebuginfo,vardebugshowvalue,varshowvalue473 varrfromat474 intent475 """476 global lcb_map, cb_map477 out_a = a478 if isintent_out(var):479 for k in var['intent']:480 if k[:4] == 'out=':481 out_a = k[4:]482 break483 ret = {'varname': a, 'outvarname': out_a, 'ctype': getctype(var)}484 intent_flags = []485 for f, s in isintent_dict.items():486 if f(var):487 intent_flags.append('F2PY_%s' % s)488 if intent_flags:489 # XXX: Evaluate intent_flags here.490 ret['intent'] = '|'.join(intent_flags)491 else:492 ret['intent'] = 'F2PY_INTENT_IN'493 if isarray(var):494 ret['varrformat'] = 'N'495 elif ret['ctype'] in c2buildvalue_map:496 ret['varrformat'] = c2buildvalue_map[ret['ctype']]497 else:498 ret['varrformat'] = 'O'499 ret['init'], ret['showinit'] = getinit(a, var)500 if hasinitvalue(var) and iscomplex(var) and not isarray(var):501 ret['init.r'], ret['init.i'] = markoutercomma(502 ret['init'][1:-1]).split('@,@')503 if isexternal(var):504 ret['cbnamekey'] = a505 if a in lcb_map:506 ret['cbname'] = lcb_map[a]507 ret['maxnofargs'] = lcb2_map[lcb_map[a]]['maxnofargs']508 ret['nofoptargs'] = lcb2_map[lcb_map[a]]['nofoptargs']509 ret['cbdocstr'] = lcb2_map[lcb_map[a]]['docstr']510 ret['cblatexdocstr'] = lcb2_map[lcb_map[a]]['latexdocstr']511 else:512 ret['cbname'] = a513 errmess('sign2map: Confused: external %s is not in lcb_map%s.\n' % (514 a, list(lcb_map.keys())))515 if isstring(var):516 ret['length'] = getstrlength(var)517 if isarray(var):518 ret = dictappend(ret, getarrdims(a, var))519 dim = copy.copy(var['dimension'])520 if ret['ctype'] in c2capi_map:521 ret['atype'] = c2capi_map[ret['ctype']]522 # Debug info523 if debugcapi(var):524 il = [isintent_in, 'input', isintent_out, 'output',525 isintent_inout, 'inoutput', isrequired, 'required',526 isoptional, 'optional', isintent_hide, 'hidden',527 iscomplex, 'complex scalar',528 l_and(isscalar, l_not(iscomplex)), 'scalar',529 isstring, 'string', isarray, 'array',530 iscomplexarray, 'complex array', isstringarray, 'string array',531 iscomplexfunction, 'complex function',532 l_and(isfunction, l_not(iscomplexfunction)), 'function',533 isexternal, 'callback',534 isintent_callback, 'callback',535 isintent_aux, 'auxiliary',536 ]537 rl = []538 for i in range(0, len(il), 2):539 if il[i](var):540 rl.append(il[i + 1])541 if isstring(var):542 rl.append('slen(%s)=%s' % (a, ret['length']))543 if isarray(var):544 ddim = ','.join(545 map(lambda x, y: '%s|%s' % (x, y), var['dimension'], dim))546 rl.append('dims(%s)' % ddim)547 if isexternal(var):548 ret['vardebuginfo'] = 'debug-capi:%s=>%s:%s' % (549 a, ret['cbname'], ','.join(rl))550 else:551 ret['vardebuginfo'] = 'debug-capi:%s %s=%s:%s' % (552 ret['ctype'], a, ret['showinit'], ','.join(rl))553 if isscalar(var):554 if ret['ctype'] in cformat_map:555 ret['vardebugshowvalue'] = 'debug-capi:%s=%s' % (556 a, cformat_map[ret['ctype']])557 if isstring(var):558 ret['vardebugshowvalue'] = 'debug-capi:slen(%s)=%%d %s=\\"%%s\\"' % (559 a, a)560 if isexternal(var):561 ret['vardebugshowvalue'] = 'debug-capi:%s=%%p' % (a)562 if ret['ctype'] in cformat_map:563 ret['varshowvalue'] = '#name#:%s=%s' % (a, cformat_map[ret['ctype']])564 ret['showvalueformat'] = '%s' % (cformat_map[ret['ctype']])565 if isstring(var):566 ret['varshowvalue'] = '#name#:slen(%s)=%%d %s=\\"%%s\\"' % (a, a)567 ret['pydocsign'], ret['pydocsignout'] = getpydocsign(a, var)568 if hasnote(var):569 ret['note'] = var['note']570 return ret571def routsign2map(rout):572 """573 name,NAME,begintitle,endtitle574 rname,ctype,rformat575 routdebugshowvalue576 """577 global lcb_map578 name = rout['name']579 fname = getfortranname(rout)580 ret = {'name': name,581 'texname': name.replace('_', '\\_'),582 'name_lower': name.lower(),583 'NAME': name.upper(),584 'begintitle': gentitle(name),585 'endtitle': gentitle('end of %s' % name),586 'fortranname': fname,587 'FORTRANNAME': fname.upper(),588 'callstatement': getcallstatement(rout) or '',589 'usercode': getusercode(rout) or '',590 'usercode1': getusercode1(rout) or '',591 }592 if '_' in fname:593 ret['F_FUNC'] = 'F_FUNC_US'594 else:595 ret['F_FUNC'] = 'F_FUNC'596 if '_' in name:597 ret['F_WRAPPEDFUNC'] = 'F_WRAPPEDFUNC_US'598 else:599 ret['F_WRAPPEDFUNC'] = 'F_WRAPPEDFUNC'600 lcb_map = {}601 if 'use' in rout:602 for u in rout['use'].keys():603 if u in cb_rules.cb_map:604 for un in cb_rules.cb_map[u]:605 ln = un[0]606 if 'map' in rout['use'][u]:607 for k in rout['use'][u]['map'].keys():608 if rout['use'][u]['map'][k] == un[0]:609 ln = k610 break611 lcb_map[ln] = un[1]612 elif 'externals' in rout and rout['externals']:613 errmess('routsign2map: Confused: function %s has externals %s but no "use" statement.\n' % (614 ret['name'], repr(rout['externals'])))615 ret['callprotoargument'] = getcallprotoargument(rout, lcb_map) or ''616 if isfunction(rout):617 if 'result' in rout:618 a = rout['result']619 else:620 a = rout['name']621 ret['rname'] = a622 ret['pydocsign'], ret['pydocsignout'] = getpydocsign(a, rout)623 ret['ctype'] = getctype(rout['vars'][a])624 if hasresultnote(rout):625 ret['resultnote'] = rout['vars'][a]['note']626 rout['vars'][a]['note'] = ['See elsewhere.']627 if ret['ctype'] in c2buildvalue_map:628 ret['rformat'] = c2buildvalue_map[ret['ctype']]629 else:630 ret['rformat'] = 'O'631 errmess('routsign2map: no c2buildvalue key for type %s\n' %632 (repr(ret['ctype'])))633 if debugcapi(rout):634 if ret['ctype'] in cformat_map:635 ret['routdebugshowvalue'] = 'debug-capi:%s=%s' % (636 a, cformat_map[ret['ctype']])637 if isstringfunction(rout):638 ret['routdebugshowvalue'] = 'debug-capi:slen(%s)=%%d %s=\\"%%s\\"' % (639 a, a)640 if isstringfunction(rout):641 ret['rlength'] = getstrlength(rout['vars'][a])642 if ret['rlength'] == '-1':643 errmess('routsign2map: expected explicit specification of the length of the string returned by the fortran function %s; taking 10.\n' % (644 repr(rout['name'])))645 ret['rlength'] = '10'646 if hasnote(rout):647 ret['note'] = rout['note']648 rout['note'] = ['See elsewhere.']649 return ret650def modsign2map(m):651 """652 modulename653 """654 if ismodule(m):655 ret = {'f90modulename': m['name'],656 'F90MODULENAME': m['name'].upper(),657 'texf90modulename': m['name'].replace('_', '\\_')}658 else:659 ret = {'modulename': m['name'],660 'MODULENAME': m['name'].upper(),661 'texmodulename': m['name'].replace('_', '\\_')}662 ret['restdoc'] = getrestdoc(m) or []663 if hasnote(m):664 ret['note'] = m['note']665 ret['usercode'] = getusercode(m) or ''666 ret['usercode1'] = getusercode1(m) or ''667 if m['body']:668 ret['interface_usercode'] = getusercode(m['body'][0]) or ''669 else:670 ret['interface_usercode'] = ''671 ret['pymethoddef'] = getpymethoddef(m) or ''672 if 'coutput' in m:673 ret['coutput'] = m['coutput']674 if 'f2py_wrapper_output' in m:675 ret['f2py_wrapper_output'] = m['f2py_wrapper_output']676 return ret677def cb_sign2map(a, var, index=None):678 ret = {'varname': a}679 if index is None or 1: # disable 7712 patch680 ret['varname_i'] = ret['varname']681 else:682 ret['varname_i'] = ret['varname'] + '_' + str(index)683 ret['ctype'] = getctype(var)684 if ret['ctype'] in c2capi_map:685 ret['atype'] = c2capi_map[ret['ctype']]686 if ret['ctype'] in cformat_map:687 ret['showvalueformat'] = '%s' % (cformat_map[ret['ctype']])688 if isarray(var):689 ret = dictappend(ret, getarrdims(a, var))690 ret['pydocsign'], ret['pydocsignout'] = getpydocsign(a, var)691 if hasnote(var):692 ret['note'] = var['note']693 var['note'] = ['See elsewhere.']694 return ret695def cb_routsign2map(rout, um):696 """697 name,begintitle,endtitle,argname698 ctype,rctype,maxnofargs,nofoptargs,returncptr699 """700 ret = {'name': 'cb_%s_in_%s' % (rout['name'], um),701 'returncptr': ''}702 if isintent_callback(rout):703 if '_' in rout['name']:704 F_FUNC = 'F_FUNC_US'705 else:706 F_FUNC = 'F_FUNC'707 ret['callbackname'] = '%s(%s,%s)' \708 % (F_FUNC,709 rout['name'].lower(),710 rout['name'].upper(),711 )712 ret['static'] = 'extern'713 else:714 ret['callbackname'] = ret['name']715 ret['static'] = 'static'716 ret['argname'] = rout['name']717 ret['begintitle'] = gentitle(ret['name'])718 ret['endtitle'] = gentitle('end of %s' % ret['name'])719 ret['ctype'] = getctype(rout)720 ret['rctype'] = 'void'721 if ret['ctype'] == 'string':722 ret['rctype'] = 'void'723 else:724 ret['rctype'] = ret['ctype']725 if ret['rctype'] != 'void':726 if iscomplexfunction(rout):727 ret['returncptr'] = """728#ifdef F2PY_CB_RETURNCOMPLEX729return_value=730#endif731"""732 else:733 ret['returncptr'] = 'return_value='734 if ret['ctype'] in cformat_map:735 ret['showvalueformat'] = '%s' % (cformat_map[ret['ctype']])736 if isstringfunction(rout):737 ret['strlength'] = getstrlength(rout)738 if isfunction(rout):739 if 'result' in rout:740 a = rout['result']741 else:742 a = rout['name']743 if hasnote(rout['vars'][a]):744 ret['note'] = rout['vars'][a]['note']745 rout['vars'][a]['note'] = ['See elsewhere.']746 ret['rname'] = a747 ret['pydocsign'], ret['pydocsignout'] = getpydocsign(a, rout)748 if iscomplexfunction(rout):749 ret['rctype'] = """750#ifdef F2PY_CB_RETURNCOMPLEX751#ctype#752#else753void754#endif755"""756 else:757 if hasnote(rout):758 ret['note'] = rout['note']759 rout['note'] = ['See elsewhere.']760 nofargs = 0761 nofoptargs = 0762 if 'args' in rout and 'vars' in rout:763 for a in rout['args']:764 var = rout['vars'][a]765 if l_or(isintent_in, isintent_inout)(var):766 nofargs = nofargs + 1767 if isoptional(var):768 nofoptargs = nofoptargs + 1769 ret['maxnofargs'] = repr(nofargs)770 ret['nofoptargs'] = repr(nofoptargs)771 if hasnote(rout) and isfunction(rout) and 'result' in rout:772 ret['routnote'] = rout['note']773 rout['note'] = ['See elsewhere.']774 return ret775def common_sign2map(a, var): # obsolute776 ret = {'varname': a, 'ctype': getctype(var)}777 if isstringarray(var):778 ret['ctype'] = 'char'779 if ret['ctype'] in c2capi_map:780 ret['atype'] = c2capi_map[ret['ctype']]781 if ret['ctype'] in cformat_map:782 ret['showvalueformat'] = '%s' % (cformat_map[ret['ctype']])783 if isarray(var):784 ret = dictappend(ret, getarrdims(a, var))785 elif isstring(var):786 ret['size'] = getstrlength(var)787 ret['rank'] = '1'788 ret['pydocsign'], ret['pydocsignout'] = getpydocsign(a, var)789 if hasnote(var):790 ret['note'] = var['note']791 var['note'] = ['See elsewhere.']792 # for strings this returns 0-rank but actually is 1-rank793 ret['arrdocstr'] = getarrdocsign(a, var)...

Full Screen

Full Screen

connector.py

Source:connector.py Github

copy

Full Screen

1import os2from django.conf import settings3from django.utils import unittest4from elfinder.conf import settings as ls5from elfinder.connector import ElfinderConnector6from elfinder.exceptions import ElfinderErrorMessages7class ConnectorInitTestCase(unittest.TestCase):8 9 def setUp(self):10 settings.MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'media') 11 12 def test_init(self):13 """14 Test the ElfinderConnector __init__ method15 """16 #fault-tolerant initialization17 connector = ElfinderConnector({})18 self.assertEqual(connector.loaded(), False)19 20 connector = ElfinderConnector({})21 self.assertEqual(connector.loaded(), False)22 23 #initialize with 'default' optionset24 connector = ElfinderConnector(ls.ELFINDER_CONNECTOR_OPTION_SETS['default'])25 self.assertEqual(connector.loaded(), True)26 27 def test_execute(self):28 """29 Test the execute method.30 """31 32 #test invalid configuration33 connector = ElfinderConnector({})34 self.assertEqual(ElfinderErrorMessages.ERROR_CONF in connector.execute('open')['error'], True)35 36 connector = ElfinderConnector(ls.ELFINDER_CONNECTOR_OPTION_SETS['default'])37 #test invalid command38 self.assertEqual(ElfinderErrorMessages.ERROR_UNKNOWN_CMD in connector.execute('dummy')['error'], True)39 #test missing arguments40 self.assertEqual(ElfinderErrorMessages.ERROR_INV_PARAMS in connector.execute('ls')['error'], True)41 #test it is actually doing something42 self.assertEqual('error' in connector.execute('open', mimes=['image'], init=True), False)43 #test debug keyword44 self.assertEqual('debug' in connector.execute('open', init=True), False)45 self.assertEqual('debug' in connector.execute('open', init=True, debug=True), True)46class ConnectorEVLFOpen(unittest.TestCase):47 """48 Test that open command is implemented and behaves as expected. It also checks the response's conformance with49 the `elfinder 2.1 Server API specification <https://github.com/Studio-42/elFinder/wiki/Client-Server-API-2.1>`_50 """51 52 def setUp(self):53 settings.MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'media')54 55 self.opts = ls.ELFINDER_CONNECTOR_OPTION_SETS['default'].copy()56 self.opts['roots'][0]['path'] = settings.MEDIA_ROOT57 self.opts['roots'][0]['URL'] = settings.MEDIA_URL58 59 self.maxDiff = None60 def test_open_specs(self):61 """62 Test the command compiles to the API specification63 """64 65 connector = ElfinderConnector(self.opts)66 #command accepts the specification arguments67 argslist = connector.commandArgsList('open')68 self.assertIn('target', argslist)69 self.assertIn('init', argslist)70 self.assertIn('tree', argslist)71 self.assertIn('mimes', argslist)72 73 #test invalid keyword arguments74 self.assertEqual(ElfinderErrorMessages.ERROR_INV_PARAMS in connector.execute('open')['error'], True)75 76 #test invalid target77 self.assertEqual(ElfinderErrorMessages.ERROR_OPEN in connector.execute('open', target='dummy')['error'], True)78 79 def test_open_default(self):80 """81 Test the default optionset82 """83 84 connector = ElfinderConnector(self.opts)85 86 #************ init without tree ***********87 ret = connector.execute('open', target='dummy', init='1')88 #check files and cwd89 self.assertEqual(len(ret['files']), 2)90 self.assertNotEqual(ret['files'][0]['hash'], ret['files'][1]['hash'])91 self.assertEqual(ret['files'][0]['name'], 'files')92 self.assertEqual(ret['files'][1]['name'], 'test')93 self.assertEqual(ret['cwd']['dirs'], 1)94 self.assertEqual(ret['cwd']['name'], connector._default._root_name)95 self.assertEqual(ret['cwd']['read'], 1)96 self.assertEqual(ret['cwd']['write'], 1)97 self.assertEqual(ret['cwd']['locked'], 1)98 self.assertEqual(ret['cwd']['hidden'], 0)99 self.assertEqual(ret['cwd']['size'], 'unknown')100 self.assertEqual(ret['cwd']['mime'], 'directory')101 self.assertEqual(ret['cwd']['volumeid'], 'llff_')102 self.assertIsInstance(ret['cwd']['ts'], float)103 self.assertNotIn('phash', ret['cwd'])104 self.assertGreater(len(ret['cwd']['hash']), 0)105 106 #other response attributes107 self.assertNotIn('error', ret)108 self.assertIn('netDrivers', ret)109 self.assertEqual(ret['uplMaxSize'], 128 * 1048576)110 self.assertEqual(ret['api'], '2.1')111 self.assertEqual(ret['options']['pathUrl'], settings.MEDIA_URL)112 self.assertEqual(ret['options']['tmbUrl'], '%s.tmb/' % settings.MEDIA_URL)113 self.assertIn('create', ret['options']['archivers'])114 self.assertIn('extract', ret['options']['archivers'])115 self.assertEqual(ret['options']['disabled'], [])116 self.assertEqual(ret['options']['copyOverwrite'], 1)117 self.assertEqual(ret['options']['separator'], os.sep)118 self.assertEqual(ret['options']['path'], connector._default._root_name)119 120 121 #********* init with tree ***********122 ret_tree = connector.execute('open', target='dummy', init='1', tree='1')123 self.check_root_tree(ret_tree, 3, connector._default._root_name)124 125 ret['files'][:0] = [ret['cwd']]126 self.assertEqual(ret, ret_tree)127 128 #******** init with tree and debug *******129 ret_tree_debug = connector.execute('open', target='dummy', init='1', tree='1', debug='1')130 131 self.assertEqual(ret_tree_debug['debug']['connector'], 'yawd-elfinder')132 self.assertEqual(ret_tree_debug['debug']['mountErrors'], [])133 self.assertEqual(ret_tree_debug['debug']['upload'], '')134 self.assertEqual(ret_tree_debug['debug']['volumes'], [{'id': 'llff_', 'name': 'localfilesystem'}])135 self.assertIsInstance(ret_tree_debug['debug']['time'], float)136 137 del ret_tree_debug['debug']138 self.assertEqual(ret_tree, ret_tree_debug)139 140 def test_open_startpath(self):141 """142 Test startpath option143 """144 145 self.opts['roots'][0]['startPath'] = 'files'146 connector = ElfinderConnector(self.opts)147 148 #************ init without tree ***********149 ret = connector.execute('open', target='dummy', init='1')150 #check files and cwd151 self.assertEqual(len(ret['files']), 2)152 self.assertNotEqual(ret['files'][0]['hash'], ret['files'][1]['hash'])153 self.assertEqual(ret['files'][0]['name'], '2bytes.txt')154 self.assertEqual(ret['files'][1]['name'], 'directory')155 self.assertEqual(ret['cwd']['dirs'], 1)156 self.assertEqual(ret['cwd']['name'], 'files')157 self.assertEqual(ret['cwd']['read'], 1)158 self.assertEqual(ret['cwd']['write'], 1)159 self.assertEqual(ret['cwd']['locked'], 0)160 self.assertEqual(ret['cwd']['hidden'], 0)161 self.assertEqual(ret['cwd']['size'], 'unknown')162 self.assertEqual(ret['cwd']['mime'], 'directory')163 self.assertNotIn('volumeid', ret['cwd'])164 self.assertIsInstance(ret['cwd']['ts'], float)165 self.assertGreater(len(ret['cwd']['phash']), 0)166 self.assertGreater(len(ret['cwd']['hash']), 0)167 168 #other response attributes169 self.assertNotIn('error', ret)170 self.assertIn('netDrivers', ret)171 self.assertEqual(ret['uplMaxSize'], 128 * 1048576)172 self.assertEqual(ret['api'], '2.1')173 self.assertEqual(ret['options']['pathUrl'], '%sfiles' % settings.MEDIA_URL)174 self.assertEqual(ret['options']['tmbUrl'], '%s.tmb/' % settings.MEDIA_URL)175 self.assertIn('create', ret['options']['archivers'])176 self.assertIn('extract', ret['options']['archivers'])177 self.assertEqual(ret['options']['disabled'], [])178 self.assertEqual(ret['options']['copyOverwrite'], 1)179 self.assertEqual(ret['options']['separator'], os.sep)180 self.assertEqual(ret['options']['path'], '%s%sfiles' % (connector._default._root_name, os.sep))181 182 #********* init with tree ***********183 ret_tree = connector.execute('open', target='dummy', init='1', tree='1')184 self.check_root_tree(ret_tree, 5, connector._default._root_name)185 #cleanup startpath186 self.opts['startpath'] = ''187 188 def test_open_path(self):189 190 connector = ElfinderConnector(self.opts)191 192 #************ init without tree ***********193 ret = connector.execute('open', target=connector._default.encode(194 connector._default._join_path(settings.MEDIA_ROOT, 195 connector._default._join_path('files', 'directory'))),196 init='1')197 #check files and cwd198 self.assertEqual(len(ret['files']), 1)199 self.assertEqual(ret['files'][0]['name'], 'yawd-logo.png')200 self.assertNotIn('dirs', ret['cwd'])201 self.assertEqual(ret['cwd']['name'], 'directory')202 self.assertEqual(ret['cwd']['read'], 1)203 self.assertEqual(ret['cwd']['write'], 1)204 self.assertEqual(ret['cwd']['locked'], 0)205 self.assertEqual(ret['cwd']['hidden'], 0)206 self.assertEqual(ret['cwd']['size'], 'unknown')207 self.assertEqual(ret['cwd']['mime'], 'directory')208 self.assertNotIn('volumeid', ret['cwd'])209 self.assertIsInstance(ret['cwd']['ts'], float)210 self.assertGreater(len(ret['cwd']['phash']), 0)211 self.assertGreater(len(ret['cwd']['hash']), 0)212 213 #other response attributes214 self.assertNotIn('error', ret)215 self.assertIn('netDrivers', ret)216 self.assertEqual(ret['uplMaxSize'], 128 * 1048576)217 self.assertEqual(ret['api'], '2.1')218 self.assertEqual(ret['options']['pathUrl'], '%sfiles/directory' % settings.MEDIA_URL)219 self.assertEqual(ret['options']['tmbUrl'], '%s.tmb/' % settings.MEDIA_URL)220 self.assertIn('create', ret['options']['archivers'])221 self.assertIn('extract', ret['options']['archivers'])222 self.assertEqual(ret['options']['disabled'], [])223 self.assertEqual(ret['options']['copyOverwrite'], 1)224 self.assertEqual(ret['options']['separator'], os.sep)225 self.assertEqual(ret['options']['path'], '%s%sfiles%sdirectory' % (connector._default._root_name, os.sep, os.sep))226 227 def check_root_tree(self, ret, len_, name):228 """229 Check that result contains the root tree230 """231 232 self.assertEqual(len(ret['files']), len_)233 self.assertEqual(ret['files'][0]['name'], name)234 self.assertEqual(ret['files'][1]['name'], 'files')235 self.assertEqual(ret['files'][2]['name'], 'test')236 237 for i in range(1, len_):238 for j in range(i-1, -1, -1):239 self.assertNotEqual(ret['files'][i]['hash'], ret['files'][j]['hash'])...

Full Screen

Full Screen

Player.js

Source:Player.js Github

copy

Full Screen

1let compobj = function(obj) {2 let a = Object.keys(obj);3 let b = Object.values(obj);4 if (a.length === 0) return "";5 let ret = []6 for (let i = 0; i < a.length; i++) {7 ret.push(a[i] + ',' + b[i]);8 }9 return ret.join(',');10}11let uncompobj = function(data) {12 if (!data.trim()) return {};13 let obj = {};14 let dt = data.split(',');15 for (let i = 0; i < dt.length; i++) {16 if (i % 2 === 1) continue;17 if (!isNaN(parseInt(dt[i+1]))) obj[dt[i]] = parseInt(dt[i+1]);18 else obj[dt[i]] = dt[i+1];19 }20 return obj;21}22class Player {23 constructor (name, Class, Weapon) {24 console.log(name);25 if (name.startsWith("|")) {26 this.load(name);27 return;28 }29 30 this.name = name;31 this.id = toId(name);32 this.filename = `./data/players/${this.id}.pl`;33 this.branch = Weapon.branch;34 this.weapon = toId(Weapon.nom);35 this.class = toId(Class.nom);36 this.passive = false;37 this.active = false;38 this.xp = 0;39 this.totalxp = 0;40 this.gold = 0;41 42 this.inventory = {43 gems: {},44 itemnames: [],45 itemids: []46 }47 48 this.levels = {};49 this.resetLevels();50 this.apphost = false51 this.save();52 }53 54 resetLevels() {55 for (let weap in Weapons) {56 let Weapon = Weapons[weap]57 if (!Weapon.branch) continue;58 this.levels[Weapon.branch] = 159 }60 61 for (let cls in Classes) {62 let Class = Classes[cls];63 let nom = Class.nom;64 if (!nom) continue;65 this.levels[toId(nom)] = 166 }67 }68 69 save() {70 let ret = "";71 72 ret += `|${this.id}\n`;73 ret += `|${this.name}\n`;74 ret += `|${this.branch}|${this.weapon}|${this.class}\n`;75 ret += `|${this.passive}|${this.active} // Passive and Active item\n`;76 ret += `|${this.xp}|${this.totalxp} // XP\n`;77 ret += `|${this.gold} // Gold\n`;78 ret += `|${compobj(this.inventory.gems)} // Gems\n`;79 ret += `|${this.inventory.itemnames.join(",")} // Items (names)\n`;80 ret += `|${this.inventory.itemids.join(",")} // Items (ids)\n`;81 ret += `|${compobj(this.levels)}\n`;82 ret += `|${this.apphost ? 1 : 0} // apphost`83 84 FS.writeFileSync(this.filename, ret);85 }86 87 load(data) {88 let parts = data.split("|");89 90 this.id = parts[1].trim();91 this.name = parts[2].trim();92 this.branch = parts[3].trim();93 this.weapon = parts[4].trim();94 this.class = parts[5].trim();95 this.passive = parts[6].trim();96 this.active = parts[7].split("//")[0].trim()97 98 if (this.passive == "false") this.passive = false;99 if (this.active == "false") this.active = false;100 101 this.xp = parseInt(parts[8].trim());102 this.totalxp = parseInt(parts[9].split("//")[0]);103 this.gold = parseInt(parts[10].split("//")[0]);104 this.inventory = {105 gems: uncompobj(parts[11].split("//")[0].trim()),106 itemnames: parts[12].split("//")[0].trim() ? parts[12].split("//")[0].trim().split(',') : [],107 itemids: parts[13].split("//")[0].trim() ? parts[13].split("//")[0].trim().split(',') : [],108 }109 this.levels = uncompobj(parts[14].trim());110 this.filename = `./data/players/${this.id}.pl`;111 this.apphost = parts[15].split("//")[0].trim();112 }113 114 getStat(stat, includeitems = true) { 115 // this function is seriously lacking in quality but right now I just can't be arsed116 // If someone sees this and wants to compress it, feel free to do so. 117 // Just make sure it still works the same118 if (!stat) return false;119 let stats = ["hp","atk","mag","md","me","pd","pe","mp"];120 stat = toId(stat);121 if (stats.indexOf(stat) === -1) return false;122 console.log(stat);123 let ret = 0;124 if (includeitems) {125 if (this.passive && Items[this.passive].boost[stat]) ret += Items[this.passive].boost[stat];126 if (this.active && Items[this.active].boost[stat]) ret += Items[this.active].boost[stat];127 }128 129 let clvl = this.levels[this.class];130 let blvl = this.levels[this.branch];131 if (stat === 'pe') {132 ret = ret * 10;133 stat = 'pd';134 ret += Utils.statCalc(Weapons[this.weapon].stats[stat], blvl);135 ret += Utils.statCalc(Classes[this.class].stats[stat], clvl);136 if (includeitems) {137 if (this.passive && Items[this.passive].boost[stat]) ret += Items[this.passive].boost[stat];138 if (this.active && Items[this.active].boost[stat]) ret += Items[this.active].boost[stat];139 }140 return Math.floor(ret / 10);141 }142 if (stat === 'me') {143 ret = ret * 10;144 stat = 'md';145 ret += Utils.statCalc(Weapons[this.weapon].stats[stat], blvl);146 ret += Utils.statCalc(Classes[this.class].stats[stat], clvl);147 if (includeitems) {148 if (this.passive && Items[this.passive].boost[stat]) ret += Items[this.passive].boost[stat];149 if (this.active && Items[this.active].boost[stat]) ret += Items[this.active].boost[stat];150 }151 return Math.floor(ret / 10);152 }153 154 ret += Utils.statCalc(Weapons[this.weapon].stats[stat], blvl);155 ret += Utils.statCalc(Classes[this.class].stats[stat], clvl);156 return ret;157 }158 159 getStats(includeitems = true) {160 let ret = {};161 let stats = ["hp","atk","mag","pd","pe","me","mp"];162 for (let i = 0; i < stats.length; i++) {163 ret[stats[i]] = this.getStat(stats[i], includeitems);164 }165 return ret;166 }167 getLevels() {168 return [this.levels[this.class], this.levels[this.branch]];169 }170 171 appHost(deapphost = false) {172 this.apphost = !deapphost173 this.save();174 }175 176 buildVS(self = false) {177 let ret = `<b>${this.name}:</b><br>`;178 if (self) ret += `<b>XP:</b> ${this.xp}<br>`;179 ret += `<b>HP:</b> ${this.getStat("hp")}<br>`;180 ret += `<b>Active/Passive Item:</b><br>${this.active ? Items[this.active].nom : "-"}/${this.passive ? Items[this.passive].nom : "-"}<br>`;181 ret += `<b>Class/Weapon:</b><br>${Classes[this.class].nom}(${this.levels[this.class]})/${Weapons[this.weapon].nom}(${this.levels[this.branch]})<br>`;182 ret += `<b>Attack/Magic:</b> ${this.getStat("atk")}/${this.getStat("mag")}<br>`;183 ret += `<b>Evasion (P/M):</b> ${this.getStat("pe")}/${this.getStat("me")}<br>`;184 ret += `<b>Movement:</b> ${this.getStat("mp")}`;185 return ret;186 }187 188 buildVI(self = false) {189 let ret = `Item stats for player <b>${this.name}:</b><br><br>`;190 ret += `<b>Gold:</b> ${this.gold}<br>`;191 ret += `<details><summary><b>Gems</b></summary>`;192 for (let i in this.inventory.gems) {193 let n = this.inventory.gems[i];194 ret += `${i.capitalize()}: ${n}<br>`195 }196 ret += `</details><br>`;197 ret += `<b>Current Active item</b>: ${this.active ? Items[this.active].nom : "-"}<br>`;198 ret += `<b>Current Passive item</b>: ${this.passive ? Items[this.passive].nom : "-"}<br><br>`;199 ret += `<details><summary><b>`200 if (self) ret += `List of items you own`;201 else ret += `List of items ${this.name} owns`;202 ret += `</b></summary>`;203 let b = [];204 for (let i in this.inventory.itemnames) {205 b.push(Items[this.inventory.itemnames[i]].nom)206 }207 if (b.length) ret += b.join("<br>");208 ret += "</details>";209 210 // There's supposed to be a "list of items that you can afford" that follows here but I'M CRYING INTERNALLY so that's not happening right now211 return ret;212 }213 214 buildVL(self = false) {215 let ret = "";216 if (self) ret += `<b>XP:</b> ${this.xp}<hr>`;217 ret += `<details><summary><b>`;218 if (self) ret += `Your Class levels are`;219 else ret += `${this.name}'s Class levels are`;220 ret += `</b></summary><hr>`;221 let temp = [];222 for (let i in Classes) {223 if (!this.levels[i] || typeof this.levels[i] !== 'number') continue;224 temp.push(`<b>${Classes[i].nom}</b>: ${this.levels[i]}`);225 }226 ret += temp.join('<br>');227 ret += `</details><br>`;228 ret += `<details><summary><b>`;229 if (self) ret += `Your Branch levels are`;230 else ret += `${this.name}'s Branch levels are`;231 ret += `</b></summary><hr>`;232 temp = [];233 for (let i in Branches) {234 temp.push(`<b>${i.capitalize()}</b>: ${this.levels[i]}`);235 }236 ret += temp.join('<br>');237 ret += `</details>`;238 return ret;239 240 }241 242 sc(cls) {243 if (typeof cls === "string") {244 cls = toId(cls);245 cls = Classes[cls];246 if (!cls) return "This class does not exist. Available classes: " + Classes;247 }248 this.class = toId(cls.nom);249 this.save();250 return "Successfully changed your class to " + cls.nom;251 } 252 253 sco(cls, weap) {254 if (typeof cls === "string") {255 cls = toId(cls);256 cls = Classes[cls];257 if (!cls) return "This class does not exist. Available classes: " + Classes;258 }259 if (typeof weap === "string") {260 weap = toId(weap);261 weap = Weapons[weap];262 if (!weap) return "This weapon does not exist. Available weapons: " + Weapons;263 }264 this.class = toId(cls.nom);265 this.weapon = toId(weap.nom);266 this.branch = weap.branch;267 this.save();268 return "Successfully changed to " + cls.nom + " and " + weap.nom;269 } 270 271 sw(weap) {272 if (typeof weap === "string") {273 weap = toId(weap);274 weap = Weapons[weap];275 if (!weap) return "This weapon does not exist. Available weapons: " + Weapons;276 }277 this.weapon = toId(weap.nom);278 this.branch = weap.branch;279 this.save();280 return "Successfully changed your weapon to " + weap.nom;281 } 282}283let plobj = {};284plobj.get = function(name) {285 let id = toId(name);286 if (id === 'get' || id === 'add') return false;287 if (plobj[id]) return plobj[id];288 if (FS.existsSync(`./data/players/${id}.pl`)) {289 plobj[id] = new Player(FS.readFileSync(`./data/players/${id}.pl`, 'utf8'));290 return plobj[id];291 }292 return false;293}294plobj.add = function(name, cls, weap) {295 let id = toId(name);296 if (id === 'get' || id === 'add') return "illegal";297 if (name.length > 19) return "toolong";298 plobj[name] = new Player(name, cls, weap);299 return plobj[name];300}...

Full Screen

Full Screen

utils.js

Source:utils.js Github

copy

Full Screen

1/*2 RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE. 3 Can be easily integrated with any other WYSIWYG editor or CMS.4 Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.5 For licensing, see LICENSE.txt or http://RoxyFileman.com/license6 This program is free software: you can redistribute it and/or modify7 it under the terms of the GNU General Public License as published by8 the Free Software Foundation, either version 3 of the License.9 This program is distributed in the hope that it will be useful,10 but WITHOUT ANY WARRANTY; without even the implied warranty of11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12 GNU General Public License for more details.13 You should have received a copy of the GNU General Public License14 along with this program. If not, see <http://www.gnu.org/licenses/>.15 Contact: Lyubomir Arsov, liubo (at) web-lobby.com16*/17var FileTypes = new Array();18FileTypes['image'] = new Array('jpg', 'jpeg', 'png', 'gif');19FileTypes['media'] = new Array('avi', 'flv', 'swf', 'wmv', 'mp3', 'wma', 'mpg','mpeg');20FileTypes['document'] = new Array('doc', 'docx', 'txt', 'rtf', 'pdf', 'xls', 'mdb','html','htm','db');21function RoxyUtils(){}22RoxyUtils.FixPath = function(path){23 if(!path)24 return '';25 var ret = path.replace(/\\/g, '');26 ret = ret.replace(/\/\//g, '/');27 ret = ret.replace(':/', '://');28 return ret;29};30RoxyUtils.FormatDate = function(date){31 var ret = '';32 try{33 ret = $.format.date(date, RoxyFilemanConf.DATEFORMAT);34 }35 catch(ex){36 alert(ex);37 ret = date.toString();38 ret = ret.substr(0, ret.indexOf('UTC'));39 }40 return ret;41};42RoxyUtils.GetPath = function(path){43 var ret = '';44 path = RoxyUtils.FixPath(path);45 if(path.indexOf('/') > -1)46 ret = path.substring(0, path.lastIndexOf('/'));47 return ret;48};49RoxyUtils.GetUrlParam = function(varName, url){50 var ret = '';51 if(!url)52 url = self.location.href;53 if(url.indexOf('?') > -1){54 url = url.substr(url.indexOf('?') + 1);55 url = url.split('&');56 for(i = 0; i < url.length; i++){57 var tmp = url[i].split('=');58 if(tmp[0] && tmp[1] && tmp[0] == varName){59 ret = tmp[1];60 break;61 }62 }63 }64 return ret;65};66RoxyUtils.GetFilename = function(path){67 var ret = path;68 path = RoxyUtils.FixPath(path);69 if(path.indexOf('/') > -1){70 ret = path.substring(path.lastIndexOf('/')+1);71 }72 return ret;73};74RoxyUtils.MakePath = function(){75 ret = '';76 if(arguments && arguments.length > 0){77 for(var i = 0; i < arguments.length; i++){78 ret += ($.isArray(arguments[i])?arguments[i].join('/'):arguments[i]);79 if(i < (arguments.length - 1))80 ret += '/';81 }82 ret = RoxyUtils.FixPath(ret);83 }84 return ret;85};86RoxyUtils.GetFileExt = function(path){87 var ret = '';88 path = RoxyUtils.GetFilename(path);89 if(path.indexOf('.') > -1){90 ret = path.substring(path.lastIndexOf('.') + 1);91 }92 return ret;93};94RoxyUtils.FileExists = function(path) {95 var ret = false;96 $.ajax({97 url: path,98 type: 'HEAD',99 async: false,100 dataType:'text',101 success:function(){ret = true;}102 });103 return ret;104};105RoxyUtils.GetFileIcon = function(path){106 ret = 'images/filetypes/file_extension_' + RoxyUtils.GetFileExt(path).toLowerCase() + '.png';107 if(!fileTypeIcons[RoxyUtils.GetFileExt(path).toLowerCase()]){108 ret = 'images/filetypes/unknown.png';109 }110 return ret;111};112RoxyUtils.GetFileSize = function(path){113 var ret = 0;114 $.ajax({115 url: path,116 type: 'HEAD',117 async: false,118 success:function(d,s, xhr){119 ret = xhr.getResponseHeader('Content-Length');120 }121 });122 if(!ret)123 ret = 0;124 return ret;125};126RoxyUtils.GetFileType = function(path){127 var ret = RoxyUtils.GetFileExt(path).toLowerCase();128 if(ret == 'png' || ret == 'jpg' || ret == 'gif' || ret == 'jpeg')129 ret = 'image';130 return ret;131};132RoxyUtils.IsImage = function(path){133 var ret = false;134 if(RoxyUtils.GetFileType(path) == 'image')135 ret = true;136 return ret;137};138RoxyUtils.FormatFileSize = function(x){139 var suffix = 'B';140 if(!x)141 x = 0;142 if(x > 1024){143 x = x / 1024;144 suffix = 'KB';145 }146 if(x > 1024){147 x = x / 1024;148 suffix = 'MB';149 }150 x = new Number(x);151 return x.toFixed(2) + ' ' + suffix;152};153RoxyUtils.AddParam = function(url, n, v){154 url += (url.indexOf('?') > -1?'&':'?') + n + '='+escape(v);155 return url;156};157RoxyUtils.SelectText = function(field_id, start, end) {158 try{159 var field = document.getElementById(field_id);160 if( field.createTextRange ) {161 var selRange = field.createTextRange();162 selRange.collapse(true);163 selRange.moveStart('character', start);164 selRange.moveEnd('character', end-start);165 selRange.select();166 } else if( field.setSelectionRange ) {167 field.setSelectionRange(start, end);168 } else if( field.selectionStart ) {169 field.selectionStart = start;170 field.selectionEnd = end;171 }172 field.focus();173 }174 catch(ex){}175};176function RoxyFilemanConf(){}177RoxyUtils.LoadConfig = function(){178 $.ajax({179 url: 'conf.json',180 dataType: 'json',181 async:false,182 success: function(data){183 RoxyFilemanConf = data;184 },185 error: function(data){186 alert(t('E_LoadingConf'));187 }188 });189};190function RoxyLang(){}191RoxyUtils.LoadLang = function(){192 var langUrl = '';193 if(RoxyFilemanConf.LANG && RoxyFilemanConf.LANG.toLowerCase() == 'auto'){194 var language = window.navigator.userLanguage || window.navigator.language;195 langUrl = 'lang/' + language.substr(0, 2) + '.json';196 if(!RoxyUtils.FileExists(langUrl))197 langUrl = '';198 }199 else{200 if(RoxyFilemanConf.LANG){201 langUrl = 'lang/' + RoxyFilemanConf.LANG.substr(0, 2).toLowerCase() + '.json';202 if(!RoxyUtils.FileExists(langUrl))203 langUrl = '';204 }205 }206 if(!langUrl)207 langUrl = 'lang/en.json';208 $.ajax({209 url: langUrl,210 dataType: 'json',211 async:false,212 success: function(data){213 RoxyLang = data;214 },215 error: function(data){216 alert('Error loading language file');217 }218 });219};220RoxyUtils.Translate = function(){221 RoxyUtils.LoadLang();222 $('[data-lang-t]').each(function(){223 var key = $(this).attr('data-lang-t');224 $(this).prop('title', t(key));225 });226 $('[data-lang-v]').each(function(){227 var key = $(this).attr('data-lang-v');228 $(this).prop('value', t(key));229 });230 $('[data-lang]').each(function(){231 var key = $(this).attr('data-lang');232 $(this).html(t(key));233 });234};235function t(tag){236 var ret = tag;237 if(RoxyLang && RoxyLang[tag])238 ret = RoxyLang[tag];239 return ret;...

Full Screen

Full Screen

plugin_monitor_private_monitor_private.js

Source:plugin_monitor_private_monitor_private.js Github

copy

Full Screen

1/** 2 * Hook android.net.wifi.WifiManager related interface3 */4function hookWifiPart() {5 var WifiInfo = Java.use("android.net.wifi.WifiInfo");6 7 WifiInfo.getMacAddress.implementation = function() {8 var ret = this.getMacAddress();9 console.warn("catch getMacAddress : "+ret);10 console.warn(printStack());11 return ret;12 }13 WifiInfo.getSSID.implementation = function() {14 var ret = this.getSSID();15 console.warn("catch getSSID : "+ ret);16 console.warn(printStack());17 return ret;18 }19 WifiInfo.getIpAddress.implementation = function() {20 var ret = this.getIpAddress();21 var ip = (ret & 0xff)+'.'+(ret>>8 & 0xff)+'.'+(ret>>16 & 0xff)+'.'+(ret>>24 & 0xff);22 console.log("catch getIpAddress : "+ ret);23 console.warn(printStack());24 return ret;25 }26}27/** 28 * Hook data query by android.provider.Settings$Secure 29 */30function hookSecureSettingsPart() {31 var private_dict = new Array("bluetooth_address","android_id");32 var secure = Java.use("android.provider.Settings$Secure");33 34 secure.getString.implementation = function(resolver,str) {35 var ret = this.getString(resolver,str);36 if (private_dict.indexOf(str) > -1) {37 console.log("catch SecureSettings "+str+" with result "+ret);38 console.warn(printStack());39 }40 return ret;41 }42}43/** 44 * Hook data obtain from idProvider(com.android.id.impl.IdProviderImpl)45 * ## ATTATION : the target is content://com.miui.idprovider ## 46 */47function hookidProviderPart() {48 var idProvider = Java.use("com.android.id.impl.IdProviderImpl");49 50 idProvider.getUDID.implementation = function(context) {51 var ret = this.getUDID(context);52 console.log("catch idProvider uuid with "+ret);53 console.warn(printStack());54 return ret;55 }56 idProvider.getOAID.implementation = function(context) {57 var ret = this.getOAID(context);58 console.log("catch idProvider OAID with "+ret);59 console.warn(printStack());60 return ret;61 }62 idProvider.getVAID.implementation = function(context) {63 var ret = this.getVAID(context);64 console.log("catch idProvider VAID with "+ret);65 console.warn(printStack());66 return ret;67 }68 idProvider.getAAID.implementation = function(context) {69 var ret = this.getAAID(context);70 console.log("catch idProvider AAID with "+ ret);71 console.warn(printStack());72 return ret;73 }74}75/** 76 * Hook Device info from android.telephony.TelephonyManager77 *78 */79function hookTelephoneManagerPart() {80 var TelephonyManager = Java.use("android.telephony.TelephonyManager");81 //imei82 TelephonyManager.getImei.overload('int').implementation = function(slotIndex) {83 var ret = this.getImei(slotIndex);84 console.log("catch imei : "+ret);85 console.warn(printStack());86 return ret;87 }88 TelephonyManager.getDeviceId.overload('int').implementation = function(slotIndex) {89 var ret = this.getDeviceId(slotIndex);90 console.log("catch deviceId : "+ret);91 console.warn(printStack());92 return ret93 }94 //meid95 TelephonyManager.getMeid.overload('int').implementation = function(slotIndex) {96 var ret = this.getMeid(slotIndex);97 console.log("catch meid : "+ret);98 console.warn(printStack());99 return ret;100 }101 //imsi102 TelephonyManager.getSubscriberId.overload('int').implementation = function(slotIndex) {103 var ret = this.getSubscriberId(slotIndex);104 console.log("catch imsi : "+ret );105 console.warn(printStack());106 return ret;107 }108 //phoneNum109 TelephonyManager.getLine1Number.overload('int').implementation = function(subId) {110 var ret = this.getLine1Number(subId);111 console.log("catch phoneNum : "+ret);112 console.warn(printStack());113 return ret;114 }115}116function printStack() {117 var Throwable = Java.use("java.lang.Throwable");118 var stackElements = Throwable.$new().getStackTrace();119 var body = "Stack: " + stackElements[0]; 120 for (var i = 0; i < stackElements.length; i++) {121 body += "\n at " + stackElements[i];122 }123 return body124}125/*** script running ***/126if (Java.available) {127 Java.perform(function() {128 hookWifiPart();129 hookSecureSettingsPart();130 hookidProviderPart();131 hookTelephoneManagerPart();132 });...

Full Screen

Full Screen

test_echo.py

Source:test_echo.py Github

copy

Full Screen

1#2# Copyright 2019 Delphix3#4# Licensed under the Apache License, Version 2.0 (the "License");5# you may not use this file except in compliance with the License.6# You may obtain a copy of the License at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS,12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13# See the License for the specific language governing permissions and14# limitations under the License.15#16# pylint: disable=missing-docstring17import drgn18import pytest19import sdb20from tests import invoke, MOCK_PROGRAM21def test_empty():22 line = 'echo'23 objs = []24 ret = invoke(MOCK_PROGRAM, objs, line)25 assert not ret26def test_piped_input():27 line = 'echo'28 objs = [drgn.Object(MOCK_PROGRAM, 'void *', value=0)]29 ret = invoke(MOCK_PROGRAM, objs, line)30 assert len(ret) == 131 assert ret[0].value_() == 032 assert ret[0].type_ == MOCK_PROGRAM.type('void *')33def test_single_arg_hex():34 line = 'echo 0x0'35 objs = []36 ret = invoke(MOCK_PROGRAM, objs, line)37 assert len(ret) == 138 assert ret[0].value_() == 039 assert ret[0].type_ == MOCK_PROGRAM.type('void *')40def test_single_arg_decimal():41 line = 'echo 0'42 objs = []43 ret = invoke(MOCK_PROGRAM, objs, line)44 assert len(ret) == 145 assert ret[0].value_() == 046 assert ret[0].type_ == MOCK_PROGRAM.type('void *')47def test_bogus_arg():48 line = 'echo bogus'49 objs = []50 with pytest.raises(sdb.CommandInvalidInputError) as err:51 invoke(MOCK_PROGRAM, objs, line)52 assert err.value.argument == 'bogus'53def test_test_piped_int():54 line = 'echo'55 objs = [drgn.Object(MOCK_PROGRAM, 'int', value=1)]56 ret = invoke(MOCK_PROGRAM, objs, line)57 assert len(ret) == 158 assert ret[0].value_() == 159 assert ret[0].type_ == MOCK_PROGRAM.type('int')60def test_single_arg():61 line = 'echo 1'62 objs = []63 ret = invoke(MOCK_PROGRAM, objs, line)64 assert len(ret) == 165 assert ret[0].value_() == 166 assert ret[0].type_ == MOCK_PROGRAM.type('void *')67def test_multiple_piped():68 line = 'echo'69 objs = [70 drgn.Object(MOCK_PROGRAM, 'void *', value=0),71 drgn.Object(MOCK_PROGRAM, 'int', value=1),72 ]73 ret = invoke(MOCK_PROGRAM, objs, line)74 assert len(ret) == 275 assert ret[0].value_() == 076 assert ret[0].type_ == MOCK_PROGRAM.type('void *')77 assert ret[1].value_() == 178 assert ret[1].type_ == MOCK_PROGRAM.type('int')79def test_multiple_args():80 line = 'echo 0 1'81 objs = []82 ret = invoke(MOCK_PROGRAM, objs, line)83 assert len(ret) == 284 assert ret[0].value_() == 085 assert ret[0].type_ == MOCK_PROGRAM.type('void *')86 assert ret[1].value_() == 187 assert ret[1].type_ == MOCK_PROGRAM.type('void *')88def test_piped_and_args_combo():89 line = 'echo 0 1'90 objs = [91 drgn.Object(MOCK_PROGRAM, 'void *', value=0),92 drgn.Object(MOCK_PROGRAM, 'int', value=1),93 ]94 ret = invoke(MOCK_PROGRAM, objs, line)95 assert len(ret) == 496 assert ret[0].value_() == 097 assert ret[0].type_ == MOCK_PROGRAM.type('void *')98 assert ret[1].value_() == 199 assert ret[1].type_ == MOCK_PROGRAM.type('int')100 assert ret[2].value_() == 0101 assert ret[2].type_ == MOCK_PROGRAM.type('void *')102 assert ret[3].value_() == 1103 assert ret[3].type_ == MOCK_PROGRAM.type('void *')104def test_multi_echo_combo():105 line = 'echo 2 3 | echo 4'106 objs = [107 drgn.Object(MOCK_PROGRAM, 'void *', value=0),108 drgn.Object(MOCK_PROGRAM, 'int', value=1),109 ]110 ret = invoke(MOCK_PROGRAM, objs, line)111 assert len(ret) == 5112 assert ret[0].value_() == 0113 assert ret[0].type_ == MOCK_PROGRAM.type('void *')114 assert ret[1].value_() == 1115 assert ret[1].type_ == MOCK_PROGRAM.type('int')116 assert ret[2].value_() == 2117 assert ret[2].type_ == MOCK_PROGRAM.type('void *')118 assert ret[3].value_() == 3119 assert ret[3].type_ == MOCK_PROGRAM.type('void *')120 assert ret[4].value_() == 4...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const ret = require('fast-check-monorepo');2ret();3const ret = require('fast-check-monorepo');4ret();5const ret = require('fast-check-monorepo');6ret();7const ret = require('fast-check-monorepo');8ret();9const ret = require('fast-check-monorepo');10ret();11const ret = require('fast-check-monorepo');12ret();13const ret = require('fast-check-monorepo');14ret();15const ret = require('fast-check-monorepo');16ret();17const ret = require('fast-check-monorepo');18ret();19const ret = require('fast-check-monorepo');20ret();21const ret = require('fast-check-monorepo');22ret();23const ret = require('fast-check-monorepo');24ret();25const ret = require('fast-check-monorepo');26ret();27const ret = require('fast-check-monorepo');28ret();29const ret = require('fast-check-monorepo');30ret();

Full Screen

Using AI Code Generation

copy

Full Screen

1const ret = require('fast-check-monorepo');2console.log(ret());3const ret2 = require('fast-check');4console.log(ret2());5const ret3 = require('fast-check');6console.log(ret3());7const ret4 = require('fast-check');8console.log(ret4());9const ret5 = require('fast-check');10console.log(ret5());11const ret6 = require('fast-check');12console.log(ret6());13const ret7 = require('fast-check');14console.log(ret7());15const ret8 = require('fast-check');16console.log(ret8());17const ret9 = require('fast-check');18console.log(ret9());19const ret10 = require('fast-check');20console.log(ret10());21const ret11 = require('fast-check');22console.log(ret11());23const ret12 = require('fast-check');24console.log(ret12());25const ret13 = require('fast-check');26console.log(ret13());27const ret14 = require('fast-check');28console.log(ret14());29const ret15 = require('fast-check');30console.log(ret15());31const ret16 = require('fast-check');32console.log(ret16());33const ret17 = require('fast-check');34console.log(ret17());35const ret18 = require('fast-check');36console.log(ret18());37const ret19 = require('fast-check');38console.log(ret19());39const ret20 = require('fast-check');40console.log(ret20());41const ret21 = require('fast-check');42console.log(ret21());

Full Screen

Using AI Code Generation

copy

Full Screen

1const ret = require('fast-check-monorepo').ret;2const ret = require('fast-check-monorepo').ret;3const ret = require('fast-check-monorepo').ret;4const ret = require('fast-check-monorepo').ret;5const ret = require('fast-check-monorepo').ret;6const ret = require('fast-check-monorepo').ret;7const ret = require('fast-check-monorepo').ret;8const ret = require('fast-check-monorepo').ret;9const ret = require('fast-check-monorepo').ret;10const ret = require('fast-check-monorepo').ret;11const ret = require('fast-check-monorepo').ret;12const ret = require('fast-check-monorepo').ret;13const ret = require('fast-check-monorepo').ret;14const ret = require('fast-check-monorepo').ret;15const ret = require('fast-check-monorepo').ret;16const ret = require('fast-check-monorepo').ret;17const ret = require('fast-check-monorepo').ret;

Full Screen

Using AI Code Generation

copy

Full Screen

1const { ret } = require('fast-check-monorepo');2const { ret } = require('fast-check-monorepo');3const { ret } = require('fast-check-monorepo');4const { ret } = require('fast-check-monorepo');5const { ret } = require('fast-check-monorepo');6const { ret } = require('fast-check-monorepo');7const { ret } = require('fast-check-monorepo');8const { ret } = require('fast-check-monorepo');9const { ret } = require('fast-check-monorepo');10const { ret } = require('fast-check-monorepo');11const { ret } = require('fast-check-monorepo');12const { ret

Full Screen

Using AI Code Generation

copy

Full Screen

1const ret = require("fast-check-monorepo");2const { check } = ret;3const isEven = (n) => n % 2 === 0;4const isOdd = (n) => n % 2 !== 0;5const evenOdd = check(6 { seed: 42, numRuns: 10 },7 (t) => t.assert(isEven(t.integer()) || isOdd(t.integer()))8);9console.log(evenOdd);

Full Screen

Using AI Code Generation

copy

Full Screen

1const { ret } = require('fast-check');2const myFunction = (a, b) => a + b;3const myProperty = (a, b) => {4 const result = myFunction(a, b);5 return ret(result === a + b);6};7const { ret } = require('fast-check');8const myFunction = (a, b) => a + b;9const myProperty = (a, b) => {10 const result = myFunction(a, b);11 return ret(result === a + b);12};13const { ret } = require('fast-check');14const myFunction = (a, b) => a + b;15const myProperty = (a, b) => {16 const result = myFunction(a, b);17 return ret(result === a + b);18};19const { ret } = require('fast-check');20const myFunction = (a, b) => a + b;21const myProperty = (a, b) => {22 const result = myFunction(a, b);23 return ret(result === a + b);24};25const { ret } = require('fast-check');26const myFunction = (a, b) => a + b;27const myProperty = (a, b) => {28 const result = myFunction(a, b);29 return ret(result === a + b);30};31const { ret } = require('fast-check');32const myFunction = (a, b) => a + b;33const myProperty = (a, b) => {

Full Screen

Using AI Code Generation

copy

Full Screen

1import {ret} from "./fast-check-monorepo"2console.log(ret(2,3))3export function ret(a, b) {4 return a + b;5}6import7import8I want to import the routes file into index.js and then use the routes file in the render method of the App component. However, when I try to do this, I get the following error:9import10import11Why does this error occur? How can I import the routes file into index.js and then use the routes file in the render method of the App component?

Full Screen

Using AI Code Generation

copy

Full Screen

1const { ret } = require('fast-check-monorepo');2const ret5 = ret(5);3console.log(ret5);4const { ret } = require('fast-check-monorepo');5const arr = [1, 2, 3];6const arr2 = arr.map(ret);7console.log(arr2);8const { ret } = require('fast-check-monorepo');9const arr = [1, 2, 3];10const arr2 = arr.map(ret);11console.log(arr2);12const { ret } = require('fast-check-monorepo');13const arr = [1, 2, 3];14const arr2 = arr.map(ret);15console.log(arr2);

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fast-check-monorepo automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful