Return current globals -- handles Pdb frames
355200
def _mglobals(self):
        """"""
        if self._pdb_frame is not None:
            return self._pdb_frame.f_globals
        else:
            return self.shell.user_ns
681291
def user_return(self, frame, return_value):
        """"""
        pdb.Pdb.user_return(self, frame, return_value)
838444
def init():
    
    global OUTPUT
    global INCLUDED
    global CURRENT_DIR
    global ENABLED
    global INCLUDEPATH
    global IFDEFS
    global ID_TABLE
    global CURRENT_FILE

    global_.FILENAME = '(stdin)'
    OUTPUT = ''
    INCLUDED = {}
    CURRENT_DIR = ''
    pwd = get_include_path()
    INCLUDEPATH = [os.path.join(pwd, 'library'), os.path.join(pwd, 'library-asm')]
    ENABLED = True
    IFDEFS = []
    global_.has_errors = 0
    global_.error_msg_cache.clear()
    parser.defaulted_states = {}
    ID_TABLE = DefinesTable()
    del CURRENT_FILE[:]
558197
def global_state(self):
        
        self._generate_func_code()

        return dict(
            REGEX_PATTERNS=self._compile_regexps,
            re=re,
            JsonSchemaException=JsonSchemaException,
        )
1089286
def pdb(self):
        """"""
        pdb_str = write_pdb(
            [self], ' ' if not self.tags['chain_id'] else self.tags['chain_id'])
        return pdb_str
554560
def program_global_reg(self):
        

        self._clear_strobes()

        gr_size = len(self['GLOBAL_REG'][:])  # get the size
        self['SEQ']['SHIFT_IN'][0:gr_size] = self['GLOBAL_REG'][:]  # this will be shifted out
        self['SEQ']['GLOBAL_SHIFT_EN'][0:gr_size] = bitarray(gr_size * '1')  # this is to enable clock
        self['SEQ']['GLOBAL_CTR_LD'][gr_size + 1:gr_size + 2] = bitarray("1")  # load signals
        self['SEQ']['GLOBAL_DAC_LD'][gr_size + 1:gr_size + 2] = bitarray("1")

        # Execute the program (write bits to output pins)
        # + 1 extra 0 bit so that everything ends on LOW instead of HIGH
        self._run_seq(gr_size + 3)
1118440
def global_symbols(self):
        

        declared_symbols = self.declared_symbols
        return set(
            s for s in self.referenced_symbols if s not in declared_symbols)
1175606
def move_to_global_scope(self, id_):
        
        # In the current scope and more than 1 scope?
        if id_ in self.table[self.current_scope].keys(filter_by_opt=False) and len(self.table) > 1:
            symbol = self.table[self.current_scope][id_]
            symbol.offset = None
            symbol.scope = SCOPE.global_
            if symbol.class_ != CLASS.label:
                symbol.mangled = "%s%s%s" % (self.table[self.global_scope].mangle, global_.MANGLE_CHR, id_)

            self.table[self.global_scope][id_] = symbol
            del self.table[self.current_scope][id_]  # Removes it from the current scope
            __DEBUG__("'{}' entry moved to global scope".format(id_))
1337964
def pdb(self):
        """"""
        header_title = '{:<80}\n'.format('HEADER    {}'.format(self.id))
        data_type = '{:<80}\n'.format('EXPDTA    ISAMBARD Model')
        pdb_strs = []
        for ampal in self:
            if isinstance(ampal, Assembly):
                pdb_str = ampal.make_pdb(header=False, footer=False)
            else:
                pdb_str = ampal.make_pdb()
            pdb_strs.append(pdb_str)
        merged_strs = 'ENDMDL\n'.join(pdb_strs) + 'ENDMDL\n'
        merged_pdb = ''.join([header_title, data_type, merged_strs])
        return merged_pdb
293231
function observeGlobalEvents(event){
    var handlers = arrayFrom(globalHandlers[event.type]);
    var captureHandler = captureHandlers[event.type];
    var wrappedEvent = new Event(event);

    startFrame(event);

    if (captureHandler)
    {
      captureHandler.handler.call(captureHandler.thisObject, wrappedEvent);
    }
    else
    {
      if (handlers)
      {
        for (var i = handlers.length; i-- > 0;)
        {
          var handlerObject = handlers[i];
          handlerObject.handler.call(handlerObject.thisObject, wrappedEvent);
        }
      }
    }

    finishFrame(event);
  }
641831
def init():
    
    global LABELS
    global LET_ASSIGNMENT
    global PRINT_IS_USED
    global SYMBOL_TABLE

    global ast
    global data_ast
    global optemps
    global OPTIONS
    global last_brk_linenum

    LABELS = {}
    LET_ASSIGNMENT = False
    PRINT_IS_USED = False
    last_brk_linenum = 0

    ast = None
    data_ast = None  # Global Variables AST
    optemps = OpcodesTemps()

    gl.INITS.clear()
    del gl.FUNCTION_CALLS[:]
    del gl.FUNCTION_LEVEL[:]
    del gl.FUNCTIONS[:]
    SYMBOL_TABLE = gl.SYMBOL_TABLE = api.symboltable.SymbolTable()
    OPTIONS = api.config.OPTIONS

    # DATAs info
    gl.DATA_LABELS.clear()
    gl.DATA_IS_USED = False
    del gl.DATAS[:]
    gl.DATA_PTR_CURRENT = api.utils.current_data_label()
    gl.DATA_FUNCTIONS = []
    gl.error_msg_cache.clear()
819770
def get_debug():
    
    try:
        import IPython

    except ImportError:
        debug = None

    else:
        old_excepthook = sys.excepthook

        def debug(frame=None):
            if IPython.__version__ >= '0.11':
                from IPython.core.debugger import Pdb

                try:
                    ip = get_ipython()

                except NameError:
                    from IPython.frontend.terminal.embed \
                         import InteractiveShellEmbed
                    ip = InteractiveShellEmbed()

                colors = ip.colors

            else:
                from IPython.Debugger import Pdb
                from IPython.Shell import IPShell
                from IPython import ipapi

                ip = ipapi.get()
                if ip is None:
                    IPShell(argv=[''])
                    ip = ipapi.get()

                colors = ip.options.colors

            sys.excepthook = old_excepthook

            if frame is None:
                frame = sys._getframe().f_back

            Pdb(colors).set_trace(frame)

    if debug is None:
        import pdb
        debug = pdb.set_trace

    debug.__doc__ = """
    Start debugger on line where it is called, roughly equivalent to::

        import pdb; pdb.set_trace()

    First, this function tries to start an `IPython`-enabled
    debugger using the `IPython` API.

    When this fails, the plain old `pdb` is used instead.
    """

    return debug
1224606
def simple_debug_shell(globals, locals):
    
    try:
        import readline
    except ImportError:
        pass  # ignore
    compile_string_fn = "<simple_debug_shell input>"
    while True:
        try:
            s = raw_input("> ")
        except (KeyboardInterrupt, EOFError):
            print("breaked debug shell: " + sys.exc_info()[0].__name__)
            break
        if s.strip() == "":
            continue
        try:
            c = compile(s, compile_string_fn, "single")
        except Exception as e:
            print("%s : %s in %r" % (e.__class__.__name__, str(e), s))
        else:
            set_linecache(compile_string_fn, s)
            # noinspection PyBroadException
            try:
                ret = eval(c, globals, locals)
            except (KeyboardInterrupt, SystemExit):
                print("debug shell exit: " + sys.exc_info()[0].__name__)
                break
            except Exception:
                print("Error executing %r" % s)
                better_exchook(*sys.exc_info(), autodebugshell=False)
            else:
                # noinspection PyBroadException
                try:
                    if ret is not None:
                        print(ret)
                except Exception:
                    print("Error printing return value of %r" % s)
                    better_exchook(*sys.exc_info(), autodebugshell=False)
16481
def trace_dispatch(self, frame, event, arg):
        """"""
        if hasattr(self, 'pdb'):
            return self.pdb.trace_dispatch(frame, event, arg)
        else:
            return Pdb.trace_dispatch(self, frame, event, arg)
657543
function globalEventHandler(event) {
    if (listeners[event.type]) {
      listeners[event.type].forEach(function(currentHandler) {
        currentHandler.call(this, event);
      }, this);
    }
  }
469274
def module(self):
        
        module = self.frame.f_globals.get('__name__', '')
        if module is None:
            module = ''

        return module
859380
def pdebug(*args, **kwargs):
    """"""
    if should_msg(kwargs.get("groups", ["debug"])):
        # initialize colorama only if uninitialized
        global colorama_init
        if not colorama_init:
            colorama_init = True
            colorama.init()

        args = indent_text(*args, **kwargs)

        # write to stdout
        sys.stderr.write(colorama.Fore.CYAN)
        sys.stderr.write("".join(args))
        sys.stderr.write(colorama.Fore.RESET)
        sys.stderr.write("\n")