Class: BitClust::FunctionDatabase
Overview
Database for C API functions.
Constant Summary
Constants included
from NameUtils
NameUtils::CHAR_TO_MARK, NameUtils::CHAR_TO_NAME, NameUtils::CLASS_NAME_RE, NameUtils::CLASS_PATH_RE, NameUtils::CONST_PATH_RE, NameUtils::CONST_RE, NameUtils::GVAR_RE, NameUtils::LIBNAME_RE, NameUtils::MARK_TO_CHAR, NameUtils::MARK_TO_NAME, NameUtils::METHOD_NAME_RE, NameUtils::METHOD_SPEC_RE, NameUtils::MID, NameUtils::NAME_TO_CHAR, NameUtils::NAME_TO_MARK, NameUtils::TYPEMARK_RE
Instance Method Summary
collapse
Methods inherited from Database
#atomic_write_open, connect, datadir?, dummy, #dummy?, #encoding, #entries, #exist?, #foreach_line, #load_properties, #makepath, #properties, #propget, #propkeys, #propset, #read, #save_properties, #transaction
Methods included from NameUtils
build_method_id, classid2name, classname2id, classname?, decodeid, decodename_fs, decodename_url, encodeid, encodename_fs, encodename_rdocurl, encodename_url, functionname?, gvarname?, html_filename, libid2name, libname2id, libname?, method_spec?, methodid2classid, methodid2libid, methodid2mname, methodid2specparts, methodid2specstring, methodid2typechar, methodid2typemark, methodid2typename, methodname?, split_method_id, split_method_spec, typechar2mark, typechar2name, typechar?, typemark2char, typemark2name, typemark?, typename2char, typename2mark, typename?
Constructor Details
Returns a new instance of FunctionDatabase.
24
25
26
27
28
29
|
# File 'lib/bitclust/functiondatabase.rb', line 24
def initialize(prefix)
super
@dirty_functions = {}
@functionmap = {}
@function_extent_loaded = false
end
|
Instance Method Details
#clear_dirty ⇒ Object
52
53
54
|
# File 'lib/bitclust/functiondatabase.rb', line 52
def clear_dirty
@dirty_functions.clear
end
|
#dirty? ⇒ Boolean
44
45
46
|
# File 'lib/bitclust/functiondatabase.rb', line 44
def dirty?
not @dirty_functions.empty?
end
|
#dirty_function(f) ⇒ Object
40
41
42
|
# File 'lib/bitclust/functiondatabase.rb', line 40
def dirty_function(f)
@dirty_functions[f] = true
end
|
#each_dirty_function(&block) ⇒ Object
48
49
50
|
# File 'lib/bitclust/functiondatabase.rb', line 48
def each_dirty_function(&block)
@dirty_functions.each_key(&block)
end
|
#fetch_function(id) ⇒ Object
82
83
84
85
|
# File 'lib/bitclust/functiondatabase.rb', line 82
def fetch_function(id)
load_function(id) or
raise FunctionNotFound, "function not found: #{id.inspect}"
end
|
#functions ⇒ Object
96
97
98
|
# File 'lib/bitclust/functiondatabase.rb', line 96
def functions
functionmap().values
end
|
#open_function(id) {|f| ... } ⇒ Object
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/bitclust/functiondatabase.rb', line 69
def open_function(id)
check_transaction
if exist?("function/#{id}")
f = load_function(id)
f.clear
else
f = (@functionmap[id] ||= FunctionEntry.new(self, id))
end
yield f
dirty_function f
f
end
|
#search_functions(pattern) ⇒ Object
61
62
63
64
65
66
67
|
# File 'lib/bitclust/functiondatabase.rb', line 61
def search_functions(pattern)
fs = _search_functions(pattern)
if fs.empty?
raise FunctionNotFound, "no such function: #{pattern}"
end
fs
end
|
#update_by_file(path, filename) ⇒ Object
56
57
58
59
|
# File 'lib/bitclust/functiondatabase.rb', line 56
def update_by_file(path, filename)
check_transaction
FunctionReferenceParser.new(self).parse_file(path, filename, properties())
end
|