summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--combined.js10
-rw-r--r--js/Sources/GEN_SQR.js5
-rw-r--r--js/Sources/PULSE_SC.js5
-rwxr-xr-xsci2jsyacc.py27
4 files changed, 39 insertions, 8 deletions
diff --git a/combined.js b/combined.js
index 2a649e1e..5c0442fa 100644
--- a/combined.js
+++ b/combined.js
@@ -19661,7 +19661,10 @@ function GEN_SQR() {
}
GEN_SQR.prototype.get = function GEN_SQR() {
var options = {
- scicos_context.Amin:[this.Bitems,this.scicos_context.Amin],
+ scicos_context.Amin:["Minimum Value",this.scicos_context.Amin],
+ scicos_context.Amax:["Maximum Value",this.scicos_context.Amax],
+ scicos_context.rule:["Initial Value( 1= Minimum Value 2= Maximum Value)",this.scicos_context.rule],
+ scicos_context.F:["Period (sec)",this.scicos_context.F],
}
return options;
}
@@ -19976,7 +19979,10 @@ function PULSE_SC() {
}
PULSE_SC.prototype.get = function PULSE_SC() {
var options = {
- scicos_context.E:[this.Bitems,this.scicos_context.E],
+ scicos_context.E:["Phase delay (secs):",this.scicos_context.E],
+ scicos_context.W:["Pulse Width (% of period):",this.scicos_context.W],
+ scicos_context.F:["Period (secs):",this.scicos_context.F],
+ scicos_context.A:["Amplitude:",this.scicos_context.A],
}
return options;
}
diff --git a/js/Sources/GEN_SQR.js b/js/Sources/GEN_SQR.js
index e7765db5..9d42a6f6 100644
--- a/js/Sources/GEN_SQR.js
+++ b/js/Sources/GEN_SQR.js
@@ -55,7 +55,10 @@ function GEN_SQR() {
}
GEN_SQR.prototype.get = function GEN_SQR() {
var options = {
- scicos_context.Amin:[this.Bitems,this.scicos_context.Amin],
+ scicos_context.Amin:["Minimum Value",this.scicos_context.Amin],
+ scicos_context.Amax:["Maximum Value",this.scicos_context.Amax],
+ scicos_context.rule:["Initial Value( 1= Minimum Value 2= Maximum Value)",this.scicos_context.rule],
+ scicos_context.F:["Period (sec)",this.scicos_context.F],
}
return options;
}
diff --git a/js/Sources/PULSE_SC.js b/js/Sources/PULSE_SC.js
index bed27f9c..a24a6696 100644
--- a/js/Sources/PULSE_SC.js
+++ b/js/Sources/PULSE_SC.js
@@ -50,7 +50,10 @@ function PULSE_SC() {
}
PULSE_SC.prototype.get = function PULSE_SC() {
var options = {
- scicos_context.E:[this.Bitems,this.scicos_context.E],
+ scicos_context.E:["Phase delay (secs):",this.scicos_context.E],
+ scicos_context.W:["Pulse Width (% of period):",this.scicos_context.W],
+ scicos_context.F:["Period (secs):",this.scicos_context.F],
+ scicos_context.A:["Amplitude:",this.scicos_context.A],
}
return options;
}
diff --git a/sci2jsyacc.py b/sci2jsyacc.py
index 951805cf..b89c5bdc 100755
--- a/sci2jsyacc.py
+++ b/sci2jsyacc.py
@@ -73,6 +73,8 @@ GLOBAL_VARS = {
}
VAR_TYPES = {}
+VAR_DEFINITIONS = {}
+LAST_ARRAY = []
LABELS = []
@@ -549,7 +551,7 @@ VARCOUNT = 0
def p_lterm_assignment_expression(p):
'''assignment : lterm ASSIGNMENT expression EOL
| lterm ASSIGNMENT listcall EOL'''
- global VARCOUNT
+ global VARCOUNT, LAST_ARRAY
var = p[1]
if var[0] == '[':
prefix = 'var '
@@ -574,6 +576,9 @@ def p_lterm_assignment_expression(p):
prefix = 'var '
p[0] = '%*s%s%s = %s;\n' % (INDENT_LEVEL * INDENT_SIZE, ' ', prefix, var, value)
add_var_vartype(var, p[3][1])
+ if len(LAST_ARRAY) > 0:
+ VAR_DEFINITIONS[var] = LAST_ARRAY
+ LAST_ARRAY = []
def p_model_assignment_expression(p):
'''assignment : GRAPHICS ASSIGNMENT expression EOL
@@ -739,12 +744,22 @@ def p_getvaluearg2_gettext_string(p):
def p_getvaluearg2_var(p):
'getvaluearg2 : VAR'
- # TODO: replace with value of that variable
var = p[1]
add_global_var(var, force=True)
var = print_var(var)
- p[0] = '%s' % (var)
- LABELS.append(var)
+ if var in VAR_DEFINITIONS:
+ # replace variable with value of that variable
+ labels = VAR_DEFINITIONS[var]
+ s = '['
+ for l in labels:
+ s += l + ','
+ LABELS.append(l)
+ else:
+ s += ','
+ s = s[:-1] + ']'
+ else:
+ p[0] = '%s' % (var)
+ LABELS.append(var)
def p_getvaluearg2arraylist_arraylist_arraylistitem(p):
'''getvaluearg2arraylist : getvaluearg2arraylist SEMICOLON getvaluearg2arraylistitem
@@ -860,14 +875,18 @@ def p_ltermarraylistterm_prevar(p):
def p_termarrayarraylist_termarrayarraylist_semicolon_termarraylist(p):
'termarrayarraylist : termarrayarraylist SEMICOLON termarraylist'
p[0] = ('%s,[%s]' % (p[1][0], p[3][0]), p[1][1])
+ LAST_ARRAY.append(p[3][0])
def p_termarrayarraylist_termarraylist_semicolon_termarraylist(p):
'termarrayarraylist : termarraylist SEMICOLON termarraylist'
p[0] = ('[%s],[%s]' % (p[1][0], p[3][0]), p[1][1])
+ LAST_ARRAY.append(p[1][0])
+ LAST_ARRAY.append(p[3][0])
def p_termarrayarraylist_termarraylist_semicolon(p):
'termarrayarraylist : termarraylist SEMICOLON'
p[0] = ('[%s]' % (p[1][0]), p[1][1])
+ LAST_ARRAY.append(p[1][0])
def p_termarraylist_termarraylist_comma_expression(p):
'''termarraylist : termarraylist COMMA expression