* dln.c: Ruby no longer supports MacOS 9 or before.

* eval.c: ditto.

* eval_intern.h: ditto.

* ext/extmk.rb: ditto.

* ext/tk/sample/tkextlib/treectrl/demo.rb: ditto.

* ext/tk/stubs.c: ditto.

* file.c: ditto.

* hash.c: ditto.

* include/ruby/defines.h: ditto.

* ruby.c: ditto.

* signal.c: ditto.

* vm_core.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
yugui 2008-10-04 13:42:00 +00:00
parent ae7ea3332b
commit 642e081879
13 changed files with 32 additions and 180 deletions

View File

@ -1,3 +1,29 @@
Sat Oct 4 22:35:06 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
* dln.c: Ruby no longer supports MacOS 9 or before.
* eval.c: ditto.
* eval_intern.h: ditto.
* ext/extmk.rb: ditto.
* ext/tk/sample/tkextlib/treectrl/demo.rb: ditto.
* ext/tk/stubs.c: ditto.
* file.c: ditto.
* hash.c: ditto.
* include/ruby/defines.h: ditto.
* ruby.c: ditto.
* signal.c: ditto.
* vm_core.h: ditto.
Sat Oct 4 22:30:28 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
* dln.c: Ruby no longer supports MS-DOS.

86
dln.c
View File

@ -75,13 +75,6 @@ char *getenv();
#include <dlfcn.h>
#endif
#ifdef __MACOS__
# include <TextUtils.h>
# include <CodeFragments.h>
# include <Aliases.h>
# include "macruby_private.h"
#endif
#if defined(__APPLE__) && defined(__MACH__) /* Mac OS X */
# if defined(HAVE_DLOPEN)
/* Mac OS X with dlopen (10.3 or later) */
@ -119,11 +112,7 @@ init_funcname_len(char **buf, const char *file)
/* Load the file as an object one */
for (slash = file-1; *file; file++) /* Find position of last '/' */
#ifdef __MACOS__
if (*file == ':') slash = file;
#else
if (*file == '/') slash = file;
#endif
len = strlen(FUNCNAME_PATTERN) + strlen(slash + 1);
*buf = xmalloc(len);
@ -1480,53 +1469,6 @@ dln_load(const char *file)
}
#endif /* __BEOS__*/
#ifdef __MACOS__ /* Mac OS 9 or before */
# define DLN_DEFINED
{
OSErr err;
FSSpec libspec;
CFragConnectionID connID;
Ptr mainAddr;
char errMessage[1024];
Boolean isfolder, didsomething;
Str63 fragname;
Ptr symAddr;
CFragSymbolClass class;
void (*init_fct)();
char fullpath[MAXPATHLEN];
strcpy(fullpath, file);
/* resolve any aliases to find the real file */
c2pstr(fullpath);
(void)FSMakeFSSpec(0, 0, fullpath, &libspec);
err = ResolveAliasFile(&libspec, 1, &isfolder, &didsomething);
if (err) {
rb_loaderror("Unresolved Alias - %s", file);
}
/* Load the fragment (or return the connID if it is already loaded */
fragname[0] = 0;
err = GetDiskFragment(&libspec, 0, 0, fragname,
kLoadCFrag, &connID, &mainAddr,
errMessage);
if (err) {
p2cstr(errMessage);
rb_loaderror("%s - %s",errMessage , file);
}
/* Locate the address of the correct init function */
c2pstr(buf);
err = FindSymbol(connID, buf, &symAddr, &class);
if (err) {
rb_loaderror("Unresolved symbols - %s" , file);
}
init_fct = (void (*)())symAddr;
(*init_fct)();
return (void*)init_fct;
}
#endif /* __MACOS__ */
#if defined(__VMS)
#define DLN_DEFINED
{
@ -1581,7 +1523,7 @@ dln_find_exe_r(const char *fname, const char *path, char *buf, int size)
}
if (!path) {
#if defined(_WIN32) || defined(__MACOS__)
#if defined(_WIN32)
path = "/usr/local/bin;/usr/ucb;/usr/bin;/bin;.";
#else
path = "/usr/local/bin:/usr/ucb:/usr/bin:/bin:.";
@ -1593,13 +1535,8 @@ dln_find_exe_r(const char *fname, const char *path, char *buf, int size)
char *
dln_find_file_r(const char *fname, const char *path, char *buf, int size)
{
#ifndef __MACOS__
if (!path) path = ".";
return dln_find_1(fname, path, buf, size, 0);
#else
if (!path) path = ".";
return _macruby_path_conv_posix_to_macos(dln_find_1(fname, path, buf, size, 0));
#endif
}
static char fbuf[MAXPATHLEN];
@ -1624,9 +1561,6 @@ dln_find_1(const char *fname, const char *path, char *fbuf, int size,
register const char *ep;
register char *bp;
struct stat st;
#ifdef __MACOS__
const char* mac_fullpath;
#endif
#define RETURN_IF(expr) if (expr) return (char *)fname;
@ -1728,37 +1662,19 @@ dln_find_1(const char *fname, const char *path, char *fbuf, int size,
continue;
}
strcpy(bp + i, extension[j]);
#ifndef __MACOS__
if (stat(fbuf, &st) == 0)
return fbuf;
#else
if (mac_fullpath = _macruby_exist_file_in_libdir_as_posix_name(fbuf))
return mac_fullpath;
#endif
}
goto next;
}
#endif /* _WIN32 or __EMX__ */
#ifndef __MACOS__
if (stat(fbuf, &st) == 0) {
if (exe_flag == 0) return fbuf;
/* looking for executable */
if (!S_ISDIR(st.st_mode) && eaccess(fbuf, X_OK) == 0)
return fbuf;
}
#else
if (mac_fullpath = _macruby_exist_file_in_libdir_as_posix_name(fbuf)) {
if (exe_flag == 0) return mac_fullpath;
/* looking for executable */
if (stat(mac_fullpath, &st) == 0) {
if (!S_ISDIR(st.st_mode) && eaccess(mac_fullpath, X_OK) == 0)
return mac_fullpath;
}
}
#endif
next:
/* if not, and no other alternatives, life is bleak */
if (*ep == '\0') {

10
eval.c
View File

@ -31,7 +31,7 @@ VALUE rb_eSysStackError;
#if defined(__APPLE__)
#define environ (*_NSGetEnviron())
#elif !defined(_WIN32) && !defined(__MACOS__) || defined(_WIN32_WCE)
#elif !defined(_WIN32) && defined(_WIN32_WCE)
extern char **environ;
#endif
char **rb_origenviron;
@ -54,11 +54,7 @@ ruby_init(void)
return;
initialized = 1;
#ifdef __MACOS__
rb_origenviron = 0;
#else
rb_origenviron = environ;
#endif
Init_stack((void *)&state);
Init_BareVM();
@ -68,9 +64,7 @@ ruby_init(void)
if ((state = EXEC_TAG()) == 0) {
rb_call_inits();
#ifdef __MACOS__
_macruby_init();
#elif defined(__VMS)
#if defined(__VMS)
_vmsruby_init();
#endif

View File

@ -64,10 +64,6 @@ char *strrchr(const char *, const char);
#include <net/socket.h>
#endif
#ifdef __MACOS__
#include "macruby_private.h"
#endif
#ifdef __VMS
#include "vmsruby_private.h"
#endif

View File

@ -39,7 +39,7 @@ load File.expand_path("lib/mkmf.rb", srcdir)
require 'optparse/shellwords'
def sysquote(x)
@quote ||= /os2|macos/ =~ (CROSS_COMPILING || RUBY_PLATFORM)
@quote ||= /os2/ =~ (CROSS_COMPILING || RUBY_PLATFORM)
@quote ? x.quote : x
end

View File

@ -156,8 +156,6 @@ class TkTreeCtrl_demo
@src_top = TkToplevel.new
f = TkFrame.new(@src_top, :borderwidth=>0)
case @thisPlatform
when 'macintosh', 'macos'
font = TkFont.new(['Geneva', 9])
when 'unix'
font = TkFont.new(['Courier', -12])
else
@ -198,10 +196,6 @@ class TkTreeCtrl_demo
def tree_plus_scrollbars_in_a_frame(parent, h, v)
f = TkFrame.new(parent, :borderwidth=>1, :relief=>:sunken)
case @thisPlatform
when 'macintosh'
font = TkFont.new(['Geneva', 9])
when 'macos'
font = TkFont.new(['Lucida Grande', 11])
when 'unix'
font = TkFont.new(['Helvetica', -12])
else
@ -244,7 +238,7 @@ class TkTreeCtrl_demo
Tk.root.title('Tk::TreeCtrl Demo')
case @thisPlatform
when 'macintosh', 'macosx'
when 'macosx'
Tk.root.geometry('+40+40')
else
Tk.root.geometry('+0+30')

View File

@ -11,25 +11,6 @@
/*------------------------------*/
#ifdef __MACOS__
# include <tkMac.h>
# include <Quickdraw.h>
static int call_macinit = 0;
static void
_macinit()
{
if (!call_macinit) {
tcl_macQdPtr = &qd; /* setup QuickDraw globals */
Tcl_MacSetEventProc(TkMacConvertEvent); /* setup event handler */
call_macinit = 1;
}
}
#endif
/*------------------------------*/
static int nativethread_checked = 0;
static void
@ -320,10 +301,6 @@ ruby_tk_stubs_init(tcl_ip)
if (!Tk_InitStubs(tcl_ip, (char *)"8.1", 0))
return FAIL_Tk_InitStubs;
#ifdef __MACOS__
_macinit();
#endif
}
return TCLTK_STUBS_OK;
@ -359,10 +336,6 @@ ruby_tk_stubs_safeinit(tcl_ip)
if (!Tk_InitStubs(tcl_ip, (char *)"8.1", 0))
return FAIL_Tk_InitStubs;
#ifdef __MACOS__
_macinit();
#endif
}
return TCLTK_STUBS_OK;
@ -517,9 +490,6 @@ ruby_tk_stubs_init(tcl_ip)
return FAIL_Tk_Init;
if (!call_tk_stubs_init) {
#ifdef __MACOS__
_macinit();
#endif
call_tk_stubs_init = 1;
}
@ -539,9 +509,6 @@ ruby_tk_stubs_safeinit(tcl_ip)
return FAIL_Tk_Init;
if (!call_tk_stubs_init) {
#ifdef __MACOS__
_macinit();
#endif
call_tk_stubs_init = 1;
}

19
file.c
View File

@ -4468,15 +4468,6 @@ rb_path_check(const char *path)
return 1;
}
#if defined(__MACOS__) || defined(riscos)
static int
is_macos_native_path(const char *path)
{
if (strchr(path, ':')) return 1;
return 0;
}
#endif
static int
file_load_ok(const char *path)
{
@ -4571,16 +4562,6 @@ rb_find_file(VALUE path)
f = StringValueCStr(path);
}
#if defined(__MACOS__) || defined(riscos)
if (is_macos_native_path(f)) {
if (rb_safe_level() >= 1 && !fpath_check(f)) {
rb_raise(rb_eSecurityError, "loading from unsafe file %s", f);
}
if (file_load_ok(f)) return path;
return 0;
}
#endif
if (is_absolute_path(f) || is_explicit_relative(f)) {
if (rb_safe_level() >= 1 && !fpath_check(f)) {
rb_raise(rb_eSecurityError, "loading from unsafe file %s", f);

5
hash.c
View File

@ -2640,7 +2640,6 @@ Init_Hash(void)
rb_define_method(rb_cHash,"compare_by_identity", rb_hash_compare_by_id, 0);
rb_define_method(rb_cHash,"compare_by_identity?", rb_hash_compare_by_id_p, 0);
#ifndef __MACOS__ /* environment variables nothing on MacOS. */
origenviron = environ;
envtbl = rb_obj_alloc(rb_cObject);
rb_extend_object(envtbl, rb_mEnumerable);
@ -2686,8 +2685,4 @@ Init_Hash(void)
rb_define_singleton_method(envtbl,"rassoc", env_rassoc, 1);
rb_define_global_const("ENV", envtbl);
#else /* __MACOS__ */
envtbl = rb_hash_s_new(0, NULL, rb_cHash);
rb_define_global_const("ENV", envtbl);
#endif /* ifndef __MACOS__ environment variables nothing on MacOS. */
}

View File

@ -245,8 +245,6 @@ void rb_ia64_flushrs(void);
#if defined(DOSISH)
#define PATH_SEP ";"
#elif defined(riscos)
#define PATH_SEP ","
#else
#define PATH_SEP ":"
#endif

6
ruby.c
View File

@ -46,10 +46,6 @@
# define MAXPATHLEN 1024
#endif
#if defined(__MACOS__) && defined(__MWERKS__)
#include <console.h>
#endif
#include "ruby/util.h"
#ifndef HAVE_STDLIB_H
@ -1554,8 +1550,6 @@ ruby_sysinit(int *argc, char ***argv)
}
v2[n] = 0;
*argv = v2;
#elif defined(__MACOS__) && defined(__MWERKS__)
*argc = ccommand(argv);
#elif defined(_WIN32)
void rb_w32_sysinit(int *argc, char ***argv);
rb_w32_sysinit(argc, argv);

View File

@ -298,10 +298,8 @@ interrupt_init(int argc, VALUE *argv, VALUE self)
void
ruby_default_signal(int sig)
{
#ifndef MACOS_UNUSE_SIGNAL
signal(sig, SIG_DFL);
raise(sig);
#endif
}
/*
@ -1033,7 +1031,6 @@ int ruby_enable_coredump = 0;
void
Init_signal(void)
{
#ifndef MACOS_UNUSE_SIGNAL
VALUE mSignal = rb_define_module("Signal");
rb_define_global_function("trap", sig_trap, -1);
@ -1085,6 +1082,4 @@ Init_signal(void)
#elif defined(SIGCHLD)
init_sigchld(SIGCHLD);
#endif
#endif /* MACOS_UNUSE_SIGNAL */
}

View File

@ -35,11 +35,7 @@
#include <signal.h>
#ifndef NSIG
# if defined MACOS_UNUSE_SIGNAL
# define NSIG 1
# else
# define NSIG (_SIGMAX + 1) /* For QNX */
# endif
#endif
#define RUBY_NSIG NSIG