diff --git a/ext/etc/.document b/ext/etc/.document index 2b0d7eb..9bbea23 100644 --- a/ext/etc/.document +++ b/ext/etc/.document @@ -1 +1,2 @@ etc.c +constdefs.h diff --git a/ext/etc/mkconstants.rb b/ext/etc/mkconstants.rb index a752d64..c8ebb67 100644 --- a/ext/etc/mkconstants.rb +++ b/ext/etc/mkconstants.rb @@ -35,6 +35,12 @@ def c_str(str) opt.parse! +CONST_PREFIXES = { + 'SC' => 'for Etc.sysconf; See man sysconf', + 'CS' => 'for Etc.confstr; See man constr', + 'PC' => 'for IO#pathconf; See man fpathconf', +} + h = {} COMMENTS = {} @@ -49,6 +55,13 @@ def c_str(str) next end 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 } DEFS = h.to_a @@ -123,6 +136,9 @@ def each_name(pat) static void init_constants(VALUE mod) { +#if 0 + mod = rb_define_module("Etc"); +#endif <%= gen_const_defs %> } EOS