32 lines
647 B
C++
32 lines
647 B
C++
#include "shell.h"
|
|
#include "parser.h"
|
|
#include "commands.h"
|
|
|
|
#include <fmt/core.h>
|
|
|
|
//---
|
|
// g
|
|
//---
|
|
|
|
static long parse_g(Session &session, Parser &parser)
|
|
{
|
|
long addr = parser.expr(session.current_space);
|
|
parser.end();
|
|
return addr;
|
|
}
|
|
|
|
void _g(Session &session, long value)
|
|
{
|
|
if(!session.current_space)
|
|
return;
|
|
session.current_space->cursor = (value & 0xffffffff);
|
|
}
|
|
|
|
static ShellCommand _g_cmd(
|
|
"g", [](Session &s, Parser &p) { _g(s, parse_g(s, p)); },
|
|
[](Session &s, Parser &p) { parse_g(s, p); }, "Goto address", R"(
|
|
g <address>
|
|
|
|
Moves the cursor of the current virtual space to the specified address.
|
|
)");
|