1
2#ifndef _TOOLS_DIS_ASM_COMPAT_H
3#define _TOOLS_DIS_ASM_COMPAT_H
4
5#include <stdio.h>
6#include <dis-asm.h>
7
8
9#ifndef DISASM_INIT_STYLED
10enum disassembler_style {DISASSEMBLER_STYLE_NOT_EMPTY};
11typedef int (*fprintf_styled_ftype) (void *, enum disassembler_style, const char*, ...);
12#endif
13
14
15
16
17
18static inline int fprintf_styled(void *out,
19 enum disassembler_style style,
20 const char *fmt, ...)
21{
22 va_list args;
23 int r;
24
25 (void)style;
26
27 va_start(args, fmt);
28 r = vfprintf(out, fmt, args);
29 va_end(args);
30
31 return r;
32}
33
34
35
36
37
38
39static inline void init_disassemble_info_compat(struct disassemble_info *info,
40 void *stream,
41 fprintf_ftype unstyled_func,
42 fprintf_styled_ftype styled_func)
43{
44#ifdef DISASM_INIT_STYLED
45 init_disassemble_info(info, stream,
46 unstyled_func,
47 styled_func);
48#else
49 (void)styled_func;
50 init_disassemble_info(info, stream,
51 unstyled_func);
52#endif
53}
54
55#endif
56