fxos/shell/g.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
647 B
C++
Raw Normal View History

#include "shell.h"
#include "parser.h"
#include "commands.h"
#include <fmt/core.h>
//---
// g
//---
static long parse_g(Session &session, Parser &parser)
{
2022-04-14 13:30:43 +02:00
long addr = parser.expr(session.current_space);
parser.end();
return addr;
}
void _g(Session &session, long value)
{
2022-04-14 13:30:43 +02:00
if(!session.current_space)
return;
session.current_space->cursor = (value & 0xffffffff);
}
2022-04-14 13:30:43 +02:00
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"(
2022-03-06 17:15:13 +01:00
g <address>
Moves the cursor of the current virtual space to the specified address.
)");