forked from allthingsida/GraphSlick
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pybbmatcher.h
80 lines (63 loc) · 1.67 KB
/
pybbmatcher.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef __PY_BBMATCHER_INC__
#define __PY_BBMATCHER_INC__
/*--------------------------------------------------------------------------
GraphSlick (c) Elias Bachaalany
-------------------------------------
BBMatcher Python to C wrapper class
--------------------------------------------------------------------------*/
#include <pro.h>
#ifdef snprintf
#undef snprintf
#endif
#include <Python.h>
#include "types.hpp"
//--------------------------------------------------------------------------
class PyBBMatcher
{
PyObject *py_matcher_module;
PyObject *py_instref;
PyObject *py_meth_save_state, *py_meth_load_state, *py_meth_analyze, *py_meth_find_similar;
const char *init_script;
/**
* @brief Call the supporting init file once
*/
const char *call_init_file();
public:
/**
* @brief ctor
*/
PyBBMatcher(const char *init_script): py_matcher_module(NULL), py_instref(NULL),
py_meth_find_similar (NULL), py_meth_save_state(NULL),
py_meth_load_state (NULL), py_meth_analyze (NULL), init_script(init_script)
{
}
~PyBBMatcher()
{
deinit();
}
/**
* @brief Initialize the needed python references
*/
const char *init();
/**
* @brief Release references
*/
void deinit();
/**
* @brief Analyze and return the non-overlapping wellformed function instances
*/
void Analyze(ea_t func_addr, int_3dvec_t &result);
/**
* @brief Load state
*/
bool LoadState(const char *filename);
/**
* @brief Save state and return it as a string
*/
bool SaveState(qstring &out);
/**
* @brief Analyze and set the internal state
*/
bool FindSimilar(intvec_t &node_list, int_2dvec_t &similar);
};
#endif