summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--combined.js32
-rw-r--r--js/Events/freq_div.js8
-rw-r--r--js/Sources/GEN_SQR.js12
-rw-r--r--js/Sources/GEN_SQR.pickle24
-rw-r--r--js/Sources/PULSE_SC.js12
-rw-r--r--js/Sources/PULSE_SC.pickle24
-rwxr-xr-xsci2jsyacc.py18
7 files changed, 70 insertions, 60 deletions
diff --git a/combined.js b/combined.js
index b555bedb..2a649e1e 100644
--- a/combined.js
+++ b/combined.js
@@ -3969,8 +3969,8 @@ function freq_div() {
}
freq_div.prototype.get = function freq_div() {
var options = {
- %ph:["Phase (0 to division factor -1)",%ph],
- %df:["Division factor",%df],
+ %ph:["Phase (0 to division factor -1)",this.%ph],
+ %df:["Division factor",this.%df],
}
return options;
}
@@ -3993,8 +3993,8 @@ function freq_div() {
this.model = xx.model;
while (true) {
var ok = true;
- %ph = parseFloat(arguments[0]["%ph"]);
- %df = parseFloat(arguments[0]["%df"]);
+ this.%ph = parseFloat(arguments[0]["%ph"]);
+ this.%df = parseFloat(arguments[0]["%df"]);
if (!ok) {
break;
}
@@ -19661,7 +19661,7 @@ function GEN_SQR() {
}
GEN_SQR.prototype.get = function GEN_SQR() {
var options = {
- scicos_context.Amin:[Bitems,scicos_context.Amin],
+ scicos_context.Amin:[this.Bitems,this.scicos_context.Amin],
}
return options;
}
@@ -19671,16 +19671,16 @@ function GEN_SQR() {
this.exprs = this.graphics.exprs;
var Btitre = "Set GEN_SQR parameters";
var Exprs0 = [["Amin"],["Amax"],["rule"],["F"]];
- var Bitems = [["Minimum Value"],["Maximum Value"],["Initial Value( 1= Minimum Value 2= Maximum Value)"],["Period (sec)"]];
+ this.Bitems = [["Minimum Value"],["Maximum Value"],["Initial Value( 1= Minimum Value 2= Maximum Value)"],["Period (sec)"]];
var Ss = list("mat",[-1,-1],"mat",[-1,-1],"pol",-1,"pol",-1);
var scicos_context = struct();
var ok = false;
while (!ok) {
var ok = true;
- scicos_context.Amin = arguments[0]["scicos_context.Amin"];
- scicos_context.Amax = arguments[0]["scicos_context.Amax"];
- scicos_context.rule = arguments[0]["scicos_context.rule"];
- scicos_context.F = arguments[0]["scicos_context.F"];
+ this.scicos_context.Amin = arguments[0]["scicos_context.Amin"];
+ this.scicos_context.Amax = arguments[0]["scicos_context.Amax"];
+ this.scicos_context.rule = arguments[0]["scicos_context.rule"];
+ this.scicos_context.F = arguments[0]["scicos_context.F"];
if (!ok) {
return;
}
@@ -19976,7 +19976,7 @@ function PULSE_SC() {
}
PULSE_SC.prototype.get = function PULSE_SC() {
var options = {
- scicos_context.E:[Bitems,scicos_context.E],
+ scicos_context.E:[this.Bitems,this.scicos_context.E],
}
return options;
}
@@ -19986,16 +19986,16 @@ function PULSE_SC() {
this.exprs = this.graphics.exprs;
var Btitre = "Set Pulse Generator parameters";
var Exprs0 = [["E"],["W"],["F"],["A"]];
- var Bitems = [["Phase delay (secs):"],["Pulse Width (% of period):"],["Period (secs):"],["Amplitude:"]];
+ this.Bitems = [["Phase delay (secs):"],["Pulse Width (% of period):"],["Period (secs):"],["Amplitude:"]];
var Ss = list("pol",-1,"pol",-1,"pol",-1,"mat",[-1,-1]);
var scicos_context = struct();
var ok = false;
while (!ok) {
var ok = true;
- scicos_context.E = arguments[0]["scicos_context.E"];
- scicos_context.W = arguments[0]["scicos_context.W"];
- scicos_context.F = arguments[0]["scicos_context.F"];
- scicos_context.A = arguments[0]["scicos_context.A"];
+ this.scicos_context.E = arguments[0]["scicos_context.E"];
+ this.scicos_context.W = arguments[0]["scicos_context.W"];
+ this.scicos_context.F = arguments[0]["scicos_context.F"];
+ this.scicos_context.A = arguments[0]["scicos_context.A"];
if (!ok) {
return;
}
diff --git a/js/Events/freq_div.js b/js/Events/freq_div.js
index 29e107c4..1531f9e7 100644
--- a/js/Events/freq_div.js
+++ b/js/Events/freq_div.js
@@ -112,8 +112,8 @@ function freq_div() {
}
freq_div.prototype.get = function freq_div() {
var options = {
- %ph:["Phase (0 to division factor -1)",%ph],
- %df:["Division factor",%df],
+ %ph:["Phase (0 to division factor -1)",this.%ph],
+ %df:["Division factor",this.%df],
}
return options;
}
@@ -136,8 +136,8 @@ function freq_div() {
this.model = xx.model;
while (true) {
var ok = true;
- %ph = parseFloat(arguments[0]["%ph"]);
- %df = parseFloat(arguments[0]["%df"]);
+ this.%ph = parseFloat(arguments[0]["%ph"]);
+ this.%df = parseFloat(arguments[0]["%df"]);
if (!ok) {
break;
}
diff --git a/js/Sources/GEN_SQR.js b/js/Sources/GEN_SQR.js
index ff2f90ef..e7765db5 100644
--- a/js/Sources/GEN_SQR.js
+++ b/js/Sources/GEN_SQR.js
@@ -55,7 +55,7 @@ function GEN_SQR() {
}
GEN_SQR.prototype.get = function GEN_SQR() {
var options = {
- scicos_context.Amin:[Bitems,scicos_context.Amin],
+ scicos_context.Amin:[this.Bitems,this.scicos_context.Amin],
}
return options;
}
@@ -65,16 +65,16 @@ function GEN_SQR() {
this.exprs = this.graphics.exprs;
var Btitre = "Set GEN_SQR parameters";
var Exprs0 = [["Amin"],["Amax"],["rule"],["F"]];
- var Bitems = [["Minimum Value"],["Maximum Value"],["Initial Value( 1= Minimum Value 2= Maximum Value)"],["Period (sec)"]];
+ this.Bitems = [["Minimum Value"],["Maximum Value"],["Initial Value( 1= Minimum Value 2= Maximum Value)"],["Period (sec)"]];
var Ss = list("mat",[-1,-1],"mat",[-1,-1],"pol",-1,"pol",-1);
var scicos_context = struct();
var ok = false;
while (!ok) {
var ok = true;
- scicos_context.Amin = arguments[0]["scicos_context.Amin"];
- scicos_context.Amax = arguments[0]["scicos_context.Amax"];
- scicos_context.rule = arguments[0]["scicos_context.rule"];
- scicos_context.F = arguments[0]["scicos_context.F"];
+ this.scicos_context.Amin = arguments[0]["scicos_context.Amin"];
+ this.scicos_context.Amax = arguments[0]["scicos_context.Amax"];
+ this.scicos_context.rule = arguments[0]["scicos_context.rule"];
+ this.scicos_context.F = arguments[0]["scicos_context.F"];
if (!ok) {
return;
}
diff --git a/js/Sources/GEN_SQR.pickle b/js/Sources/GEN_SQR.pickle
index db3ad103..df14bd84 100644
--- a/js/Sources/GEN_SQR.pickle
+++ b/js/Sources/GEN_SQR.pickle
@@ -4,26 +4,28 @@ p0
((lp1
S'needcompile'
p2
-aS'scicos_context.Amax'
+aS'Bitems'
p3
-aS'scicos_context.rule'
+aS'scicos_context.Amax'
p4
-aS'exprs'
+aS'scicos_context.rule'
p5
-aS'gr_i'
+aS'exprs'
p6
-aS'graphics'
+aS'gr_i'
p7
-aS'x'
+aS'graphics'
p8
-aS'model'
+aS'x'
p9
-aS'scicos_context.F'
+aS'model'
p10
-aS'scicos_context.Amin'
+aS'scicos_context.F'
p11
-atp12
-Rp13
+aS'scicos_context.Amin'
+p12
+atp13
+Rp14
.(dp0
S'model.odstate'
p1
diff --git a/js/Sources/PULSE_SC.js b/js/Sources/PULSE_SC.js
index 2ad17f19..bed27f9c 100644
--- a/js/Sources/PULSE_SC.js
+++ b/js/Sources/PULSE_SC.js
@@ -50,7 +50,7 @@ function PULSE_SC() {
}
PULSE_SC.prototype.get = function PULSE_SC() {
var options = {
- scicos_context.E:[Bitems,scicos_context.E],
+ scicos_context.E:[this.Bitems,this.scicos_context.E],
}
return options;
}
@@ -60,16 +60,16 @@ function PULSE_SC() {
this.exprs = this.graphics.exprs;
var Btitre = "Set Pulse Generator parameters";
var Exprs0 = [["E"],["W"],["F"],["A"]];
- var Bitems = [["Phase delay (secs):"],["Pulse Width (% of period):"],["Period (secs):"],["Amplitude:"]];
+ this.Bitems = [["Phase delay (secs):"],["Pulse Width (% of period):"],["Period (secs):"],["Amplitude:"]];
var Ss = list("pol",-1,"pol",-1,"pol",-1,"mat",[-1,-1]);
var scicos_context = struct();
var ok = false;
while (!ok) {
var ok = true;
- scicos_context.E = arguments[0]["scicos_context.E"];
- scicos_context.W = arguments[0]["scicos_context.W"];
- scicos_context.F = arguments[0]["scicos_context.F"];
- scicos_context.A = arguments[0]["scicos_context.A"];
+ this.scicos_context.E = arguments[0]["scicos_context.E"];
+ this.scicos_context.W = arguments[0]["scicos_context.W"];
+ this.scicos_context.F = arguments[0]["scicos_context.F"];
+ this.scicos_context.A = arguments[0]["scicos_context.A"];
if (!ok) {
return;
}
diff --git a/js/Sources/PULSE_SC.pickle b/js/Sources/PULSE_SC.pickle
index 49a18971..1d112dc6 100644
--- a/js/Sources/PULSE_SC.pickle
+++ b/js/Sources/PULSE_SC.pickle
@@ -4,26 +4,28 @@ p0
((lp1
S'needcompile'
p2
-aS'scicos_context.W'
+aS'Bitems'
p3
-aS'exprs'
+aS'scicos_context.W'
p4
-aS'gr_i'
+aS'exprs'
p5
-aS'graphics'
+aS'gr_i'
p6
-aS'x'
+aS'graphics'
p7
-aS'model'
+aS'x'
p8
-aS'scicos_context.A'
+aS'model'
p9
-aS'scicos_context.F'
+aS'scicos_context.A'
p10
-aS'scicos_context.E'
+aS'scicos_context.F'
p11
-atp12
-Rp13
+aS'scicos_context.E'
+p12
+atp13
+Rp14
.(dp0
S'model.odstate'
p1
diff --git a/sci2jsyacc.py b/sci2jsyacc.py
index f567b9e7..ad17ed1d 100755
--- a/sci2jsyacc.py
+++ b/sci2jsyacc.py
@@ -414,6 +414,7 @@ def p_forstatement_for_start_step_end(p):
endop = '>='
stepop = '-='
add_local_var(var)
+ var = print_var(var)
p[0] = '%*sfor (%s=%s;%s%s%s;%s%s%s) {\n' % (INDENT_LEVEL * INDENT_SIZE, ' ', var, lstart, var, endop, lend, var, stepop, lstep)
INDENT_LEVEL += 1
@@ -428,6 +429,7 @@ def p_forstatement_for_start_end(p):
endop = '<='
stepop = '+='
add_local_var(var)
+ var = print_var(var)
p[0] = '%*sfor (%s=%s;%s%s%s;%s%s%s) {\n' % (INDENT_LEVEL * INDENT_SIZE, ' ', var, lstart, var, endop, lend, var, stepop, lstep)
INDENT_LEVEL += 1
@@ -437,7 +439,7 @@ def p_forstatement_for_list(p):
global INDENT_LEVEL
var = p[2]
add_local_var(var)
- p[0] = '%*sfor (%s in %s) {\n' % (INDENT_LEVEL * INDENT_SIZE, ' ', var, p[4])
+ p[0] = '%*sfor (%s in %s) {\n' % (INDENT_LEVEL * INDENT_SIZE, ' ', print_var(var), p[4])
INDENT_LEVEL += 1
def p_selectstatement_select(p):
@@ -551,9 +553,9 @@ def p_lterm_assignment_expression(p):
def p_model_assignment_expression(p):
'''assignment : GRAPHICS ASSIGNMENT expression EOL
| MODEL ASSIGNMENT expression EOL'''
- p[0] = '%*sthis.%s = %s;\n' % (INDENT_LEVEL * INDENT_SIZE, ' ', p[1], p[3][0])
var = p[1]
add_global_var(var)
+ p[0] = '%*s%s = %s;\n' % (INDENT_LEVEL * INDENT_SIZE, ' ', print_var(var), p[3][0])
add_var_vartype(var, p[3][1])
def p_modelvar_modelvar_var(p):
@@ -657,7 +659,7 @@ def p_getvalueassignment_getvalue_arguments(p):
global OPTIONS_BLOCK
var = 'ok'
add_local_var(var)
- p[0] = '%*svar %s = true;\n' % (INDENT_LEVEL * INDENT_SIZE, ' ', var)
+ p[0] = '%*svar %s = true;\n' % (INDENT_LEVEL * INDENT_SIZE, ' ', print_var(var))
lterm = p[1]
if lterm[0] == '[':
lterm = lterm[1:-1]
@@ -670,7 +672,8 @@ def p_getvalueassignment_getvalue_arguments(p):
basevar = var
if basevar in ('ok', 'exprs'):
continue
- add_global_var(var, force=True)
+ add_global_var(basevar, force=True)
+ var = print_var(basevar)
vartype = VAR_TYPES.get(basevar, STRING_TYPE)
parsefunction = PARSE_MAP.get(vartype, '')
if parsefunction != '':
@@ -712,8 +715,11 @@ def p_getvaluearg2_gettext_string(p):
def p_getvaluearg2_var(p):
'getvaluearg2 : VAR'
# TODO: replace with value of that variable
- p[0] = '%s' % (p[1])
- LABELS.append(p[0])
+ var = p[1]
+ add_global_var(var, force=True)
+ var = print_var(var)
+ p[0] = '%s' % (var)
+ LABELS.append(var)
def p_getvaluearg2arraylist_arraylist_arraylistitem(p):
'''getvaluearg2arraylist : getvaluearg2arraylist SEMICOLON getvaluearg2arraylistitem