#include <rz_lib.h>
#include <rz_util.h>
#include <rz_flag.h>
#include <rz_analysis.h>
#include <rz_parse.h>
Go to the source code of this file.
◆ BUFSIZE
◆ MAXARGS
◆ concat()
static void concat |
( |
char * |
buf, |
|
|
size_t |
len, |
|
|
char ** |
args |
|
) |
| |
|
static |
◆ parse()
Definition at line 92 of file parse_chip8_pseudo.c.
94 char str[1024] = { 0 };
RZ_API void Ht_() free(HtName_(Ht) *ht)
static static fork const void static count static fd const char const char static newpath char char argv
static int replace(int argc, char *argv[], char *newstr, size_t len)
static int tokenize(const char *in, char *out[])
RZ_API const char * rz_strbuf_set(RzStrBuf *sb, const char *s)
References argv, BUFSIZE, free(), i, MAXARGS, NULL, replace(), rz_strbuf_set(), sb, cmd_descs_generate::str, and tokenize().
◆ replace()
static int replace |
( |
int |
argc, |
|
|
char * |
argv[], |
|
|
char * |
newstr, |
|
|
size_t |
len |
|
) |
| |
|
static |
Definition at line 28 of file parse_chip8_pseudo.c.
36 {
"cls", (
char *[]){
"clear_screen()",
NULL } },
37 {
"drw", (
char *[]){
"draw(",
argv[1],
", ",
argv[2],
", ",
argv[3],
")",
NULL } },
38 {
"exit", (
char *[]){
"exit()",
NULL } },
39 {
"high", (
char *[]){
"high_res()",
NULL } },
40 {
"jp", (
char *[]){
"goto ",
argv[1],
NULL } },
42 {
"low", (
char *[]){
"low_res()",
NULL } },
44 {
"rnd", (
char *[]){
argv[1],
" = random(256) & ",
argv[2],
NULL } },
45 {
"scd", (
char *[]){
"scroll_down(",
argv[1],
")",
NULL } },
46 {
"scl", (
char *[]){
"scroll_left()",
NULL } },
47 {
"scr", (
char *[]){
"scroll_right()",
NULL } },
48 {
"se", (
char *[]){
"skip_next_instr if ",
argv[1],
" == ",
argv[2],
NULL } },
49 {
"shl", (
char *[]){
argv[1],
" <<= 1",
NULL } },
50 {
"shr", (
char *[]){
argv[1],
" >>= 1",
NULL } },
51 {
"sknp", (
char *[]){
"skip_next_instr if !key_pressed(",
argv[1],
")",
NULL } },
52 {
"skp", (
char *[]){
"skip_next_instr if key_pressed(",
argv[1],
")",
NULL } },
53 {
"sne", (
char *[]){
"skip_next_instr if ",
argv[1],
" != ",
argv[2],
NULL } },
60 for (
i = 0;
ops[
i].op;
i++) {
static RASN1String * newstr(const char *string)
static void concat(char *buf, size_t len, char **args)
References argv, concat(), i, len, newstr(), NULL, op, and ops.
Referenced by parse().
◆ tokenize()
static int tokenize |
( |
const char * |
in, |
|
|
char * |
out[] |
|
) |
| |
|
static |
Definition at line 70 of file parse_chip8_pseudo.c.
71 int len = strlen(
in),
count = 0,
i = 0, tokenlen = 0, seplen = 0;
72 char *token, *
buf = (
char *)
in;
73 const char *tokcharset =
", \t\n";
76 tokenlen = strcspn(
buf, tokcharset);
77 token =
calloc(tokenlen + 1,
sizeof(
char));
84 seplen = strspn(
buf, tokcharset);
const lzma_allocator const uint8_t * in
const lzma_allocator const uint8_t size_t uint8_t * out
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
void * calloc(size_t number, size_t size)
References calloc(), count, i, in, len, memcpy(), and out.
Referenced by parse().
◆ rizin_plugin
Initial value:= {
}
RzParsePlugin rz_parse_plugin_chip8_pseudo
Definition at line 117 of file parse_chip8_pseudo.c.
◆ rz_parse_plugin_chip8_pseudo
Initial value:= {
.name = "chip8.pseudo",
.desc = "chip8 pseudo syntax",
}
static bool parse(RzParse *p, const char *data, RzStrBuf *sb)
Definition at line 110 of file parse_chip8_pseudo.c.