laurent@371: # the platform name (PyV8, smjs, Mozilla, IE6, Opera, Safari etc.) andrej@1737: platform = '' # to be updated by app, on compile laurent@371: laurent@371: # a dictionary of module override names (platform-specific) andrej@1737: overrides = None # to be updated by app, on compile laurent@371: laurent@371: # the remote path for loading modules andrej@1730: loadpath = None laurent@371: andrej@1730: stacktrace = None laurent@371: andrej@1730: appname = None laurent@371: andrej@1736: laurent@371: def setloadpath(lp): laurent@371: global loadpath laurent@371: loadpath = lp laurent@371: andrej@1736: laurent@371: def setappname(an): laurent@371: global appname laurent@371: appname = an laurent@371: andrej@1736: laurent@371: def getloadpath(): laurent@371: global loadpath laurent@371: return loadpath laurent@371: andrej@1736: laurent@371: def addoverride(module_name, path): laurent@371: global overrides laurent@371: overrides[module_name] = path laurent@371: andrej@1736: laurent@371: def addstack(linedebug): laurent@371: JS(""" laurent@371: if (pyjslib.bool((sys.stacktrace === null))) { laurent@371: sys.stacktrace = new pyjslib.List([]); laurent@371: } laurent@371: sys.stacktrace.append(linedebug); laurent@371: """) andrej@1736: andrej@1736: laurent@371: def popstack(): laurent@371: JS(""" laurent@371: sys.stacktrace.pop() laurent@371: """) laurent@371: andrej@1736: laurent@371: def printstack(): laurent@371: JS(""" laurent@371: var res = ''; laurent@371: laurent@371: var __l = sys.stacktrace.__iter__(); laurent@371: try { laurent@371: while (true) { laurent@371: var l = __l.next(); laurent@371: res += ( l + '\\n' ) ; laurent@371: } laurent@371: } catch (e) { laurent@371: if (e != pyjslib.StopIteration) { laurent@371: throw e; laurent@371: } laurent@371: } laurent@371: laurent@371: return res; laurent@371: """)