@sdeverywhere/compile 0.7.26 → 0.7.28
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.
- package/package.json +2 -2
- package/src/generate/gen-code-c.js +86 -36
- package/src/generate/gen-code-js.js +59 -0
- package/src/generate/gen-expr.js +87 -37
- package/src/index.js +9 -1
- package/src/model/model.js +79 -5
- package/src/model/read-equation-fn-delay.js +6 -4
- package/src/model/read-equation-fn-smooth.js +7 -5
- package/src/model/read-equation-fn-trend.js +1 -1
- package/src/model/read-equations.js +541 -234
- package/src/parse-and-generate.js +35 -23
|
@@ -15,10 +15,12 @@ import Model from './model.js'
|
|
|
15
15
|
/**
|
|
16
16
|
* Generate level and aux variables that implement one of the following `SMOOTH` function
|
|
17
17
|
* call variants:
|
|
18
|
-
* - SMOOTH
|
|
19
|
-
* - SMOOTHI
|
|
20
|
-
* - SMOOTH3
|
|
21
|
-
* - SMOOTH3I
|
|
18
|
+
* - SMOOTH (Vensim)
|
|
19
|
+
* - SMOOTHI (Vensim)
|
|
20
|
+
* - SMOOTH3 (Vensim)
|
|
21
|
+
* - SMOOTH3I (Vensim)
|
|
22
|
+
* - SMTH1 (Stella)
|
|
23
|
+
* - SMTH3 (Stella)
|
|
22
24
|
*
|
|
23
25
|
* TODO: Docs
|
|
24
26
|
*
|
|
@@ -43,7 +45,7 @@ export function generateSmoothVariables(v, callExpr, context) {
|
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
const fnId = callExpr.fnId
|
|
46
|
-
if (fnId === '_SMOOTH' || fnId === '_SMOOTHI') {
|
|
48
|
+
if (fnId === '_SMOOTH' || fnId === '_SMOOTHI' || fnId === '_SMTH1') {
|
|
47
49
|
// Generate 1 level variable that will replace the `SMOOTH[I]` function call
|
|
48
50
|
const level = generateSmoothLevel(v, context, argInput, argDelay, argInit, 1)
|
|
49
51
|
// For `SMOOTH[I]`, the smoothVarRefId is the level var's refId
|
|
@@ -3,7 +3,7 @@ import { toPrettyString } from '@sdeverywhere/parse'
|
|
|
3
3
|
import { canonicalName, newAuxVarName, newLevelVarName } from '../_shared/helpers.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Generate two level variables and one aux that implement an `
|
|
6
|
+
* Generate two level variables and one aux that implement an `TREND` function call.
|
|
7
7
|
*
|
|
8
8
|
* TODO: Docs
|
|
9
9
|
*
|