forked from Lephenixnoir/fxos
30 lines
541 B
C++
30 lines
541 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)
|
||
|
{
|
||
|
session.require_vspace();
|
||
|
session.current_space->cursor = (value & 0xffffffff);
|
||
|
}
|
||
|
|
||
|
[[gnu::constructor]] static void _(void)
|
||
|
{
|
||
|
shell_register_command("g",
|
||
|
[](Session &s, Parser &p){ _g(s, parse_g(s, p)); },
|
||
|
[](Session &s, Parser &p){ parse_g(s, p); });
|
||
|
}
|