| 107 | pass |
| 108 | |
| 109 | class JsEngine(): |
| 110 | def __init__(self): |
| 111 | self.engine = ENGINE |
| 112 | self.init = False |
| 113 | |
| 114 | def __nonzero__(self): |
| 115 | return False if not ENGINE else True |
| 116 | |
| 117 | def eval(self, script): |
| 118 | if not self.init: |
| 119 | if ENGINE == "pyv8" or (DEBUG and PYV8): |
| 120 | import PyV8 |
| 121 | global PyV8 |
| 122 | |
| 123 | self.init = True |
| 124 | |
| 125 | if type(script) == unicode: |
| 126 | script = script.encode("utf8") |
| 127 | |
| 128 | if not ENGINE: |
| 129 | raise Exception("No JS Engine") |
| 130 | |
| 131 | if not DEBUG: |
| 132 | if ENGINE == "pyv8": |
| 133 | return self.eval_pyv8(script) |
| 134 | elif ENGINE == "js2py": |
| 135 | return self.eval_js2py(script) |
| 136 | elif ENGINE == "js": |
| 137 | return self.eval_js(script) |
| 138 | elif ENGINE == "node": |
| 139 | return self.eval_node(script) |
| 140 | elif ENGINE == "rhino": |
| 141 | return self.eval_rhino(script) |
| 142 | else: |
| 143 | results = [] |
| 144 | if PYV8: |
| 145 | res = self.eval_pyv8(script) |
| 146 | print "PyV8:", res |
| 147 | results.append(res) |
| 148 | if JS2PY: |
| 149 | res = self.eval_js2py(script) |
| 150 | print "js2py:", res |
| 151 | results.append(res) |
| 152 | if JS: |
| 153 | res = self.eval_js(script) |
| 154 | print "JS:", res |
| 155 | results.append(res) |
| 156 | if NODE: |
| 157 | res = self.eval_node(script) |
| 158 | print "NODE:", res |
| 159 | results.append(res) |
| 160 | if RHINO: |
| 161 | res = self.eval_rhino(script) |
| 162 | print "Rhino:", res |
| 163 | results.append(res) |
| 164 | |
| 165 | warning = False |
| 166 | for x in results: |
no outgoing calls
no test coverage detected