Beispiel #1
0
def load(g):
    """ Load program from ascii, bytecode or protected stream. """
    erase_program()
    if g.filetype == 'B':
        # bytecode file
        state.basic_state.bytecode.seek(1)
        state.basic_state.bytecode.write(g.read())
    elif g.filetype == 'P':
        # protected file
        state.basic_state.bytecode.seek(1)
        state.basic_state.protected = not dont_protect
        protect.unprotect(g, state.basic_state.bytecode)
    else:
        if g.filetype != 'A':
            logging.debug("Incorrect file type '%s' on LOAD", g.filetype)
        # assume ASCII file
        # anything but numbers or whitespace: Direct Statement in File
        merge(g)
    # rebuild line number dict and offsets
    rebuild_line_dict()
Beispiel #2
0
def load(g):
    """ Load program from ascii, bytecode or protected stream. """
    erase_program()
    if g.filetype == 'B':
        # bytecode file
        state.basic_state.bytecode.seek(1)
        state.basic_state.bytecode.write(g.read())
    elif g.filetype == 'P':
        # protected file
        state.basic_state.bytecode.seek(1)
        state.basic_state.protected = not dont_protect
        protect.unprotect(g, state.basic_state.bytecode)
    else:
        if g.filetype != 'A':
            logging.debug("Incorrect file type '%s' on LOAD", g.filetype)
        # assume ASCII file
        # anything but numbers or whitespace: Direct Statement in File
        merge(g)
    # rebuild line number dict and offsets
    rebuild_line_dict()
def load(g):
    """ Load program from ascii, bytecode or protected stream. """
    erase_program()
    c = g.read(1)
    if c == '\xFF':
        # bytecode file
        state.basic_state.bytecode.truncate(0)
        state.basic_state.bytecode.write('\0')
        while c:
            c = g.read(1)
            state.basic_state.bytecode.write(c)
    elif c == '\xFE':
        # protected file
        state.basic_state.bytecode.truncate(0)
        state.basic_state.bytecode.write('\0')
        state.basic_state.protected = not dont_protect                
        protect.unprotect(g, state.basic_state.bytecode) 
    elif c != '':
        # ASCII file, maybe; any thing but numbers or whitespace will lead to Direct Statement in File
        load_ascii_file(g, c)        
    g.close()
    # rebuild line number dict and offsets
    rebuild_line_dict()