one_ini.js 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. let imports = {};
  2. imports['__wbindgen_placeholder__'] = module.exports;
  3. let wasm;
  4. const { TextDecoder, TextEncoder } = require(`util`);
  5. const heap = new Array(32).fill(undefined);
  6. heap.push(undefined, null, true, false);
  7. function getObject(idx) { return heap[idx]; }
  8. let heap_next = heap.length;
  9. function dropObject(idx) {
  10. if (idx < 36) return;
  11. heap[idx] = heap_next;
  12. heap_next = idx;
  13. }
  14. function takeObject(idx) {
  15. const ret = getObject(idx);
  16. dropObject(idx);
  17. return ret;
  18. }
  19. let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
  20. cachedTextDecoder.decode();
  21. let cachedUint8Memory0 = new Uint8Array();
  22. function getUint8Memory0() {
  23. if (cachedUint8Memory0.byteLength === 0) {
  24. cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
  25. }
  26. return cachedUint8Memory0;
  27. }
  28. function getStringFromWasm0(ptr, len) {
  29. return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
  30. }
  31. function addHeapObject(obj) {
  32. if (heap_next === heap.length) heap.push(heap.length + 1);
  33. const idx = heap_next;
  34. heap_next = heap[idx];
  35. heap[idx] = obj;
  36. return idx;
  37. }
  38. function debugString(val) {
  39. // primitive types
  40. const type = typeof val;
  41. if (type == 'number' || type == 'boolean' || val == null) {
  42. return `${val}`;
  43. }
  44. if (type == 'string') {
  45. return `"${val}"`;
  46. }
  47. if (type == 'symbol') {
  48. const description = val.description;
  49. if (description == null) {
  50. return 'Symbol';
  51. } else {
  52. return `Symbol(${description})`;
  53. }
  54. }
  55. if (type == 'function') {
  56. const name = val.name;
  57. if (typeof name == 'string' && name.length > 0) {
  58. return `Function(${name})`;
  59. } else {
  60. return 'Function';
  61. }
  62. }
  63. // objects
  64. if (Array.isArray(val)) {
  65. const length = val.length;
  66. let debug = '[';
  67. if (length > 0) {
  68. debug += debugString(val[0]);
  69. }
  70. for(let i = 1; i < length; i++) {
  71. debug += ', ' + debugString(val[i]);
  72. }
  73. debug += ']';
  74. return debug;
  75. }
  76. // Test for built-in
  77. const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
  78. let className;
  79. if (builtInMatches.length > 1) {
  80. className = builtInMatches[1];
  81. } else {
  82. // Failed to match the standard '[object ClassName]'
  83. return toString.call(val);
  84. }
  85. if (className == 'Object') {
  86. // we're a user defined class or Object
  87. // JSON.stringify avoids problems with cycles, and is generally much
  88. // easier than looping through ownProperties of `val`.
  89. try {
  90. return 'Object(' + JSON.stringify(val) + ')';
  91. } catch (_) {
  92. return 'Object';
  93. }
  94. }
  95. // errors
  96. if (val instanceof Error) {
  97. return `${val.name}: ${val.message}\n${val.stack}`;
  98. }
  99. // TODO we could test for more things here, like `Set`s and `Map`s.
  100. return className;
  101. }
  102. let WASM_VECTOR_LEN = 0;
  103. let cachedTextEncoder = new TextEncoder('utf-8');
  104. const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
  105. ? function (arg, view) {
  106. return cachedTextEncoder.encodeInto(arg, view);
  107. }
  108. : function (arg, view) {
  109. const buf = cachedTextEncoder.encode(arg);
  110. view.set(buf);
  111. return {
  112. read: arg.length,
  113. written: buf.length
  114. };
  115. });
  116. function passStringToWasm0(arg, malloc, realloc) {
  117. if (realloc === undefined) {
  118. const buf = cachedTextEncoder.encode(arg);
  119. const ptr = malloc(buf.length);
  120. getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
  121. WASM_VECTOR_LEN = buf.length;
  122. return ptr;
  123. }
  124. let len = arg.length;
  125. let ptr = malloc(len);
  126. const mem = getUint8Memory0();
  127. let offset = 0;
  128. for (; offset < len; offset++) {
  129. const code = arg.charCodeAt(offset);
  130. if (code > 0x7F) break;
  131. mem[ptr + offset] = code;
  132. }
  133. if (offset !== len) {
  134. if (offset !== 0) {
  135. arg = arg.slice(offset);
  136. }
  137. ptr = realloc(ptr, len, len = offset + arg.length * 3);
  138. const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
  139. const ret = encodeString(arg, view);
  140. offset += ret.written;
  141. }
  142. WASM_VECTOR_LEN = offset;
  143. return ptr;
  144. }
  145. let cachedInt32Memory0 = new Int32Array();
  146. function getInt32Memory0() {
  147. if (cachedInt32Memory0.byteLength === 0) {
  148. cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
  149. }
  150. return cachedInt32Memory0;
  151. }
  152. /**
  153. * @param {string} contents
  154. * @returns {any}
  155. */
  156. module.exports.parse_to_json = function(contents) {
  157. const ptr0 = passStringToWasm0(contents, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
  158. const len0 = WASM_VECTOR_LEN;
  159. const ret = wasm.parse_to_json(ptr0, len0);
  160. return takeObject(ret);
  161. };
  162. /**
  163. * @returns {string}
  164. */
  165. module.exports.version = function() {
  166. try {
  167. const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
  168. wasm.version(retptr);
  169. var r0 = getInt32Memory0()[retptr / 4 + 0];
  170. var r1 = getInt32Memory0()[retptr / 4 + 1];
  171. return getStringFromWasm0(r0, r1);
  172. } finally {
  173. wasm.__wbindgen_add_to_stack_pointer(16);
  174. wasm.__wbindgen_free(r0, r1);
  175. }
  176. };
  177. function passArray8ToWasm0(arg, malloc) {
  178. const ptr = malloc(arg.length * 1);
  179. getUint8Memory0().set(arg, ptr / 1);
  180. WASM_VECTOR_LEN = arg.length;
  181. return ptr;
  182. }
  183. let cachedUint32Memory0 = new Uint32Array();
  184. function getUint32Memory0() {
  185. if (cachedUint32Memory0.byteLength === 0) {
  186. cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
  187. }
  188. return cachedUint32Memory0;
  189. }
  190. function getArrayU32FromWasm0(ptr, len) {
  191. return getUint32Memory0().subarray(ptr / 4, ptr / 4 + len);
  192. }
  193. /**
  194. * @param {Uint8Array} contents
  195. * @returns {Uint32Array}
  196. */
  197. module.exports.parse_to_uint32array = function(contents) {
  198. try {
  199. const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
  200. const ptr0 = passArray8ToWasm0(contents, wasm.__wbindgen_malloc);
  201. const len0 = WASM_VECTOR_LEN;
  202. wasm.parse_to_uint32array(retptr, ptr0, len0);
  203. var r0 = getInt32Memory0()[retptr / 4 + 0];
  204. var r1 = getInt32Memory0()[retptr / 4 + 1];
  205. var r2 = getInt32Memory0()[retptr / 4 + 2];
  206. var r3 = getInt32Memory0()[retptr / 4 + 3];
  207. if (r3) {
  208. throw takeObject(r2);
  209. }
  210. var v1 = getArrayU32FromWasm0(r0, r1).slice();
  211. wasm.__wbindgen_free(r0, r1 * 4);
  212. return v1;
  213. } finally {
  214. wasm.__wbindgen_add_to_stack_pointer(16);
  215. }
  216. };
  217. function handleError(f, args) {
  218. try {
  219. return f.apply(this, args);
  220. } catch (e) {
  221. wasm.__wbindgen_exn_store(addHeapObject(e));
  222. }
  223. }
  224. /**
  225. */
  226. module.exports.TokenTypes = Object.freeze({ Key:0,"0":"Key",Value:1,"1":"Value",Section:2,"2":"Section",CommentIndicator:3,"3":"CommentIndicator",CommentValue:4,"4":"CommentValue", });
  227. module.exports.__wbindgen_object_drop_ref = function(arg0) {
  228. takeObject(arg0);
  229. };
  230. module.exports.__wbindgen_error_new = function(arg0, arg1) {
  231. const ret = new Error(getStringFromWasm0(arg0, arg1));
  232. return addHeapObject(ret);
  233. };
  234. module.exports.__wbindgen_string_new = function(arg0, arg1) {
  235. const ret = getStringFromWasm0(arg0, arg1);
  236. return addHeapObject(ret);
  237. };
  238. module.exports.__wbindgen_object_clone_ref = function(arg0) {
  239. const ret = getObject(arg0);
  240. return addHeapObject(ret);
  241. };
  242. module.exports.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) {
  243. getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
  244. };
  245. module.exports.__wbg_new_1d9a920c6bfc44a8 = function() {
  246. const ret = new Array();
  247. return addHeapObject(ret);
  248. };
  249. module.exports.__wbg_new_0b9bfdd97583284e = function() {
  250. const ret = new Object();
  251. return addHeapObject(ret);
  252. };
  253. module.exports.__wbg_set_a68214f35c417fa9 = function(arg0, arg1, arg2) {
  254. getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
  255. };
  256. module.exports.__wbg_fromCodePoint_3a5b15ba4d213634 = function() { return handleError(function (arg0) {
  257. const ret = String.fromCodePoint(arg0 >>> 0);
  258. return addHeapObject(ret);
  259. }, arguments) };
  260. module.exports.__wbindgen_debug_string = function(arg0, arg1) {
  261. const ret = debugString(getObject(arg1));
  262. const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
  263. const len0 = WASM_VECTOR_LEN;
  264. getInt32Memory0()[arg0 / 4 + 1] = len0;
  265. getInt32Memory0()[arg0 / 4 + 0] = ptr0;
  266. };
  267. module.exports.__wbindgen_throw = function(arg0, arg1) {
  268. throw new Error(getStringFromWasm0(arg0, arg1));
  269. };
  270. const path = require('path').join(__dirname, 'one_ini_bg.wasm');
  271. const bytes = require('fs').readFileSync(path);
  272. const wasmModule = new WebAssembly.Module(bytes);
  273. const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
  274. wasm = wasmInstance.exports;
  275. module.exports.__wasm = wasm;