Interactive Parsing

version 3 by Jon Ingold

  • Home page
  • Beginning
  • Previous
  • Next



  • Section - Recall of previous command lines

    Include (-


    [ RecallPreviousCommandLine input_buffer
        j
        ;
    ! writes the current command line into the input buffer array
    ! moves the current command line back in history

        if (command_line_pointers-->(current_command_line + 1) == 0 || current_command_line > COMMAND_RECALL_DEPTH) return -1; ! no such command line
        current_command_line++;
        ExtractCommandLine( current_command_line, input_buffer);
        return input_buffer-->0;

    ];

    [ RecallLaterCommandLine input_buffer
        ;
        if (current_command_line == 0) rfalse; ! do nothing
        current_command_line--;
        if (current_command_line == 0)
        {
            ! wipe the input_buffer
            input_buffer-->0 = 0;
        } else
        {
            ExtractCommandLine(current_command_line, input_buffer);
        }
        return input_buffer-->0;
    ];

    [ ExtractCommandLine n input_buffer;

        WriteCharactersToBuffer(command_lines, GetCommandLineStart(n), GetCommandLineLength(n), input_buffer);

    ];

    -) after "Parser.i6t".