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, #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, display_typemark, 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
94
95
96
97
|
# File 'lib/bitclust/functiondatabase.rb', line 94
def fetch_function(id)
load_function(id) or
raise FunctionNotFound, "function not found: #{id.inspect}"
end
|
#functions ⇒ Object
108
109
110
|
# File 'lib/bitclust/functiondatabase.rb', line 108
def functions
functionmap().values
end
|
#open_function(id) {|f| ... } ⇒ Object
81
82
83
84
85
86
87
88
89
90
91
92
|
# File 'lib/bitclust/functiondatabase.rb', line 81
def open_function(id)
check_transaction
if exist?("function/#{id}")
f = load_function(id) || raise
f.clear
else
f = (@functionmap[id] ||= FunctionEntry.new(self, id))
end
yield f
dirty_function f
f
end
|
#search_functions(pattern) ⇒ Object
73
74
75
76
77
78
79
|
# File 'lib/bitclust/functiondatabase.rb', line 73
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
68
69
70
71
|
# File 'lib/bitclust/functiondatabase.rb', line 68
def update_by_file(path, filename)
check_transaction
FunctionReferenceParser.new(self).parse_file(path, filename, properties())
end
|
#update_by_markdowntree(md_root) ⇒ Object
C API の Markdown ツリー(manual/capi)を直接パースして更新する(M3)。
filename は旧経路と同じ「eval.c」等(basename から .md を除いた形)
58
59
60
61
62
63
64
65
66
|
# File 'lib/bitclust/functiondatabase.rb', line 58
def update_by_markdowntree(md_root)
check_transaction
require 'bitclust/mdparser'
propset 'source_format', 'markdown'
Dir.glob(File.join(md_root, '*.md')).sort.each do |path|
MDFunctionParser.new(self).parse_file(path, File.basename(path, '.md'), properties())
end
end
|