From 88b8c7e3ffdbc0116c31b8e9691743567d6e3e34 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 6 Aug 1999 06:48:25 +0000 Subject: 990806 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/Setup.emx | 16 ++++++++ ext/Setup.nt | 13 ++++-- ext/cygwin32_ld.rb | 90 ------------------------------------------ ext/etc/etc.doc | 73 ---------------------------------- ext/etc/etc.txt | 72 +++++++++++++++++++++++++++++++++ ext/etc/etc.txt.jp | 72 +++++++++++++++++++++++++++++++++ ext/extmk.rb.in | 103 +++++++++++++++++++++++++++++++++++++++--------- ext/md5/md5.doc | 36 ----------------- ext/md5/md5.txt | 38 ++++++++++++++++++ ext/md5/md5.txt.jp | 37 +++++++++++++++++ ext/socket/socket.c | 8 +--- ext/tcltklib/extconf.rb | 4 +- ext/tcltklib/tcltklib.c | 4 ++ 13 files changed, 336 insertions(+), 230 deletions(-) create mode 100644 ext/Setup.emx delete mode 100644 ext/cygwin32_ld.rb delete mode 100644 ext/etc/etc.doc create mode 100644 ext/etc/etc.txt create mode 100644 ext/etc/etc.txt.jp delete mode 100644 ext/md5/md5.doc create mode 100644 ext/md5/md5.txt create mode 100644 ext/md5/md5.txt.jp (limited to 'ext') diff --git a/ext/Setup.emx b/ext/Setup.emx new file mode 100644 index 0000000000..dbb4b7a61c --- /dev/null +++ b/ext/Setup.emx @@ -0,0 +1,16 @@ +option nodynamic + +#Win32API +curses +#dbm +etc +fcntl +#gdbm +md5 +nkf +#pty +#readline +#sdbm +socket +#tcltklib +#tk diff --git a/ext/Setup.nt b/ext/Setup.nt index b469709585..4d9244ef6f 100644 --- a/ext/Setup.nt +++ b/ext/Setup.nt @@ -1,12 +1,19 @@ option nodynamic #GD +Win32API #curses #dbm #etc fcntl -kconv -#marshal +#gdbm +#gtk +marshal md5 +nkf +#pty +#readline +sdbm socket -#tkutil +#tcltklib +#tk diff --git a/ext/cygwin32_ld.rb b/ext/cygwin32_ld.rb deleted file mode 100644 index a9c8e21cb0..0000000000 --- a/ext/cygwin32_ld.rb +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/local/bin/ruby -require '../../rbconfig' -include Config - -args = ARGV.join(" ") - -objs = [] -flags = [] -libname = '' -Init = "../init" - -path = '' - -def writeInit - out = open("#{Init}.c", "w") - - out.print %q@ -#include -#include - -extern struct _reent *__imp_reent_data; -WINAPI dll_entry(int a, int b, int c) -{ - _impure_ptr =__imp_reent_data; - return 1; -} -main(){} -//void impure_setup(struct _reent *_impure_ptrMain) -//{ -// _impure_ptr =__imp_reent_data; -//} -@ - out.close -end - -def xsystem cmd - print cmd, "\n" - system cmd -end - -if args =~ /-o (\w+)\.dll/i - libname = $1 - # Check for path: - if libname =~ /(\w+\/)(\w+)$/ - path = $1 - libname = $2 - end - for arg in ARGV - case arg - when /\.[oa]$/i - objs.push(arg) - when /-o/, /\w+\.dll/i - ; - else - flags << arg - end - end - - writeInit unless FileTest.exist?("#{Init}.c") - unless FileTest.exist?("#{Init}.o") and - File.mtime("#{Init}.c") < File.mtime("#{Init}.o") - xsystem "gcc -c #{Init}.c -o #{Init}.o" - end - - command = "echo EXPORTS > #{libname}.def" - xsystem command -# xsystem "echo impure_setup >> #{libname}.def" - xsystem "nm --extern-only " + objs.join(" ") + - " | sed -n '/^........ [CDT] _/s///p' >> #{libname}.def" - - command = "gcc -nostdlib -o junk.o -Wl,--base-file,#{libname}.base,--dll " + - objs.join(" ") + " #{Init}.o " - command.concat(flags.join(" ") + - " -Wl,-e,_dll_entry@12 -lcygwin -lkernel32 #{CONFIG['srcdir']}/libruby.a") - xsystem command - - command = "dlltool --as=as --dllname #{libname}.dll --def #{libname}.def --base-file #{libname}.base --output-exp #{libname}.exp" - xsystem command - - command = "gcc -s -nostdlib -o #{libname}.dll -Wl,--dll #{libname}.exp " + - objs.join(" ") + " #{Init}.o " - command.concat(flags.join(" ") + - " -Wl,-e,_dll_entry@12 -lcygwin -lkernel32 #{CONFIG['srcdir']}/libruby.a") - xsystem command - File.unlink "junk.o" if FileTest.exist? "junk.o" - -else - # no special processing, just call ld - xsystem "ld #{args}" -end diff --git a/ext/etc/etc.doc b/ext/etc/etc.doc deleted file mode 100644 index 2af895c9de..0000000000 --- a/ext/etc/etc.doc +++ /dev/null @@ -1,73 +0,0 @@ -.\" etc.doc - -*- Indented-Text -*- created at: Fri Jul 14 00:47:15 JST 1995 - -** Etc(モジュール) - -/etcディレクトリ以下の情報を得るためのモジュール.クラスにインクルード -して使うこともできる. - -Methods: -Single Methods: - - getlogin - - 自分のlogin名を返す.これが失敗した場合はgetpwuid()を用いると - 良い. - - getpwnam(name) - - /etc/passwdファイル(あるいはDBMファイルやNISデータベース)を検 - 索し,nameの名前を持つpasswdエントリを返す.戻り値はpasswd構造 - 体で以下のメンバを持つ. - - struct passwd - name # ユーザ名(文字列) - passwd # パスワード(文字列) - uid # ユーザID(整数) - gid # グループID(整数) - gecos # gecosフィールド(文字列) - dir # ホームディレクトリ(文字列) - shell # ログインシェル(文字列) - # 以降のメンバはシステムによっては提供されない. - change # パスワード変更時間(整数) - quota # クォータ(整数) - age # エージ(整数) - class # ユーザアクセスクラス(文字列) - comment # コメント(文字列) - expire # アカウント有効期限(整数) - end - - 詳細はgetpwnam(3)を参照のこと. - - getpwuid([uid]) - - uidをユーザIDとするpasswdエントリを返す.戻り値はgetpwnam()と - 同様である.引数を省略した場合にはgetuid()の値を用いる.詳細は - getpwuid(3)を参照のこと. - - getgrgid(gid) - - /etc/groupファイル(あるいは…getpwnam参照)を検索し,gidをグルー - プIDとするグループエントリを返す.戻り値はgroup構造体で以下の - メンバを持つ. - - struct group - name # グループ名(文字列) - passwd # グループのパスワード(文字列) - gid # グループID(整数) - mem # グループメンバ名の配列 - end - - 詳細はgetgrgid(3)を参照のこと. - - getgrnam(name) - - nameという名前のグループエントリを返す.戻り値はgetgrgid()と同 - 様である.詳細はgetgrnam(3)を参照. - - group - - 全てのグループエントリを順にアクセスするためのイテレータ. - - passwd - - 全てのpasswdエントリを順にアクセスするためのイテレータ. diff --git a/ext/etc/etc.txt b/ext/etc/etc.txt new file mode 100644 index 0000000000..9801dc0e02 --- /dev/null +++ b/ext/etc/etc.txt @@ -0,0 +1,72 @@ +.\" etc.doc - -*- Indented-Text -*- created at: Fri Jul 14 00:47:15 JST 1995 + +** Etc(Module) + +The module to retrieve information under /etc directory. Available +only on UNIX platforms. All operations defined in this module are +module functions, so that you can include Etc module into your class. + +Module Function: + + getlogin + + returns login name of the user. It this fails, try getpwuid(). + + getpwnam(name) + + searches in /etc/passwd file (or equivalent database), and + returns password entry for the user. The return value is an + passwd structure, which has members described below. + + struct passwd + name # user name(string) + passwd # encrypted password(string) + uid # user ID(integer) + gid # group ID(integer) + gecos # gecos field(string) + dir # home directory(string) + shell # login shell(string) + # members below are optional + change # password change time(integer) + quota # quota value(integer) + age # password age(integer) + class # user access class(string) + comment # comment(string) + expire # account expiration time(integer) + end + + See getpwnam(3) for detail. + + getpwuid([uid]) + + returns passwd entry for the specified user id. If uid is + ommitted, use the value from getuid(). See getpwuid(3) for + detail. + + getgrgid(gid) + + searches in /etc/group file (or equivalent database), and + returns group entry for the group id. The return value is an + group structure, which has members described below. + + struct group + name # group name(string) + passwd # group password(string) + gid # group ID(integer) + mem # array of the group member names + end + + See getgrgid(3) for detail. + + getgrnam(name) + + returns the group entry for the specified name. The return + value is the group structure. See getgrnam(3) for detail. + + group + + iterates over all group entries. + + passwd + + iterates over all passwd entries. diff --git a/ext/etc/etc.txt.jp b/ext/etc/etc.txt.jp new file mode 100644 index 0000000000..8191f4886b --- /dev/null +++ b/ext/etc/etc.txt.jp @@ -0,0 +1,72 @@ +.\" etc.doc - -*- Indented-Text -*- created at: Fri Jul 14 00:47:15 JST 1995 + +** Etc(モジュール) + +/etcディレクトリ以下の情報を得るためのモジュール.クラスにインクルード +して使うこともできる. + +Module Function: + + getlogin + + 自分のlogin名を返す.これが失敗した場合はgetpwuid()を用いると + 良い. + + getpwnam(name) + + /etc/passwdファイル(あるいはDBMファイルやNISデータベース)を検 + 索し,nameの名前を持つpasswdエントリを返す.戻り値はpasswd構造 + 体で以下のメンバを持つ. + + struct passwd + name # ユーザ名(文字列) + passwd # パスワード(文字列) + uid # ユーザID(整数) + gid # グループID(整数) + gecos # gecosフィールド(文字列) + dir # ホームディレクトリ(文字列) + shell # ログインシェル(文字列) + # 以降のメンバはシステムによっては提供されない. + change # パスワード変更時間(整数) + quota # クォータ(整数) + age # エージ(整数) + class # ユーザアクセスクラス(文字列) + comment # コメント(文字列) + expire # アカウント有効期限(整数) + end + + 詳細はgetpwnam(3)を参照のこと. + + getpwuid([uid]) + + uidをユーザIDとするpasswdエントリを返す.戻り値はgetpwnam()と + 同様である.引数を省略した場合にはgetuid()の値を用いる.詳細は + getpwuid(3)を参照のこと. + + getgrgid(gid) + + /etc/groupファイル(あるいは…getpwnam参照)を検索し,gidをグルー + プIDとするグループエントリを返す.戻り値はgroup構造体で以下の + メンバを持つ. + + struct group + name # グループ名(文字列) + passwd # グループのパスワード(文字列) + gid # グループID(整数) + mem # グループメンバ名の配列 + end + + 詳細はgetgrgid(3)を参照のこと. + + getgrnam(name) + + nameという名前のグループエントリを返す.戻り値はgetgrgid()と同 + 様である.詳細はgetgrnam(3)を参照. + + group + + 全てのグループエントリを順にアクセスするためのイテレータ. + + passwd + + 全てのpasswdエントリを順にアクセスするためのイテレータ. diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in index 3514ab2503..cb4b974351 100644 --- a/ext/extmk.rb.in +++ b/ext/extmk.rb.in @@ -29,7 +29,10 @@ end # get absolute path $topdir = File.expand_path("..") -load "#{$top_srcdir}/lib/find.rb" +$:.push $top_srcdir +$:.push $top_srcdir+"/lib" + +require 'find' if File.exist?("config.cache") then f = open("config.cache", "r") @@ -64,8 +67,8 @@ if RUBY_PLATFORM == "m68k-human" else CFLAGS = "@CFLAGS@" end -LINK = "@CC@ -o conftest -I#$topdir -I#$top_srcdir -I@includedir@ #{CFLAGS} @LDFLAGS@ %s %s conftest.c %s %s @LIBS@" -CPP = "@CPP@ @CPPFLAGS@ -I#$topdir -I#$top_srcdir -I@includedir@ #{CFLAGS} %s %s conftest.c" +LINK = "@CC@ -o conftest -I#$topdir -I#$top_srcdir #{CFLAGS} -I@includedir@ @LDFLAGS@ %s %s conftest.c %s %s @LIBS@" +CPP = "@CPP@ @CPPFLAGS@ -I#$topdir -I#$top_srcdir #{CFLAGS} -I@includedir@ %s %s conftest.c" if /cygwin|mswin32|djgpp|mingw32|m68k-human|i386-os2_emx/i =~ RUBY_PLATFORM $null = open("nul", "w") @@ -180,10 +183,28 @@ def have_library(lib, func="main") if func && func != "" libs = append_library($libs, lib) - unless try_link(<<"SRC", libs) + if /mswin32/ =~ RUBY_PLATFORM + r = try_link(<<"SRC", libs) +#include +#include +int main() { return 0; } +int t() { #{func}(); return 0; } +SRC + unless r + r = try_link(<<"SRC", libs) +#include +#include +int main() { return 0; } +int t() { void ((*p)()); p = (void ((*)()))#{func}; return 0; } +SRC + end + else + r = try_link(<<"SRC", libs) int main() { return 0; } int t() { #{func}(); return 0; } SRC + end + unless r $lib_cache[lib] = 'no' $cache_mod = true return false @@ -200,7 +221,7 @@ end def find_library(lib, func, *paths) ldflags = $LDFLAGS - libs = "-l" + lib + " " + $libs + libs = append_library($libs, lib) until try_link(<<"SRC", libs) int main() { return 0; } int t() { #{func}(); return 0; } @@ -227,11 +248,28 @@ def have_func(func) libs = $libs - unless try_link(<<"SRC", libs) -char #{func}(); + if /mswin32/ =~ RUBY_PLATFORM + r = try_link(<<"SRC", libs) +#include +#include +int main() { return 0; } +int t() { #{func}(); return 0; } +SRC + unless r + r = try_link(<<"SRC", libs) +#include +#include +int main() { return 0; } +int t() { void ((*p)()); p = (void ((*)()))#{func}; return 0; } +SRC + end + else + r = try_link(<<"SRC", libs) int main() { return 0; } int t() { #{func}(); return 0; } SRC + end + unless r $func_cache[func] = 'no' $cache_mod = true return false @@ -270,7 +308,10 @@ end def arg_config(config, default=nil) unless defined? $configure_args $configure_args = {} - for arg in "@configure_args@".split + if /mswin32/ =~ RUBY_PLATFORM and ENV["CONFIGURE_ARGS"] + args = args + " " + ENV["CONFIGURE_ARGS"] + end + for arg in args.split next unless /^--/ =~ arg if /=/ =~ arg $configure_args[$`] = $' @@ -330,11 +371,13 @@ def dir_config(target) end def create_makefile(target) + $target = target + system "rm -f conftest*" if "@DLEXT@" == $OBJEXT libs = $libs.split for lib in libs - lib.sub!(/-l(.*)/, '"lib\1.a"') + lib.sub!(/-l(.*)/, '"lib\1.#{$LIBEXT}"') end $defs.push(format("-DEXTLIB='%s'", libs.join(","))) end @@ -371,7 +414,7 @@ DESTDIR = CC = @CC@ -CFLAGS = %s -I$(topdir) -I$(hdrdir) -I@includedir@ #{CFLAGS} #$CFLAGS %s +CFLAGS = %s -I$(topdir) -I$(hdrdir) #{CFLAGS} #$CFLAGS -I@includedir@ %s DLDFLAGS = #$DLDFLAGS #$LDFLAGS LDSHARED = @LDSHARED@ #{defflag} ", if $static then "" else "@CCDLFLAGS@" end, $defs.join(" ") @@ -405,17 +448,24 @@ archdir = $(pkglibdir)/@arch@ mfile.printf $objs.join(" ") mfile.printf "\n" + ruby_interpreter = "$(topdir)/miniruby@EXEEXT@" + if /mswin32/ =~ RUBY_PLATFORM + ruby_interpreter = $topdir + "/miniruby@EXEEXT@" + ruby_interpreter.gsub!("/", "\\") + end + mfile.printf < /dev/null || true " + end elsif "@DLEXT@" != $OBJEXT mfile.printf "\ $(DLLIB): $(OBJS) @@ -494,14 +551,16 @@ def extmake(target) end $OBJEXT = "@OBJEXT@" + $LIBEXT = "a" $objs = nil $local_flags = "" case RUBY_PLATFORM when /cygwin|beos|openstep|nextstep|rhapsody/ $libs = "" when /mswin32/ + $LIBEXT = "lib" $libs = "" - $local_flags = "rubymw.lib -link /LIBPATH:$(topdir) /EXPORT:Init_$(TARGET)" + $local_flags = "$(topdir)/rubymw.lib -link /EXPORT:Init_$(TARGET)" else $libs = "-lc" end @@ -526,16 +585,20 @@ def extmake(target) begin system "mkdir", target unless File.directory?(target) Dir.chdir target + $target = target $mdir = target unless $install or $clean if $static_ext.size > 0 || !File.exist?("./Makefile") || older("./Makefile", "#{$top_srcdir}/ext/@setup@") || older("./Makefile", "../extmk.rb") || + older("./Makefile", "#{$top_srcdir}/ext/#{target}/makefile.rb") || older("./Makefile", "#{$top_srcdir}/ext/#{target}/extconf.rb") then $defs = [] - if File.exist?("#{$top_srcdir}/ext/#{target}/extconf.rb") + if File.exist?("#{$top_srcdir}/ext/#{target}/makefile.rb") + load "#{$top_srcdir}/ext/#{target}/makefile.rb" + elsif File.exist?("#{$top_srcdir}/ext/#{target}/extconf.rb") load "#{$top_srcdir}/ext/#{target}/extconf.rb" else create_makefile(target) @@ -544,7 +607,7 @@ def extmake(target) end if File.exist?("./Makefile") if $static - $extlist.push [$static,target] + $extlist.push [$static,$target] end if $install system "#{$make} install DESTDIR=#{$destdir}" @@ -582,7 +645,9 @@ for setup in ["@setup@", "#{$top_srcdir}/ext/@setup@"] $nodynamic = true next end - $static_ext[$_.split[0]] = true + target = $_.split[0] + target = target.downcase if /mswin32/ =~ RUBY_PLATFORM + $static_ext[target] = true end f.close break @@ -630,7 +695,7 @@ miniruby = "miniruby@EXEEXT@" $extobjs = "" unless $extobjs if $extlist.size > 0 for s,t in $extlist - f = format("%s/%s.a", s, t) + f = format("%s/%s.%s", s, t, $LIBEXT) if File.exist?(f) $extinit += format("\ \tInit_%s();\n\ diff --git a/ext/md5/md5.doc b/ext/md5/md5.doc deleted file mode 100644 index 2203404602..0000000000 --- a/ext/md5/md5.doc +++ /dev/null @@ -1,36 +0,0 @@ -.\" md5.doc - -*- Indented-Text -*- created at: Fri Aug 2 12:01:27 JST 1996 - -** MD5(クラス) - -RFC1321に記述されているRSA Data Security, Inc. の MD5 Message-Digest -Algorithmを実装するクラス. - -SuperClass: Object - -Class Methods: - - new([str]) - md5([str]) - - 新しいMD5オブジェクトを生成する.文字列引数が与えられるとそれ - を追加する(see update). - -Methods: - - clone - - MD5オブジェクトの複製を作る - - digest - - 今までに追加した文字列に対するハッシュ値を16バイト長の文字列で - 返す. - - update(str) - - keyをキーとする値を返す. - -------------------------------------------------------- -Local variables: -fill-column: 70 -end: diff --git a/ext/md5/md5.txt b/ext/md5/md5.txt new file mode 100644 index 0000000000..0eca7c9025 --- /dev/null +++ b/ext/md5/md5.txt @@ -0,0 +1,38 @@ +.\" md5.doc - -*- Indented-Text -*- created at: Fri Aug 2 12:01:27 JST 1996 + +** MD5(Class) + +A class to implement MD5 Message-Digest Algorithm by RSA Data +Security, Inc., described in RFC1321. + +SuperClass: Object + +Class Methods: + + new([str]) + md5([str]) + + creates a new MD5 object. If a string argument is given, it + is added to the object. (see update.) + +Methods: + + clone + + copies the MD5 object. + + digest + + returns have value of the added strings as a 16 bytes string. + + update(str) + + Update the MD5 object with the string. Repeated calls are + equivalent to a single call with the concatenation of all the + arguments, i.e. m.update(a); m.update(b) is equivalent to + m.update(a+b). + +------------------------------------------------------- +Local variables: +fill-column: 70 +end: diff --git a/ext/md5/md5.txt.jp b/ext/md5/md5.txt.jp new file mode 100644 index 0000000000..a1451f1175 --- /dev/null +++ b/ext/md5/md5.txt.jp @@ -0,0 +1,37 @@ +.\" md5.doc - -*- Indented-Text -*- created at: Fri Aug 2 12:01:27 JST 1996 + +** MD5(クラス) + +RFC1321に記述されているRSA Data Security, Inc. の MD5 Message-Digest +Algorithmを実装するクラス. + +SuperClass: Object + +Class Methods: + + new([str]) + md5([str]) + + 新しいMD5オブジェクトを生成する.文字列引数が与えられるとそれ + を追加する(see update). + +Methods: + + clone + + MD5オブジェクトの複製を作る + + digest + + 今までに追加した文字列に対するハッシュ値を16バイト長の文字列で + 返す. + + update(str) + + MD5オブジェクトに文字列を追加する。複数回updateを呼ぶことは文 + 字列を連結してupdateを呼ぶことと等しい. + +------------------------------------------------------- +Local variables: +fill-column: 70 +end: diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 90964663d1..93a8aacce3 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -394,19 +394,13 @@ s_recv(sock, argc, argv, from) case RECV_RECV: return (VALUE)str; case RECV_TCP: + case RECV_UDP: #if 0 if (alen != sizeof(struct sockaddr_in)) { rb_raise(rb_eTypeError, "sockaddr size differs - should not happen"); } #endif return rb_assoc_new(str, ipaddr((struct sockaddr *)buf)); - case RECV_UDP: - { - VALUE addr = ipaddr((struct sockaddr *)buf); - - return rb_assoc_new(str, rb_assoc_new(RARRAY(addr)->ptr[2], - RARRAY(addr)->ptr[1])); - } #ifdef HAVE_SYS_UN_H case RECV_UNIX: return rb_assoc_new(str, unixaddr((struct sockaddr_un *)buf)); diff --git a/ext/tcltklib/extconf.rb b/ext/tcltklib/extconf.rb index ec06f8b245..e1086855ba 100644 --- a/ext/tcltklib/extconf.rb +++ b/ext/tcltklib/extconf.rb @@ -39,8 +39,8 @@ def find_tk(tklib) end if have_header("tcl.h") && have_header("tk.h") && - find_library("X11", "XOpenDisplay", - "/usr/X11/lib", "/usr/X11R6/lib", "/usr/openwin/lib") && + (/mswin32/ =~ RUBY_PLATFORM || find_library("X11", "XOpenDisplay", + "/usr/X11/lib", "/usr/X11R6/lib", "/usr/openwin/lib")) && find_tcl(tcllib) && find_tk(tklib) create_makefile("tcltklib") diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c index 314246869e..b1dae089db 100644 --- a/ext/tcltklib/tcltklib.c +++ b/ext/tcltklib/tcltklib.c @@ -4,6 +4,10 @@ * Oct. 24, 1997 Y. Matsumoto */ +#if defined(NT) +# include +#endif + #include #include #include -- cgit v1.2.3