Capstone disassembly/disassembler framework: Core (Arm, Arm64, BPF, EVM, M68K, M680X, MOS65xx, Mips, PPC, RISCV, Sparc, SystemZ, TMS320C64x, Web Assembly, X86, X86_64, XCore) + bindings. (bloaty 依赖)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

48 lines
828 B

/* Capstone Disassembly Engine */
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2014 */
#include <stdint.h>
#include <stdarg.h>
#include <stdio.h>
#include "SStream.h"
#include "cs_priv.h"
void SStream_Init(SStream *ss)
{
ss->index = 0;
ss->buffer[0] = '\0';
}
void SStream_concat(SStream *ss, const char *fmt, ...)
{
#ifndef CAPSTONE_DIET
va_list ap;
int ret = 0;
va_start(ap, fmt);
ret = cs_vsnprintf(ss->buffer + ss->index, sizeof(ss->buffer) - (ss->index + 1), fmt, ap);
va_end(ap);
ss->index += ret;
#endif
}
/*
int main()
{
SStream ss;
int64_t i;
SStream_Init(&ss);
SStream_concat(&ss, "hello ");
SStream_concat(&ss, "%d - 0x%x", 200, 16);
i = 123;
SStream_concat(&ss, " + %ld", i);
SStream_concat(&ss, "%s", "haaaaa");
printf("%s\n", ss.buffer);
return 0;
}
*/