mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/curses/curses.c (Init_curses): use rb_define_const once for
Curses::VERSION. * ext/dbm/dbm.c (Init_dbm): ditto for DBM::VERSION. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
aa281e7517
commit
d9adb03dd9
3 changed files with 35 additions and 24 deletions
|
@ -1,3 +1,10 @@
|
|||
Sat Feb 25 11:08:28 2012 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/curses/curses.c (Init_curses): use rb_define_const once for
|
||||
Curses::VERSION.
|
||||
|
||||
* ext/dbm/dbm.c (Init_dbm): ditto for DBM::VERSION.
|
||||
|
||||
Sat Feb 25 10:34:22 2012 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/curses/curses.c (Init_curses): make Curses::VERSION
|
||||
|
|
|
@ -2768,20 +2768,22 @@ Init_curses(void)
|
|||
rb_define_module_function(mCurses, "def_prog_mode", curses_def_prog_mode, 0);
|
||||
rb_define_module_function(mCurses, "reset_prog_mode", curses_reset_prog_mode, 0);
|
||||
|
||||
#if defined(HAVE_FUNC_CURSES_VERSION)
|
||||
/* ncurses and PDcurses */
|
||||
rb_define_const(mCurses, "VERSION", rb_str_new2(curses_version()));
|
||||
#elif defined(HAVE_VAR_CURSES_VERSION)
|
||||
{
|
||||
VALUE version;
|
||||
#if defined(HAVE_FUNC_CURSES_VERSION)
|
||||
/* ncurses and PDcurses */
|
||||
version = rb_str_new2(curses_version());
|
||||
#elif defined(HAVE_VAR_CURSES_VERSION)
|
||||
/* SVR4 curses has an undocumented and undeclared variable, curses_version.
|
||||
* It contains a string, "SVR4". */
|
||||
RUBY_EXTERN char *curses_version;
|
||||
rb_define_const(mCurses, "VERSION", rb_sprintf("curses (%s)", curses_version));
|
||||
}
|
||||
version = rb_sprintf("curses (%s)", curses_version);
|
||||
#else
|
||||
/* BSD curses, perhaps. NetBSD 5 still use it. */
|
||||
rb_define_const(mCurses, "VERSION", rb_str_new2("curses (unknown)"));
|
||||
/* BSD curses, perhaps. NetBSD 5 still use it. */
|
||||
version = rb_str_new2("curses (unknown)");
|
||||
#endif
|
||||
rb_define_const(mCurses, "VERSION", version);
|
||||
}
|
||||
|
||||
/*
|
||||
* Document-class: Curses::Window
|
||||
|
|
|
@ -1085,36 +1085,38 @@ Init_dbm(void)
|
|||
*/
|
||||
rb_define_const(rb_cDBM, "NEWDB", INT2FIX(O_RDWR|O_CREAT|O_TRUNC|RUBY_DBM_RW_BIT));
|
||||
|
||||
{
|
||||
VALUE version;
|
||||
#if defined(_DBM_IOERR)
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2("ndbm (4.3BSD)"));
|
||||
version = rb_str_new2("ndbm (4.3BSD)");
|
||||
#elif defined(RUBYDBM_GDBM_HEADER)
|
||||
# if defined(HAVE_DECLARED_LIBVAR_GDBM_VERSION)
|
||||
/* since gdbm 1.9 */
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2(gdbm_version));
|
||||
/* since gdbm 1.9 */
|
||||
version = rb_str_new2(gdbm_version);
|
||||
# elif defined(HAVE_UNDECLARED_LIBVAR_GDBM_VERSION)
|
||||
/* ndbm.h doesn't declare gdbm_version until gdbm 1.8.3.
|
||||
* See extconf.rb for more information. */
|
||||
{
|
||||
RUBY_EXTERN char *gdbm_version;
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2(gdbm_version));
|
||||
}
|
||||
/* ndbm.h doesn't declare gdbm_version until gdbm 1.8.3.
|
||||
* See extconf.rb for more information. */
|
||||
RUBY_EXTERN char *gdbm_version;
|
||||
version = rb_str_new2(gdbm_version);
|
||||
# else
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2("GDBM (unknown)"));
|
||||
version = rb_str_new2("GDBM (unknown)");
|
||||
# endif
|
||||
#elif defined(RUBYDBM_DB_HEADER)
|
||||
# if defined(HAVE_DB_VERSION)
|
||||
/* The version of the dbm library, if using Berkeley DB */
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2(db_version(NULL, NULL, NULL)));
|
||||
/* The version of the dbm library, if using Berkeley DB */
|
||||
version = rb_str_new2(db_version(NULL, NULL, NULL));
|
||||
# else
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2("Berkeley DB (unknown)"));
|
||||
version = rb_str_new2("Berkeley DB (unknown)");
|
||||
# endif
|
||||
#elif defined(_RELIC_H)
|
||||
# if defined(HAVE_DPVERSION)
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_sprintf("QDBM %s", dpversion));
|
||||
version = rb_sprintf("QDBM %s", dpversion);
|
||||
# else
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2("QDBM (unknown)"));
|
||||
version = rb_str_new2("QDBM (unknown)");
|
||||
# endif
|
||||
#else
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2("ndbm (unknown)"));
|
||||
version = rb_str_new2("ndbm (unknown)");
|
||||
#endif
|
||||
rb_define_const(rb_cDBM, "VERSION", version);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue