Changeset 21294

Show
Ignore:
Timestamp:
10/14/08 02:48:48 (3 months ago)
Author:
takeru
Message:

patch ruby for gekko

Location:
platform/wii/ruby_for_wii/ruby_1_8
Files:
2 added
9 modified

Legend:

Unmodified
Added
Removed
  • platform/wii/ruby_for_wii/ruby_1_8/common.mk

    r21288 r21294  
    5959                variable.$(OBJEXT) \ 
    6060                version.$(OBJEXT) \ 
     61                gekko.$(OBJEXT) \ 
    6162                $(MISSING) 
    6263 
     
    433434version.$(OBJEXT): {$(VPATH)}version.c $(RUBY_H_INCLUDES) \ 
    434435  {$(VPATH)}version.h {$(VPATH)}revision.h 
     436gekko.$(OBJEXT): {$(VPATH)}gekko.c $(RUBY_H_INCLUDES) 
    435437 
    436438dist: $(PROGRAM) 
  • platform/wii/ruby_for_wii/ruby_1_8/config.sub

    r21288 r21294  
    55#   Free Software Foundation, Inc. 
    66 
    7 timestamp='2008-01-16' 
     7timestamp='2008-09-30' 
    88 
    99# This file is (in principle) common to ALL GNU software. 
     
    149149        -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ 
    150150        -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ 
    151         -apple | -axis | -knuth | -cray) 
     151        -apple | -axis | -knuth | -cray | -gekko) 
    152152                os= 
    153153                basic_machine=$1 
  • platform/wii/ruby_for_wii/ruby_1_8/ext/Setup

    r21288 r21294  
    1 #option nodynamic 
     1option nodynamic 
    22 
    33#Win32API 
     
    1111#digest/sha2 
    1212#dl 
    13 #enumerator 
     13enumerator 
    1414#etc 
    1515#fcntl 
     
    2323#readline 
    2424#sdbm 
    25 #socket 
    26 #stringio 
     25socket 
     26stringio 
    2727#strscan 
    2828#syck 
    29 #syslog 
     29syslog 
    3030#tcltklib 
    31 #thread 
     31thread 
    3232#tk 
    3333#win32ole 
    34 #zlib 
     34zlib 
  • platform/wii/ruby_for_wii/ruby_1_8/ext/socket/extconf.rb

    r21288 r21294  
    11require 'mkmf' 
     2 
     3#CPPFLAGS = -DHAVE_SENDMSG -DHAVE_RECVMSG                                                        -Dsocklen_t=int -DHAVE_SOCKET -DHAVE_HSTERROR -DHAVE_GETIPNODEBYNAME                                      -I. -I/Users/takeru/tmp/devkitpro/libogc/include  -I/Users/takeru/tmp/devkitpro/libogc/include 
     4#           -DHAVE_SENDMSG -DHAVE_RECVMSG -DHAVE_INET_NTOP -DHAVE_INET_PTON -DHAVE_GETSERVBYPORT -Dsocklen_t=int -DHAVE_SOCKET -DHAVE_HSTERROR -DHAVE_GETIPNODEBYNAME -DHAVE_SOCKETPAIR -DHAVE_GETHOSTNAME -I. -I/Users/takeru/tmp/devkitpro/libogc/include  -I/Users/takeru/tmp/devkitpro/libogc/include 
     5#-DHAVE_INET_NTOP -DHAVE_INET_PTON -DHAVE_GETSERVBYPORT -DHAVE_SOCKETPAIR -DHAVE_GETHOSTNAME 
     6puts "RUBY_PLATFORM=#{RUBY_PLATFORM}" 
     7GEKKO = Config::CONFIG["CFLAGS"] =~ /-DGEKKO/ 
    28 
    39case RUBY_PLATFORM 
     
    259265  $objs += ["getaddrinfo.#{$OBJEXT}"] 
    260266  $objs += ["getnameinfo.#{$OBJEXT}"] 
    261   have_func("inet_ntop") or have_func("inet_ntoa") 
    262   have_func("inet_pton") or have_func("inet_aton") 
    263   have_func("getservbyport") 
     267  unless GEKKO 
     268    have_func("inet_ntop") or have_func("inet_ntoa") 
     269    have_func("inet_pton") or have_func("inet_aton") 
     270    have_func("getservbyport") 
     271  end 
    264272  have_header("arpa/nameser.h") 
    265273  have_header("resolv.h") 
     
    276284  have_func("hsterror") 
    277285  have_func("getipnodebyname") or have_func("gethostbyname2") 
    278   have_func("socketpair") 
    279   unless have_func("gethostname") 
    280     have_func("uname") 
     286  unless GEKKO 
     287    have_func("socketpair") 
     288    unless have_func("gethostname") 
     289      have_func("uname") 
     290    end 
    281291  end 
    282292  if enable_config("socks", ENV["SOCKS_SERVER"]) 
  • platform/wii/ruby_for_wii/ruby_1_8/ext/socket/getaddrinfo.c

    r21288 r21294  
    4545#if defined(__BEOS__) && !defined(BONE) 
    4646# include <net/socket.h> 
     47#elif defined(GEKKO) 
     48# include <network.h> 
     49  #define socket        io_net_socket 
     50  #define gethostbyname net_gethostbyname 
     51  #include <errno.h> 
     52  #define h_errno errno 
    4753#else 
    4854# include <sys/socket.h> 
     
    388394                        port = htons((unsigned short)atoi(servname)); 
    389395                } else { 
     396#if !defined(GEKKO) 
    390397                        struct servent *sp; 
    391398                        char *proto; 
     
    418425                                } else 
    419426                                        ERR(EAI_PROTOCOL);      /*xxx*/ 
    420                 } 
    421         } 
    422          
     427#else 
     428                        ERR(EAI_SERVICE); 
     429                        ERR(EAI_PROTOCOL); 
     430#endif 
     431                } 
     432        } 
     433 
    423434        /* 
    424435         * hostname == NULL. 
     
    619630#endif 
    620631        if (hp == NULL) { 
     632#if !defined(GEKKO) 
    621633                switch (h_error) { 
    622634                case HOST_NOT_FOUND: 
     
    632644                        break; 
    633645                } 
     646#else 
     647        error = EAI_NODATA; 
     648#endif 
    634649                goto bad; 
    635650        } 
  • platform/wii/ruby_for_wii/ruby_1_8/ext/socket/getnameinfo.c

    r21288 r21294  
    4141#if defined(__BEOS__) && !defined(BONE) 
    4242# include <net/socket.h> 
     43#elif defined(GEKKO) 
     44# include <network.h> 
     45  #include <errno.h> 
     46  #define h_errno errno 
    4347#else 
    4448# include <sys/socket.h> 
  • platform/wii/ruby_for_wii/ruby_1_8/ext/socket/socket.c

    r21288 r21294  
    2929#if defined(__BEOS__) && !defined(BONE) 
    3030# include <net/socket.h> 
     31#elif defined(GEKKO) 
     32# include <network.h> 
     33  #define setsockopt    io_net_setsockopt 
     34  #define shutdown      io_net_shutdown 
     35  #define sendto        io_net_sendto 
     36  #define send          io_net_send 
     37  #define recvfrom      io_net_recvfrom 
     38  #define socket        io_net_socket 
     39  #define connect       io_net_connect 
     40  #define bind          io_net_bind 
     41  #define listen        io_net_listen 
     42  #define gethostbyname net_gethostbyname 
     43  #define accept        io_net_accept 
     44  #define h_addr 
     45  #define MSG_OOB 0 
    3146#else 
    3247# include <sys/socket.h> 
     
    464479    VALUE sock, lev, optname; 
    465480{ 
    466 #if !defined(__BEOS__) 
     481#if !defined(__BEOS__) && !defined(GEKKO) 
    467482    int level, option; 
    468483    socklen_t len; 
     
    913928    hostp = host_str(host, hbuf, sizeof(hbuf)); 
    914929    portp = port_str(port, pbuf, sizeof(pbuf)); 
    915  
     930//printf("hostp=%s portp=%s\n", hostp, portp); 
    916931    if (socktype == 0 && flags == 0 && str_isnumber(portp)) { 
    917932       socktype = SOCK_DGRAM; 
     
    923938    hints.ai_flags = flags; 
    924939    error = getaddrinfo(hostp, portp, &hints, &res); 
     940//printf("getaddrinfo error=%d\n", error); 
    925941    if (error) { 
    926942        if (hostp && hostp[strlen(hostp)-1] == '\n') { 
     
    10131029{ 
    10141030    int fd; 
    1015  
    10161031    fd = socket(domain, type, proto); 
     1032//printf("socket1:domain=%d type=%d proto=%d fd=%d\n", domain, type, proto, fd); 
    10171033    if (fd < 0) { 
    10181034        if (errno == EMFILE || errno == ENFILE) { 
    10191035            rb_gc(); 
    10201036            fd = socket(domain, type, proto); 
     1037//printf("socket2:domain=%d type=%d proto=%d fd=%d\n", domain, type, proto, fd); 
    10211038        } 
    10221039    } 
     
    10701087#define WAIT_IN_PROGRESS 0 
    10711088#endif 
     1089#ifdef GEKKO 
     1090#define WAIT_IN_PROGRESS 0 
     1091#endif 
    10721092#ifndef WAIT_IN_PROGRESS 
    10731093/* BSD origin code apparently has a problem */ 
     
    10891109    socklen_t sockerrlen; 
    10901110#endif 
     1111 
     1112/* 
     1113 { 
     1114   struct sockaddr_in *sa; 
     1115   sa = (struct sockaddr_in*)sockaddr; 
     1116   printf("ruby_connect:sockaddr_in f=%d p=%d a=%x\n", sa->sin_family, ntohs(sa->sin_port), sa->sin_addr.s_addr); 
     1117 } 
     1118*/ 
    10911119 
    10921120#if defined(HAVE_FCNTL) 
     
    11121140#endif /* HAVE_FCNTL */ 
    11131141 
     1142 
    11141143    for (;;) { 
    11151144#if defined(SOCKS) && !defined(SOCKS5) 
     
    11221151            status = connect(fd, sockaddr, len); 
    11231152        } 
     1153//printf("ruby_connect:connect:status=%d\n", status); 
     1154 
     1155 
    11241156        if (status < 0) { 
    11251157            switch (errno) { 
     
    11451177#endif 
    11461178                status = wait_connectable(fd); 
     1179//printf("ruby_connect:wait_connectable:status=%d\n", status); 
    11471180                if (status) { 
    11481181                    break; 
     
    12271260    const char *syscall = 0; 
    12281261 
     1262//printf("arg->remote.serv=%d\n", NUM2INT(arg->remote.serv)); 
    12291263    arg->remote.res = sock_addrinfo(arg->remote.host, arg->remote.serv, SOCK_STREAM, 
    12301264                                    (type == INET_SERVER) ? AI_PASSIVE : 0); 
     1265 
    12311266    /* 
    12321267     * Maybe also accept a local address 
     
    12401275    for (res = arg->remote.res; res; res = res->ai_next) { 
    12411276        status = ruby_socket(res->ai_family,res->ai_socktype,res->ai_protocol); 
     1277//printf("socket:status=%d\n", status); 
    12421278        syscall = "socket(2)"; 
    12431279        fd = status; 
     
    12611297            } 
    12621298 
     1299/* 
     1300 { 
     1301   struct sockaddr_in *sa; 
     1302   sa = (struct sockaddr_in*)res->ai_addr; 
     1303   printf("sockaddr_in f=%d p=%d a=%x len=%d\n", sa->sin_family, ntohs(sa->sin_port), sa->sin_addr.s_addr, res->ai_addrlen); 
     1304 } 
     1305*/ 
     1306 
    12631307            if (status >= 0) { 
    12641308                status = ruby_connect(fd, res->ai_addr, res->ai_addrlen, 
    12651309                                      (type == INET_SOCKS)); 
     1310//printf("connect:status=%d\n", status); 
    12661311                syscall = "connect(2)"; 
    12671312            } 
     
    34273472    VALUE *argv; 
    34283473{ 
     3474#if !defined(GEKKO) 
    34293475    VALUE service, proto; 
    34303476    struct servent *sp; 
     
    34503496    } 
    34513497    return INT2FIX(port); 
     3498#else 
     3499    rb_notimplement(); 
     3500#endif 
    34523501} 
    34533502 
  • platform/wii/ruby_for_wii/ruby_1_8/process.c

    r21288 r21294  
    15471547    status = system(StringValueCStr(cmd)); 
    15481548    last_status_set((status & 0xff) << 8, 0); 
     1549#elif defined(GEKKO) 
     1550        status = 0; 
    15491551#else 
    15501552    volatile VALUE prog = 0; 
  • platform/wii/ruby_for_wii/ruby_1_8/signal.c

    r21288 r21294  
    2020#ifdef __BEOS__ 
    2121#undef SIGBUS 
     22#endif 
     23 
     24#ifdef GEKKO 
     25#define MACOS_UNUSE_SIGNAL 
    2226#endif 
    2327 
     
    578582#endif 
    579583 
    580 #if !defined(BSD_SIGNAL) && !defined(POSIX_SIGNAL) 
     584#if !defined(BSD_SIGNAL) && !defined(POSIX_SIGNAL) && !defined(GEKKO) 
    581585    if (rb_trap_accept_nativethreads[sig]) { 
    582586        ruby_nativethread_signal(sig, sighandler);