author | Andrey Skvortsov <andrej.skvortzov@gmail.com> |
Mon, 14 Aug 2017 21:20:32 +0300 | |
changeset 1732 | 94ffe74e6895 |
parent 1730 | 64d8f52bc8c8 |
child 1736 | 7e61baa047f0 |
permissions | -rw-r--r-- |
371 | 1 |
# the platform name (PyV8, smjs, Mozilla, IE6, Opera, Safari etc.) |
2 |
platform = '' # to be updated by app, on compile |
|
3 |
||
4 |
# a dictionary of module override names (platform-specific) |
|
5 |
overrides = None # to be updated by app, on compile |
|
6 |
||
7 |
# the remote path for loading modules |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
728
diff
changeset
|
8 |
loadpath = None |
371 | 9 |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
728
diff
changeset
|
10 |
stacktrace = None |
371 | 11 |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
728
diff
changeset
|
12 |
appname = None |
371 | 13 |
|
14 |
def setloadpath(lp): |
|
15 |
global loadpath |
|
16 |
loadpath = lp |
|
17 |
||
18 |
def setappname(an): |
|
19 |
global appname |
|
20 |
appname = an |
|
21 |
||
22 |
def getloadpath(): |
|
23 |
global loadpath |
|
24 |
return loadpath |
|
25 |
||
26 |
def addoverride(module_name, path): |
|
27 |
global overrides |
|
28 |
overrides[module_name] = path |
|
29 |
||
30 |
def addstack(linedebug): |
|
31 |
JS(""" |
|
32 |
if (pyjslib.bool((sys.stacktrace === null))) { |
|
33 |
sys.stacktrace = new pyjslib.List([]); |
|
34 |
} |
|
35 |
sys.stacktrace.append(linedebug); |
|
36 |
""") |
|
37 |
def popstack(): |
|
38 |
JS(""" |
|
39 |
sys.stacktrace.pop() |
|
40 |
""") |
|
41 |
||
42 |
def printstack(): |
|
43 |
JS(""" |
|
44 |
var res = ''; |
|
45 |
||
46 |
var __l = sys.stacktrace.__iter__(); |
|
47 |
try { |
|
48 |
while (true) { |
|
49 |
var l = __l.next(); |
|
50 |
res += ( l + '\\n' ) ; |
|
51 |
} |
|
52 |
} catch (e) { |
|
53 |
if (e != pyjslib.StopIteration) { |
|
54 |
throw e; |
|
55 |
} |
|
56 |
} |
|
57 |
||
58 |
return res; |
|
59 |
""") |