[ruby/etc] [DOC] Add minimal documents for constants
https://github.com/ruby/etc/commit/97a4f798d4
This commit is contained in:
parent
bc002971b6
commit
c027dcfde2
@ -1 +1,2 @@
|
|||||||
etc.c
|
etc.c
|
||||||
|
constdefs.h
|
||||||
|
@ -35,6 +35,12 @@ opt.def_option('-H FILE', 'specify output header file') {|filename|
|
|||||||
|
|
||||||
opt.parse!
|
opt.parse!
|
||||||
|
|
||||||
|
CONST_PREFIXES = {
|
||||||
|
'SC' => 'for Etc.sysconf; See <tt>man sysconf</tt>',
|
||||||
|
'CS' => 'for Etc.confstr; See <tt>man constr</tt>',
|
||||||
|
'PC' => 'for IO#pathconf; See <tt>man fpathconf</tt>',
|
||||||
|
}
|
||||||
|
|
||||||
h = {}
|
h = {}
|
||||||
COMMENTS = {}
|
COMMENTS = {}
|
||||||
|
|
||||||
@ -49,6 +55,13 @@ DATA.each_line {|s|
|
|||||||
next
|
next
|
||||||
end
|
end
|
||||||
h[name] = default_value
|
h[name] = default_value
|
||||||
|
if additional = CONST_PREFIXES[name[/\A_([A-Z]+)_/, 1]]
|
||||||
|
if comment&.match(/\w\z/)
|
||||||
|
comment << " " << additional
|
||||||
|
else
|
||||||
|
(comment ||= String.new) << " " << additional.sub(/\A\w/) {$&.upcase}
|
||||||
|
end
|
||||||
|
end
|
||||||
COMMENTS[name] = comment if comment
|
COMMENTS[name] = comment if comment
|
||||||
}
|
}
|
||||||
DEFS = h.to_a
|
DEFS = h.to_a
|
||||||
@ -123,6 +136,9 @@ result = erb_new.call(<<'EOS', nil, '%').result(binding)
|
|||||||
static void
|
static void
|
||||||
init_constants(VALUE mod)
|
init_constants(VALUE mod)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
|
mod = rb_define_module("Etc");
|
||||||
|
#endif
|
||||||
<%= gen_const_defs %>
|
<%= gen_const_defs %>
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user