예제 #1
0
def auto_step():
    """ Generate an AUTO line number and wait for input. """
    numstr = str(state.basic_state.auto_linenum)
    console.write(numstr)
    if state.basic_state.auto_linenum in state.basic_state.line_numbers:
        console.write('*')
        line = bytearray(console.wait_screenline(from_start=True))
        if line[:len(numstr)+1] == numstr+'*':
            line[len(numstr)] = ' '
    else:
        console.write(' ')
        line = bytearray(console.wait_screenline(from_start=True))
    # run or store it; don't clear lines or raise undefined line number
    state.basic_state.direct_line = tokenise.tokenise_line(line)
    c = util.peek(state.basic_state.direct_line)
    if c == '\0':
        # check for lines starting with numbers (6553 6) and empty lines
        empty, scanline = program.check_number_start(state.basic_state.direct_line)
        if not empty:
            program.store_line(state.basic_state.direct_line)
            reset.clear()
        state.basic_state.auto_linenum = scanline + state.basic_state.auto_increment
    elif c != '':
        # it is a command, go and execute
        state.basic_state.execute_mode = True
예제 #2
0
 def auto_step(self):
     """ Generate an AUTO line number and wait for input. """
     numstr = str(state.basic_state.auto_linenum)
     console.write(numstr)
     if state.basic_state.auto_linenum in state.basic_state.line_numbers:
         console.write('*')
         line = bytearray(console.wait_screenline(from_start=True))
         if line[:len(numstr)+1] == numstr+'*':
             line[len(numstr)] = ' '
     else:
         console.write(' ')
         line = bytearray(console.wait_screenline(from_start=True))
     # run or store it; don't clear lines or raise undefined line number
     state.basic_state.direct_line = tokenise.tokenise_line(line)
     c = util.peek(state.basic_state.direct_line)
     if c == '\0':
         # check for lines starting with numbers (6553 6) and empty lines
         empty, scanline = program.check_number_start(state.basic_state.direct_line)
         if not empty:
             program.store_line(state.basic_state.direct_line)
             reset.clear()
         state.basic_state.auto_linenum = scanline + state.basic_state.auto_increment
     elif c != '':
         # it is a command, go and execute
         state.basic_state.parse_mode = True
예제 #3
0
def merge(g):
    """ Merge program from ascii or utf8 (if utf8_files is True) stream. """
    while True:
        line = g.read_line()
        if line is None:
            break
        linebuf = tokenise.tokenise_line(line)
        if linebuf.read(1) == '\0':
            # line starts with a number, add to program memory; store_line seeks to 1 first
            store_line(linebuf)
        else:
            # we have read the :
            if util.skip_white(linebuf) not in tk.end_line:
                raise error.RunError(error.DIRECT_STATEMENT_IN_FILE)
예제 #4
0
파일: program.py 프로젝트: Yungzuck/pcbasic
def merge(g):
    """ Merge program from ascii or utf8 (if utf8_files is True) stream. """
    while True:
        line = g.read_line()
        if line is None:
            break
        linebuf = tokenise.tokenise_line(line)
        if linebuf.read(1) == '\0':
            # line starts with a number, add to program memory; store_line seeks to 1 first
            store_line(linebuf)
        else:
            # we have read the :
            if util.skip_white(linebuf) not in tk.end_line:
                raise error.RunError(error.DIRECT_STATEMENT_IN_FILE)
예제 #5
0
 def store_line(self, line):
     """ Store a program line or schedule a command line for execution. """
     if not line:
         return True
     state.basic_state.direct_line = tokenise.tokenise_line(line)
     c = util.peek(state.basic_state.direct_line)
     if c == '\0':
         # check for lines starting with numbers (6553 6) and empty lines
         program.check_number_start(state.basic_state.direct_line)
         program.store_line(state.basic_state.direct_line)
         reset.clear()
     elif c != '':
         # it is a command, go and execute
         state.basic_state.parse_mode = True
     return not state.basic_state.parse_mode
예제 #6
0
def store_line(line):
    """ Store a program line or schedule a command line for execution. """
    if not line:
        return True
    state.basic_state.direct_line = tokenise.tokenise_line(line)
    c = util.peek(state.basic_state.direct_line)
    if c == '\0':
        # check for lines starting with numbers (6553 6) and empty lines
        program.check_number_start(state.basic_state.direct_line)
        program.store_line(state.basic_state.direct_line)
        reset.clear()
    elif c != '':
        # it is a command, go and execute
        state.basic_state.execute_mode = True
    return not state.basic_state.execute_mode
예제 #7
0
def load_ascii_file(g, first_char=''):
    """ Load an ascii-codepage or utf8 (if utf8_files is True) encoded program from g. """
    eof = False
    lg = LineGetter(g, universal_newline, utf8=utf8_files)
    while not eof:
        line, eof = lg.get_line()
        line, first_char = first_char + line, ''
        linebuf = tokenise.tokenise_line(line)
        if linebuf.read(1) == '\0':
            # line starts with a number, add to program memory; store_line seeks to 1 first
            store_line(linebuf)
        else:
            # we have read the :
            if util.skip_white(linebuf) not in util.end_line:
                # direct statement in file
                raise error.RunError(66)   
예제 #8
0
파일: program.py 프로젝트: boriel/pcbasic
def merge(g):
    """ Merge program from ascii or utf8 (if utf8_files is True) stream. """
    while True:
        line = g.read_line()
        if line is None:
            break
        #line, first_char = first_char + line, ''
        linebuf = tokenise.tokenise_line(line)
        if linebuf.read(1) == '\0':
            # line starts with a number, add to program memory; store_line seeks to 1 first
            store_line(linebuf)
        else:
            # we have read the :
            if util.skip_white(linebuf) not in util.end_line:
                # direct statement in file
                raise error.RunError(66)   
예제 #9
0
파일: debug.py 프로젝트: nony05/pcbasic
def watch(expr):
    """ Add an expression to the watch list. """
    outs = tokenise.tokenise_line('?'+expr)
    watch_list.append((expr, outs))
예제 #10
0
def watch(expr):
    """ Add an expression to the watch list. """
    outs = tokenise.tokenise_line('?' + expr)
    watch_list.append((expr, outs))