Rizin
unix-like reverse engineering framework and cli tools
parse_tms320_pseudo.c File Reference
#include <rz_lib.h>
#include <rz_flag.h>
#include <rz_analysis.h>
#include <rz_parse.h>
#include "parse_common.c"

Go to the source code of this file.

Functions

static RzListtms320_tokenize (const char *assembly, size_t length)
 
static bool parse (RzParse *parse, const char *assembly, RzStrBuf *sb)
 

Variables

static const RzPseudoGrammar tms320_lexicon []
 
static const RzPseudoConfig tms320_config = RZ_PSEUDO_DEFINE_CONFIG_ONLY_LEXICON(tms320_lexicon, 5, tms320_tokenize)
 
RzParsePlugin rz_parse_plugin_tms320_pseudo
 
RZ_API RzLibStruct rizin_plugin
 

Function Documentation

◆ parse()

static bool parse ( RzParse parse,
const char *  assembly,
RzStrBuf sb 
)
static

Definition at line 116 of file parse_tms320_pseudo.c.

116  {
117  return rz_pseudo_convert(&tms320_config, assembly, sb);
118 }
static SblHeader sb
Definition: bin_mbn.c:26
static bool rz_pseudo_convert(const RzPseudoConfig *config, const char *assembly, RzStrBuf *sb)
Definition: parse_common.c:103
static const RzPseudoConfig tms320_config

References rz_pseudo_convert(), sb, and tms320_config.

◆ tms320_tokenize()

RzList * tms320_tokenize ( const char *  assembly,
size_t  length 
)
static

Definition at line 97 of file parse_tms320_pseudo.c.

97  {
98  char *buf = NULL, *sp = NULL;
99  RzList *tokens = NULL;
100  buf = rz_str_ndup(assembly, length);
101  if (!buf) {
102  return NULL;
103  }
104 
105  sp = strchr(buf, ' ');
106  if (sp) {
107  *sp = ',';
108  }
109 
110  tokens = rz_str_split_duplist(buf, ",", true);
111  free(buf);
112 
113  return tokens;
114 }
#define NULL
Definition: cris-opc.c:27
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 static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length
Definition: sflib.h:133
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
voidpf void * buf
Definition: ioapi.h:138
RZ_API char * rz_str_ndup(RZ_NULLABLE const char *ptr, int len)
Create new copy of string ptr limited to size len.
Definition: str.c:1006
RZ_API RzList * rz_str_split_duplist(const char *str, const char *c, bool trim)
Split the string str according to the substring c and returns a RzList with the result.
Definition: str.c:3464
static int sp
Definition: z80asm.c:91

References free(), length, NULL, rz_str_ndup(), rz_str_split_duplist(), and sp.

Variable Documentation

◆ rizin_plugin

RZ_API RzLibStruct rizin_plugin
Initial value:
= {
.version = RZ_VERSION
}
RzParsePlugin rz_parse_plugin_tms320_pseudo
@ RZ_LIB_TYPE_PARSE
Definition: rz_lib.h:74
#define RZ_VERSION
Definition: rz_version.h:8

Definition at line 127 of file parse_tms320_pseudo.c.

◆ rz_parse_plugin_tms320_pseudo

RzParsePlugin rz_parse_plugin_tms320_pseudo
Initial value:
= {
.name = "tms320.pseudo",
.desc = "tms320 pseudo syntax",
.parse = parse,
}
static bool parse(RzParse *parse, const char *assembly, RzStrBuf *sb)

Definition at line 120 of file parse_tms320_pseudo.c.

◆ tms320_config

Definition at line 95 of file parse_tms320_pseudo.c.

Referenced by parse().

◆ tms320_lexicon

const RzPseudoGrammar tms320_lexicon[]
static

Definition at line 14 of file parse_tms320_pseudo.c.