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.
23
24
25
26
27
28
|
# File 'lib/bitclust/functiondatabase.rb', line 23
def initialize(prefix)
super
@dirty_functions = {}
@functionmap = {}
@function_extent_loaded = false
end
|
Instance Method Details
#clear_dirty ⇒ Object
51
52
53
|
# File 'lib/bitclust/functiondatabase.rb', line 51
def clear_dirty
@dirty_functions.clear
end
|
#dirty? ⇒ Boolean
43
44
45
|
# File 'lib/bitclust/functiondatabase.rb', line 43
def dirty?
not @dirty_functions.empty?
end
|
#dirty_function(f) ⇒ Object
39
40
41
|
# File 'lib/bitclust/functiondatabase.rb', line 39
def dirty_function(f)
@dirty_functions[f] = true
end
|
#each_dirty_function(&block) ⇒ Object
47
48
49
|
# File 'lib/bitclust/functiondatabase.rb', line 47
def each_dirty_function(&block)
@dirty_functions.each_key(&block)
end
|
#fetch_function(id) ⇒ Object
81
82
83
84
|
# File 'lib/bitclust/functiondatabase.rb', line 81
def fetch_function(id)
load_function(id) or
raise FunctionNotFound, "function not found: #{id.inspect}"
end
|
#functions ⇒ Object
95
96
97
|
# File 'lib/bitclust/functiondatabase.rb', line 95
def functions
functionmap().values
end
|
#open_function(id) {|f| ... } ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/bitclust/functiondatabase.rb', line 68
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
60
61
62
63
64
65
66
|
# File 'lib/bitclust/functiondatabase.rb', line 60
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
55
56
57
58
|
# File 'lib/bitclust/functiondatabase.rb', line 55
def update_by_file(path, filename)
check_transaction
FunctionReferenceParser.new(self).parse_file(path, filename, properties())
end
|