@abaplint/runtime 2.13.39 → 2.13.40

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.
@@ -7,5 +7,6 @@ export interface IConcatenateInput {
7
7
  separatedBy?: number | string | INumeric | ICharacter;
8
8
  respectingBlanks?: boolean;
9
9
  lines?: boolean;
10
+ byteMode?: boolean;
10
11
  }
11
12
  export declare function concatenate(input: IConcatenateInput): void;
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.concatenate = concatenate;
4
4
  const types_1 = require("../types");
5
5
  function concatenate(input) {
6
+ if (input.byteMode === true) {
7
+ concatenateByteMode(input);
8
+ return;
9
+ }
6
10
  let sep = "";
7
11
  if (input.separatedBy) {
8
12
  if (typeof input.separatedBy === "string" || typeof input.separatedBy === "number") {
@@ -56,4 +60,42 @@ function concatenate(input) {
56
60
  input.target.set(result);
57
61
  }
58
62
  }
63
+ function rawByteValue(source) {
64
+ if (typeof source === "string") {
65
+ return source;
66
+ }
67
+ else if (typeof source === "number") {
68
+ return source.toString();
69
+ }
70
+ else {
71
+ return source.get().toString();
72
+ }
73
+ }
74
+ function concatenateByteMode(input) {
75
+ let sep = "";
76
+ if (input.separatedBy !== undefined) {
77
+ sep = rawByteValue(input.separatedBy);
78
+ }
79
+ let result = "";
80
+ if (input.lines === true) {
81
+ const tab = input.source[0];
82
+ if (tab instanceof types_1.Table) {
83
+ for (const l of tab.array()) {
84
+ result += l.get().toString() + sep;
85
+ }
86
+ }
87
+ }
88
+ else {
89
+ for (const source of input.source) {
90
+ if (source instanceof types_1.Table) {
91
+ throw new Error("concatenate, error: input is table");
92
+ }
93
+ result += rawByteValue(source) + sep;
94
+ }
95
+ }
96
+ if (sep.length > 0 && result.length > 0) {
97
+ result = result.slice(0, result.length - sep.length);
98
+ }
99
+ input.target.set(result);
100
+ }
59
101
  //# sourceMappingURL=concatenate.js.map
@@ -2,13 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.wait = wait;
4
4
  async function wait(options) {
5
- await new Promise(r => setTimeout(r, 50));
5
+ const timeout = options.seconds === undefined ? undefined : options.seconds.get() * 1000;
6
+ const deadline = timeout === undefined ? undefined : Date.now() + timeout;
6
7
  while (true) {
7
8
  if (options.cond() === true) {
8
- break;
9
+ abap.builtin.sy.get().subrc.set(0);
10
+ return;
9
11
  }
10
- await new Promise(r => setTimeout(r, 500));
11
- console.log("WAIT waiting another round");
12
+ const remaining = deadline === undefined ? 500 : deadline - Date.now();
13
+ if (remaining <= 0) {
14
+ abap.builtin.sy.get().subrc.set(8);
15
+ return;
16
+ }
17
+ await new Promise(r => setTimeout(r, Math.min(500, remaining)));
12
18
  }
13
19
  }
14
20
  //# sourceMappingURL=wait.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.13.39",
3
+ "version": "2.13.40",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",