[Mumps2Py:] [110] added support for translating the $SELECT intrinsic function. |
[ Thread Index |
Date Index
| More lists.mumps2py.org/discuss Archives
]
Revision: 110
Author: pgallot
Date: 2008-02-14 15:35:48 +0000 (Thu, 14 Feb 2008)
Log Message:
-----------
added support for translating the $SELECT intrinsic function.
Modified Paths:
--------------
trunk/mumps2py/tok2python.py
Modified: trunk/mumps2py/tok2python.py
===================================================================
--- trunk/mumps2py/tok2python.py 2008-02-14 15:35:12 UTC (rev 109)
+++ trunk/mumps2py/tok2python.py 2008-02-14 15:35:48 UTC (rev 110)
@@ -316,6 +316,23 @@
"incorrect number of parameters")
return reverse_str
+ def translate_intr_select(translation, token):
+ """ translates the Mumps Intrinsic function REVERSE to Python"""
+ assert((len(token.params) % 2) != 1)
+ translation.add_cl_import()
+ select_str = "Mf_select(("
+ while token.params:
+ testcase = token.params.pop(0)
+ testvalue = token.params.pop(0)
+ select_str ="%s(%s, %s), " % \
+ (select_str,
+ translate_expr(translation, testcase),
+ translate_expr(translation, testvalue))
+
+ select_str = select_str + "))"
+ return select_str
+
+
def translate_intr_translate(translation, token):
""" translates the Mumps Intrinsic function TRANSLATE to Python"""
translation.add_cl_import()
@@ -452,6 +469,7 @@
F_PIECE: translate_intr_piece,
F_RANDOM: translate_intr_random,
F_REVERSE: translate_intr_reverse,
+ F_SELECT: translate_intr_select,
F_TRANSLATE: translate_intr_translate,
V_HOROLOG: translate_intr_horolog,
EXPR: translate_expr_list}