summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/Setup.emx16
-rw-r--r--ext/Setup.nt13
-rw-r--r--ext/cygwin32_ld.rb90
-rw-r--r--ext/etc/etc.txt72
-rw-r--r--ext/etc/etc.txt.jp (renamed from ext/etc/etc.doc)3
-rw-r--r--ext/extmk.rb.in103
-rw-r--r--ext/md5/md5.txt38
-rw-r--r--ext/md5/md5.txt.jp (renamed from ext/md5/md5.doc)3
-rw-r--r--ext/socket/socket.c8
-rw-r--r--ext/tcltklib/extconf.rb4
-rw-r--r--ext/tcltklib/tcltklib.c4
11 files changed, 230 insertions, 124 deletions
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 <windows.h>
-#include <stdio.h>
-
-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.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.doc b/ext/etc/etc.txt.jp
index 2af895c9de..8191f4886b 100644
--- a/ext/etc/etc.doc
+++ b/ext/etc/etc.txt.jp
@@ -5,8 +5,7 @@
/etcディレクトリ以下の情報を得るためのモジュール.クラスにインクルード
して使うこともできる.
-Methods:
-Single Methods:
+Module Function:
getlogin
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 <windows.h>
+#include <winsock.h>
+int main() { return 0; }
+int t() { #{func}(); return 0; }
+SRC
+ unless r
+ r = try_link(<<"SRC", libs)
+#include <windows.h>
+#include <winsock.h>
+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 <windows.h>
+#include <winsock.h>
+int main() { return 0; }
+int t() { #{func}(); return 0; }
+SRC
+ unless r
+ r = try_link(<<"SRC", libs)
+#include <windows.h>
+#include <winsock.h>
+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 <<EOS
TARGET = #{target}
-DLLIB = $(TARGET).#{$static ? "a" : "@DLEXT@"}
+DLLIB = $(TARGET).#{$static ? $LIBEXT : "@DLEXT@"}
-RUBY = ../../miniruby@EXEEXT@
+RUBY = #{ruby_interpreter} -I$(topdir) -I$(hdrdir)/lib
EXEEXT = @EXEEXT@
all: $(DLLIB)
-clean:; @rm -f *.#{$OBJEXT} *.so *.sl *.a $(DLLIB)
+clean:; @rm -f *.#{$OBJEXT} *.so *.sl *.#{$LIBEXT} $(DLLIB)
+ @rm -f *.ilk *.exp *.pdb *.bak
@rm -f Makefile extconf.h conftest.*
@rm -f core ruby$(EXEEXT) *~
@@ -436,11 +486,18 @@ EOS
mfile.printf "\n"
if $static
- mfile.printf "\
+ if "@AR@" =~ /^lib\b/i
+ mfile.printf "\
+$(DLLIB): $(OBJS)
+ @AR@ /OUT:$(DLLIB) $(OBJS)
+"
+ else
+ mfile.printf "\
$(DLLIB): $(OBJS)
@AR@ cru $(DLLIB) $(OBJS)
@-@RANLIB@ $(DLLIB) 2> /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.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.doc b/ext/md5/md5.txt.jp
index 2203404602..a1451f1175 100644
--- a/ext/md5/md5.doc
+++ b/ext/md5/md5.txt.jp
@@ -28,7 +28,8 @@ Methods:
update(str)
- keyをキーとする値を返す.
+ MD5オブジェクトに文字列を追加する。複数回updateを呼ぶことは文
+ 字列を連結してupdateを呼ぶことと等しい.
-------------------------------------------------------
Local variables:
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 <windows.h>
+#endif
+
#include <stdio.h>
#include <string.h>
#include <tcl.h>