@ai-ecoverse/wasm-gawk 5.3.2-2 → 5.4.1-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/bin/gawk +105 -74
  2. package/bin/gawk.wasm +0 -0
  3. package/package.json +2 -2
package/bin/gawk CHANGED
@@ -570,6 +570,83 @@ async function createWasm() {
570
570
 
571
571
 
572
572
 
573
+ var UTF8Decoder = globalThis.TextDecoder && new TextDecoder();
574
+
575
+ var findStringEnd = (heapOrArray, idx, maxBytesToRead, ignoreNul) => {
576
+ var maxIdx = idx + maxBytesToRead;
577
+ if (ignoreNul) return maxIdx;
578
+ // TextDecoder needs to know the byte length in advance, it doesn't stop on
579
+ // null terminator by itself.
580
+ // As a tiny code save trick, compare idx against maxIdx using a negation,
581
+ // so that maxBytesToRead=undefined/NaN means Infinity.
582
+ while (heapOrArray[idx] && !(idx >= maxIdx)) ++idx;
583
+ return idx;
584
+ };
585
+
586
+ /**
587
+ * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given
588
+ * array that contains uint8 values, returns a copy of that string as a
589
+ * Javascript String object.
590
+ * heapOrArray is either a regular array, or a JavaScript typed array view.
591
+ * @param {number=} idx
592
+ * @param {number=} maxBytesToRead
593
+ * @param {boolean=} ignoreNul - If true, the function will not stop on a NUL character.
594
+ * @return {string}
595
+ */
596
+ var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead, ignoreNul) => {
597
+
598
+ var endPtr = findStringEnd(heapOrArray, idx, maxBytesToRead, ignoreNul);
599
+
600
+ // When using conditional TextDecoder, skip it for short strings as the overhead of the native call is not worth it.
601
+ if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
602
+ return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
603
+ }
604
+ var str = '';
605
+ while (idx < endPtr) {
606
+ // For UTF8 byte structure, see:
607
+ // http://en.wikipedia.org/wiki/UTF-8#Description
608
+ // https://www.ietf.org/rfc/rfc2279.txt
609
+ // https://tools.ietf.org/html/rfc3629
610
+ var u0 = heapOrArray[idx++];
611
+ if (!(u0 & 0x80)) { str += String.fromCharCode(u0); continue; }
612
+ var u1 = heapOrArray[idx++] & 63;
613
+ if ((u0 & 0xE0) == 0xC0) { str += String.fromCharCode(((u0 & 31) << 6) | u1); continue; }
614
+ var u2 = heapOrArray[idx++] & 63;
615
+ if ((u0 & 0xF0) == 0xE0) {
616
+ u0 = ((u0 & 15) << 12) | (u1 << 6) | u2;
617
+ } else {
618
+ u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63);
619
+ }
620
+
621
+ if (u0 < 0x10000) {
622
+ str += String.fromCharCode(u0);
623
+ } else {
624
+ var ch = u0 - 0x10000;
625
+ str += String.fromCharCode(0xD800 | (ch >> 10), 0xDC00 | (ch & 0x3FF));
626
+ }
627
+ }
628
+ return str;
629
+ };
630
+
631
+ /**
632
+ * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the
633
+ * emscripten HEAP, returns a copy of that string as a Javascript String object.
634
+ *
635
+ * @param {number} ptr
636
+ * @param {number=} maxBytesToRead - An optional length that specifies the
637
+ * maximum number of bytes to read. You can omit this parameter to scan the
638
+ * string until the first 0 byte. If maxBytesToRead is passed, and the string
639
+ * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the
640
+ * string will cut short at that byte index.
641
+ * @param {boolean=} ignoreNul - If true, the function will not stop on a NUL character.
642
+ * @return {string}
643
+ */
644
+ var UTF8ToString = (ptr, maxBytesToRead, ignoreNul) => {
645
+ return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead, ignoreNul) : '';
646
+ };
647
+ var ___assert_fail = (condition, filename, line, func) =>
648
+ abort(`Assertion failed: ${UTF8ToString(condition)}, at: ` + [filename ? UTF8ToString(filename) : 'unknown filename', line, func ? UTF8ToString(func) : 'unknown function']);
649
+
573
650
  var wasmTableMirror = [];
574
651
 
575
652
 
@@ -714,63 +791,6 @@ async function createWasm() {
714
791
  };
715
792
 
716
793
 
717
- var UTF8Decoder = globalThis.TextDecoder && new TextDecoder();
718
-
719
- var findStringEnd = (heapOrArray, idx, maxBytesToRead, ignoreNul) => {
720
- var maxIdx = idx + maxBytesToRead;
721
- if (ignoreNul) return maxIdx;
722
- // TextDecoder needs to know the byte length in advance, it doesn't stop on
723
- // null terminator by itself.
724
- // As a tiny code save trick, compare idx against maxIdx using a negation,
725
- // so that maxBytesToRead=undefined/NaN means Infinity.
726
- while (heapOrArray[idx] && !(idx >= maxIdx)) ++idx;
727
- return idx;
728
- };
729
-
730
- /**
731
- * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given
732
- * array that contains uint8 values, returns a copy of that string as a
733
- * Javascript String object.
734
- * heapOrArray is either a regular array, or a JavaScript typed array view.
735
- * @param {number=} idx
736
- * @param {number=} maxBytesToRead
737
- * @param {boolean=} ignoreNul - If true, the function will not stop on a NUL character.
738
- * @return {string}
739
- */
740
- var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead, ignoreNul) => {
741
-
742
- var endPtr = findStringEnd(heapOrArray, idx, maxBytesToRead, ignoreNul);
743
-
744
- // When using conditional TextDecoder, skip it for short strings as the overhead of the native call is not worth it.
745
- if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
746
- return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
747
- }
748
- var str = '';
749
- while (idx < endPtr) {
750
- // For UTF8 byte structure, see:
751
- // http://en.wikipedia.org/wiki/UTF-8#Description
752
- // https://www.ietf.org/rfc/rfc2279.txt
753
- // https://tools.ietf.org/html/rfc3629
754
- var u0 = heapOrArray[idx++];
755
- if (!(u0 & 0x80)) { str += String.fromCharCode(u0); continue; }
756
- var u1 = heapOrArray[idx++] & 63;
757
- if ((u0 & 0xE0) == 0xC0) { str += String.fromCharCode(((u0 & 31) << 6) | u1); continue; }
758
- var u2 = heapOrArray[idx++] & 63;
759
- if ((u0 & 0xF0) == 0xE0) {
760
- u0 = ((u0 & 15) << 12) | (u1 << 6) | u2;
761
- } else {
762
- u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63);
763
- }
764
-
765
- if (u0 < 0x10000) {
766
- str += String.fromCharCode(u0);
767
- } else {
768
- var ch = u0 - 0x10000;
769
- str += String.fromCharCode(0xD800 | (ch >> 10), 0xDC00 | (ch & 0x3FF));
770
- }
771
- }
772
- return str;
773
- };
774
794
 
775
795
  var FS_stdin_getChar_buffer = [];
776
796
 
@@ -4006,23 +4026,6 @@ async function createWasm() {
4006
4026
 
4007
4027
 
4008
4028
 
4009
-
4010
- /**
4011
- * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the
4012
- * emscripten HEAP, returns a copy of that string as a Javascript String object.
4013
- *
4014
- * @param {number} ptr
4015
- * @param {number=} maxBytesToRead - An optional length that specifies the
4016
- * maximum number of bytes to read. You can omit this parameter to scan the
4017
- * string until the first 0 byte. If maxBytesToRead is passed, and the string
4018
- * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the
4019
- * string will cut short at that byte index.
4020
- * @param {boolean=} ignoreNul - If true, the function will not stop on a NUL character.
4021
- * @return {string}
4022
- */
4023
- var UTF8ToString = (ptr, maxBytesToRead, ignoreNul) => {
4024
- return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead, ignoreNul) : '';
4025
- };
4026
4029
  var SYSCALLS = {
4027
4030
  calculateAt(dirfd, path, allowEmpty) {
4028
4031
  if (PATH.isAbs(path)) {
@@ -5543,6 +5546,8 @@ function assignWasmExports(wasmExports) {
5543
5546
  }
5544
5547
 
5545
5548
  var wasmImports = {
5549
+ /** @export */
5550
+ __assert_fail: ___assert_fail,
5546
5551
  /** @export */
5547
5552
  __call_sighandler: ___call_sighandler,
5548
5553
  /** @export */
@@ -5634,6 +5639,8 @@ var wasmImports = {
5634
5639
  /** @export */
5635
5640
  invoke_iiiii,
5636
5641
  /** @export */
5642
+ invoke_iiiiii,
5643
+ /** @export */
5637
5644
  invoke_v,
5638
5645
  /** @export */
5639
5646
  invoke_vi,
@@ -5644,6 +5651,8 @@ var wasmImports = {
5644
5651
  /** @export */
5645
5652
  invoke_viiii,
5646
5653
  /** @export */
5654
+ invoke_viiiiii,
5655
+ /** @export */
5647
5656
  proc_exit: _proc_exit,
5648
5657
  /** @export */
5649
5658
  slicc_default_getpid_js,
@@ -5775,6 +5784,28 @@ function invoke_viiii(index,a1,a2,a3,a4) {
5775
5784
  }
5776
5785
  }
5777
5786
 
5787
+ function invoke_iiiiii(index,a1,a2,a3,a4,a5) {
5788
+ var sp = stackSave();
5789
+ try {
5790
+ return getWasmTableEntry(index)(a1,a2,a3,a4,a5);
5791
+ } catch(e) {
5792
+ stackRestore(sp);
5793
+ if (e !== e+0) throw e;
5794
+ _setThrew(1, 0);
5795
+ }
5796
+ }
5797
+
5798
+ function invoke_viiiiii(index,a1,a2,a3,a4,a5,a6) {
5799
+ var sp = stackSave();
5800
+ try {
5801
+ getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6);
5802
+ } catch(e) {
5803
+ stackRestore(sp);
5804
+ if (e !== e+0) throw e;
5805
+ _setThrew(1, 0);
5806
+ }
5807
+ }
5808
+
5778
5809
 
5779
5810
  // include: postamble.js
5780
5811
  // === Auto-generated postamble setup entry stuff ===
package/bin/gawk.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/wasm-gawk",
3
- "version": "5.3.2-2",
3
+ "version": "5.4.1-1",
4
4
  "description": "GNU awk for slicc (WASM / emscripten, SLICC homescoop)",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "repository": {
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "homescoop": {
28
28
  "recipe": "gawk",
29
- "upstream": "5.3.2"
29
+ "upstream": "5.4.1"
30
30
  },
31
31
  "slicc": {
32
32
  "abi": "emscripten",