ruby-changes:20813
From: usa <ko1@a...>
Date: Fri, 5 Aug 2011 20:34:30 +0900 (JST)
Subject: [ruby-changes:20813] usa:r32861 (trunk): more clarified the license.
usa 2011-08-05 20:31:52 +0900 (Fri, 05 Aug 2011) New Revision: 32861 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32861 Log: more clarified the license. updated version of r32830, but not included include/ruby/win32.h. Modified files: trunk/win32/win32.c Index: win32/win32.c =================================================================== --- win32/win32.c (revision 32860) +++ win32/win32.c (revision 32861) @@ -9,7 +9,16 @@ * Some of this code was derived from the MSDOS port(s) and the OS/2 port. * */ +/* + The parts licensed under above copyright notice are marked as "Artistic or + GPL". + Another parts are licensed under Ruby's License. + Copyright (C) 1993-2011 Yukihiro Matsumoto + Copyright (C) 2000 Network Applied Communication Laboratory, Inc. + Copyright (C) 2000 Information-technology Promotion Agency, Japan + */ + #include "ruby/ruby.h" #include "ruby/encoding.h" #include "dln.h" @@ -209,7 +218,7 @@ { WSAEREMOTE, EREMOTE }, }; -/* non GPL */ +/* License: Ruby's */ int rb_w32_map_errno(DWORD winerr) { @@ -237,7 +246,7 @@ static OSVERSIONINFO osver; -/* GPL */ +/* License: Artistic or GPL */ static void get_version(void) { @@ -247,7 +256,7 @@ } #ifdef _M_IX86 -/* GPL */ +/* License: Artistic or GPL */ DWORD rb_w32_osid(void) { @@ -255,7 +264,7 @@ } #endif -/* GPL */ +/* License: Artistic or GPL */ DWORD rb_w32_osver(void) { @@ -270,7 +279,7 @@ #define IfWin95(win95, winnt) (winnt) #endif -/* non GPL */ +/* License: Ruby's */ HANDLE GetCurrentThreadHandle(void) { @@ -289,7 +298,7 @@ /* simulate flock by locking a range on the file */ -/* GPL */ +/* License: Artistic or GPL */ #define LK_ERR(f,i) \ do { \ if (f) \ @@ -306,7 +315,7 @@ } while (0) #define LK_LEN ULONG_MAX -/* GPL */ +/* License: Artistic or GPL */ static uintptr_t flock_winnt(uintptr_t self, int argc, uintptr_t* argv) { @@ -344,7 +353,7 @@ } #ifdef WIN95 -/* GPL */ +/* License: Artistic or GPL */ static uintptr_t flock_win95(uintptr_t self, int argc, uintptr_t* argv) { @@ -375,7 +384,7 @@ #undef LK_ERR -/* GPL */ +/* License: Artistic or GPL */ int flock(int fd, int oper) { @@ -397,7 +406,7 @@ (DWORD)-1); } -/* non GPL */ +/* License: Ruby's */ static inline WCHAR * translate_wchar(WCHAR *p, int from, int to) { @@ -408,7 +417,7 @@ return p; } -/* non GPL */ +/* License: Ruby's */ static inline char * translate_char(char *p, int from, int to) { @@ -436,7 +445,7 @@ #define CSIDL_PROFILE 40 #endif -/* non GPL */ +/* License: Ruby's */ static BOOL get_special_folder(int n, WCHAR *env) { @@ -452,7 +461,7 @@ return f; } -/* non GPL */ +/* License: Ruby's */ static void regulate_path(WCHAR *path) { @@ -463,7 +472,7 @@ } } -/* non GPL */ +/* License: Ruby's */ static FARPROC get_proc_address(const char *module, const char *func, HANDLE *mh) { @@ -487,7 +496,7 @@ return ptr; } -/* non GPL */ +/* License: Ruby's */ static UINT get_system_directory(WCHAR *path, UINT len) { @@ -501,7 +510,7 @@ #define numberof(array) (sizeof(array) / sizeof(*array)) -/* non GPL */ +/* License: Ruby's */ VALUE rb_w32_special_folder(int type) { @@ -512,7 +521,7 @@ return rb_w32_conv_from_wchar(path, rb_filesystem_encoding()); } -/* non GPL */ +/* License: Ruby's */ UINT rb_w32_system_tmpdir(WCHAR *path, UINT len) { @@ -529,7 +538,7 @@ return p - path + numberof(temp) - 1; } -/* non GPL */ +/* License: Ruby's */ static void init_env(void) { @@ -596,7 +605,7 @@ typedef BOOL (WINAPI *cancel_io_t)(HANDLE); static cancel_io_t cancel_io = NULL; -/* non GPL */ +/* License: Ruby's */ static void init_func(void) { @@ -607,7 +616,7 @@ static void init_stdhandle(void); #if RT_VER >= 80 -/* non GPL */ +/* License: Ruby's */ static void invalid_parameter(const wchar_t *expr, const wchar_t *func, const wchar_t *file, unsigned int line, uintptr_t dummy) { @@ -616,7 +625,7 @@ int ruby_w32_rtc_error; -/* non GPL */ +/* License: Ruby's */ static int __cdecl rtc_error_handler(int e, const char *src, int line, const char *exe, const char *fmt, ...) { @@ -639,7 +648,7 @@ static st_table *socklist = NULL; static char *envarea; -/* non GPL */ +/* License: Ruby's */ static void exit_handler(void) { @@ -656,7 +665,7 @@ DeleteCriticalSection(&select_mutex); } -/* GPL */ +/* License: Artistic or GPL */ static void StartSockets(void) { @@ -681,7 +690,7 @@ // // Initialization stuff // -/* non GPL */ +/* License: Ruby's */ void rb_w32_sysinit(int *argc, char ***argv) { @@ -729,19 +738,19 @@ #define MAXCHILDNUM 256 /* max num of child processes */ -/* non GPL */ +/* License: Ruby's */ static struct ChildRecord { HANDLE hProcess; /* process handle */ rb_pid_t pid; /* process id */ } ChildRecord[MAXCHILDNUM]; -/* non GPL */ +/* License: Ruby's */ #define FOREACH_CHILD(v) do { \ struct ChildRecord* v; \ for (v = ChildRecord; v < ChildRecord + sizeof(ChildRecord) / sizeof(ChildRecord[0]); ++v) #define END_FOREACH_CHILD } while (0) -/* non GPL */ +/* License: Ruby's */ static struct ChildRecord * FindChildSlot(rb_pid_t pid) { @@ -754,7 +763,7 @@ return NULL; } -/* non GPL */ +/* License: Ruby's */ static struct ChildRecord * FindChildSlotByHandle(HANDLE h) { @@ -767,7 +776,7 @@ return NULL; } -/* non GPL */ +/* License: Ruby's */ static void CloseChildHandle(struct ChildRecord *child) { @@ -777,7 +786,7 @@ CloseHandle(h); } -/* non GPL */ +/* License: Ruby's */ static struct ChildRecord * FindFreeChildSlot(void) { @@ -850,14 +859,14 @@ "\3" "vol" + 1, }; -/* non GPL */ +/* License: Ruby's */ static int internal_match(const void *key, const void *elem) { return strcmp(key, *(const char *const *)elem); } -/* non GPL */ +/* License: Ruby's */ static int is_command_com(const char *interp) { @@ -872,7 +881,7 @@ static int internal_cmd_match(const char *cmdname, int nt); -/* non GPL */ +/* License: Ruby's */ static int is_internal_cmd(const char *cmd, int nt) { @@ -901,7 +910,7 @@ return internal_cmd_match(cmdname, nt); } -/* non GPL */ +/* License: Ruby's */ static int internal_cmd_match(const char *cmdname, int nt) { @@ -916,14 +925,14 @@ return 1; } -/* non GPL */ +/* License: Ruby's */ SOCKET rb_w32_get_osfhandle(int fh) { return _get_osfhandle(fh); } -/* non GPL */ +/* License: Ruby's */ static int join_argv(char *cmd, char *const *argv, BOOL escape) { @@ -998,11 +1007,11 @@ # define MAXPATHLEN 512 #endif -/* non GPL */ +/* License: Ruby's */ #define STRNDUPV(ptr, v, src, len) \ (((char *)memcpy(((ptr) = ALLOCV((v), (len) + 1)), (src), (len)))[len] = 0) -/* non GPL */ +/* License: Ruby's */ static int check_spawn_mode(int mode) { @@ -1016,7 +1025,7 @@ } } -/* non GPL */ +/* License: Ruby's */ static rb_pid_t child_result(struct ChildRecord *child, int mode) { @@ -1039,7 +1048,7 @@ } } -/* non GPL */ +/* License: Ruby's */ static struct ChildRecord * CreateChild(const WCHAR *cmd, const WCHAR *prog, SECURITY_ATTRIBUTES *psa, HANDLE hInput, HANDLE hOutput, HANDLE hError) @@ -1125,7 +1134,7 @@ return child; } -/* non GPL */ +/* License: Ruby's */ static int is_batch(const char *cmd) { @@ -1148,7 +1157,7 @@ #define utf8_to_wstr(str, plen) mbstr_to_wstr(CP_UTF8, str, -1, plen) #define wstr_to_utf8(str, plen) wstr_to_mbstr(CP_UTF8, str, -1, plen) -/* GPL */ +/* License: Artistic or GPL */ rb_pid_t rb_w32_spawn(int mode, const char *cmd, const char *prog) { @@ -1251,7 +1260,7 @@ return ret; } -/* GPL */ +/* License: Artistic or GPL */ rb_pid_t rb_w32_aspawn(int mode, const char *prog, char *const *argv) { @@ -1318,7 +1327,7 @@ return ret; } -/* GPL */ +/* License: Artistic or GPL */ typedef struct _NtCmdLineElement { struct _NtCmdLineElement *next; char *str; @@ -1334,7 +1343,7 @@ #define NTMALLOC 0x2 // string in element was malloc'ed #define NTSTRING 0x4 // element contains a quoted string -/* non GPL */ +/* License: Ruby's */ static int insert(const char *path, VALUE vinfo, void *enc) { @@ -1354,7 +1363,7 @@ return 0; } -/* GPL */ +/* License: Artistic or GPL */ static NtCmdLineElement ** cmdglob(NtCmdLineElement *patt, NtCmdLineElement **tail) { @@ -1387,7 +1396,7 @@ // characters that require it to be executed by a command interpreter // -/* GPL */ +/* License: Artistic or GPL */ static int has_redirection(const char *cmd) { @@ -1435,7 +1444,7 @@ return FALSE; } -/* non GPL */ +/* License: Ruby's */ static inline char * skipspace(char *ptr) { @@ -1444,7 +1453,7 @@ return ptr; } -/* GPL */ +/* License: Artistic or GPL */ int rb_w32_cmdvector(const char *cmd, char ***vec) { @@ -1691,7 +1700,7 @@ // return the pointer to the current file name. // -/* non GPL */ +/* License: Ruby's */ #define GetBit(bits, i) ((bits)[(i) / CHAR_BIT] & (1 << (i) % CHAR_BIT)) #define SetBit(bits, i) ((bits)[(i) / CHAR_BIT] |= (1 << (i) % CHAR_BIT)) @@ -1699,7 +1708,7 @@ #define BitOfIsRep(n) ((n) * 2 + 1) #define DIRENT_PER_CHAR (CHAR_BIT / 2) -/* GPL */ +/* License: Artistic or GPL */ static HANDLE open_dir_handle(const WCHAR *filename, WIN32_FIND_DATAW *fd) { @@ -1733,7 +1742,7 @@ return fh; } -/* GPL */ +/* License: Artistic or GPL */ static DIR * opendir_internal(WCHAR *wpath, const char *filename) { @@ -1818,7 +1827,7 @@ return p; } -/* non GPL */ +/* License: Ruby's */ static inline UINT filecp(void) { @@ -1826,7 +1835,7 @@ return cp; } -/* non GPL */ +/* License: Ruby's */ static char * wstr_to_mbstr(UINT cp, const WCHAR *wstr, int clen, long *plen) { @@ -1838,7 +1847,7 @@ return ptr; } -/* non GPL */ +/* License: Ruby's */ static WCHAR * mbstr_to_wstr(UINT cp, const char *str, int clen, long *plen) { @@ -1850,7 +1859,7 @@ return ptr; } -/* non GPL */ +/* License: Ruby's */ DIR * rb_w32_opendir(const char *filename) { @@ -1863,7 +1872,7 @@ return ret; } -/* non GPL */ +/* License: Ruby's */ DIR * rb_w32_uopendir(const char *filename) { @@ -1880,7 +1889,7 @@ // Move to next entry // -/* GPL */ +/* License: Artistic or GPL */ static void move_to_next_entry(DIR *dirp) { @@ -1897,7 +1906,7 @@ // Readdir just returns the current string pointer and bumps the // string pointer to the next entry. // -/* non GPL */ +/* License: Ruby's */ static BOOL win32_direct_conv(const WCHAR *file, struct direct *entry, rb_encoding *dummy) { @@ -1906,7 +1915,7 @@ return TRUE; } -/* non GPL */ +/* License: Ruby's */ VALUE rb_w32_conv_from_wchar(const WCHAR *wstr, rb_encoding *enc) { @@ -1926,7 +1935,7 @@ return rb_str_encode(src, rb_enc_from_encoding(enc), ECONV_UNDEF_REPLACE, Qnil); } -/* non GPL */ +/* License: Ruby's */ char * rb_w32_conv_from_wstr(const WCHAR *wstr, long *lenp, rb_encoding *enc) { @@ -1941,7 +1950,7 @@ return ptr; } -/* non GPL */ +/* License: Ruby's */ static BOOL ruby_direct_conv(const WCHAR *file, struct direct *entry, rb_encoding *enc) { @@ -1950,7 +1959,7 @@ return TRUE; } -/* GPL */ +/* License: Artistic or GPL */ static struct direct * readdir_internal(DIR *dirp, BOOL (*conv)(const WCHAR *, struct direct *, rb_encoding *), rb_encoding *enc) { @@ -1989,14 +1998,14 @@ return NULL; } -/* non GPL */ +/* License: Ruby's */ struct direct * rb_w32_readdir(DIR *dirp) { return readdir_internal(dirp, win32_direct_conv, NULL); } -/* non GPL */ +/* License: Ruby's */ struct direct * rb_w32_readdir_with_enc(DIR *dirp, rb_encoding *enc) { @@ -2010,7 +2019,7 @@ // Telldir returns the current string pointer position // -/* GPL */ +/* License: Artistic or GPL */ long rb_w32_telldir(DIR *dirp) { @@ -2021,7 +2030,7 @@ // Seekdir moves the string pointer to a previously saved position // (Saved by telldir). -/* non GPL */ +/* License: Ruby's */ void rb_w32_seekdir(DIR *dirp, long loc) { @@ -2036,7 +2045,7 @@ // Rewinddir resets the string pointer to the start // -/* GPL */ +/* License: Artistic or GPL */ void rb_w32_rewinddir(DIR *dirp) { @@ -2048,7 +2057,7 @@ // This just free's the memory allocated by opendir // -/* GPL */ +/* License: Artistic or GPL */ void rb_w32_closedir(DIR *dirp) { @@ -2077,7 +2086,7 @@ # define STHREAD_ONLY(x) x #endif -/* non GPL */ +/* License: Ruby's */ typedef struct { intptr_t osfhnd; /* underlying OS file HANDLE */ char osfile; /* attributes of file (e.g., open in text mode?) */ @@ -2110,7 +2119,7 @@ #if RT_VER >= 80 static size_t pioinfo_extra = 0; /* workaround for VC++8 SP1 */ -/* non GPL */ +/* License: Ruby's */ static void set_pioinfo_extra(void) { @@ -2147,14 +2156,14 @@ static int is_socket(SOCKET); static int is_console(SOCKET); -/* non GPL */ +/* License: Ruby's */ int rb_w32_io_cancelable_p(int fd) { return cancel_io != NULL && (is_socket(TO_SOCKET(fd)) || !is_console(TO_SOCKET(fd))); } -/* non GPL */ +/* License: Ruby's */ static int rb_w32_open_osfhandle(intptr_t osfhandle, int flags) { @@ -2196,7 +2205,7 @@ return fh; /* return handle */ } -/* non GPL */ +/* License: Ruby's */ static void init_stdhandle(void) { @@ -2234,14 +2243,14 @@ #define _set_osfhnd(fh, osfh) (void)((fh), (osfh)) #define _set_osflags(fh, flags) (void)((fh), (flags)) -/* non GPL */ +/* License: Ruby's */ static void init_stdhandle(void) { } #endif -/* non GPL */ +/* License: Ruby's */ #ifdef __BORLANDC__ static int rb_w32_open_osfhandle(intptr_t osfhandle, int flags) @@ -2257,7 +2266,7 @@ #undef getsockopt -/* non GPL */ +/* License: Ruby's */ static int is_socket(SOCKET sock) { @@ -2267,7 +2276,7 @@ return FALSE; } -/* non GPL */ +/* License: Ruby's */ int rb_w32_is_socket(int fd) { @@ -2282,7 +2291,7 @@ #undef strerror -/* GPL */ +/* License: Artistic or GPL */ char * rb_w32_strerror(int e) { @@ -2350,42 +2359,42 @@ #define ROOT_UID 0 #define ROOT_GID 0 -/* GPL */ +/* License: Artistic or GPL */ rb_uid_t getuid(void) { return ROOT_UID; } -/* GPL */ +/* License: Artistic or GPL */ rb_uid_t geteuid(void) { return ROOT_UID; } -/* GPL */ +/* License: Artistic or GPL */ rb_gid_t getgid(void) { return ROOT_GID; } -/* GPL */ +/* License: Artistic or GPL */ rb_gid_t getegid(void) { return ROOT_GID; } -/* GPL */ +/* License: Artistic or GPL */ int setuid(rb_uid_t uid) { return (uid == ROOT_UID ? 0 : -1); } -/* GPL */ +/* License: Artistic or GPL */ int setgid(rb_gid_t gid) { @@ -2396,7 +2405,7 @@ // File system stuff // -/* GPL */ +/* License: Artistic or GPL */ int ioctl(int i, int u, ...) { @@ -2427,7 +2436,7 @@ #undef FD_CLR -/* non GPL */ +/* License: Ruby's */ void rb_w32_fdclr(int fd, fd_set *set) { @@ -2445,7 +2454,7 @@ #undef FD_ISSET -/* non GPL */ +/* License: Ruby's */ int rb_w32_fdisset(int fd, fd_set *set) { @@ -2457,7 +2466,7 @@ return ret; } -/* non GPL */ +/* License: Ruby's */ void rb_w32_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src) { @@ -2478,7 +2487,7 @@ #undef select -/* non GPL */ +/* License: Ruby's */ static int extract_fd(rb_fdset_t *dst, fd_set *src, int (*func)(SOCKET)) { @@ -2520,7 +2529,7 @@ return dst ? dst->fdset->fd_count : m; } -/* non GPL */ +/* License: Ruby's */ static int copy_fd(fd_set *dst, fd_set *src) { @@ -2542,14 +2551,14 @@ return dst->fd_count; } -/* non GPL */ +/* License: Ruby's */ static int is_not_socket(SOCKET sock) { return !is_socket(sock); } -/* non GPL */ +/* License: Ruby's */ static int is_pipe(SOCKET sock) /* DONT call this for SOCKET! it clains it is PIPE. */ { @@ -2562,7 +2571,7 @@ return ret; } -/* non GPL */ +/* License: Ruby's */ static int is_readable_pipe(SOCKET sock) /* call this for pipe only */ { @@ -2581,7 +2590,7 @@ return ret; } -/* non GPL */ +/* License: Ruby's */ static int is_console(SOCKET sock) /* DONT call this for SOCKET! */ { @@ -2596,7 +2605,7 @@ return ret; } -/* non GPL */ +/* License: Ruby's */ static int is_readable_console(SOCKET sock) /* call this for console only */ { @@ -2619,14 +2628,14 @@ return ret; } -/* non GPL */ +/* License: Ruby's */ static int is_invalid_handle(SOCKET sock) { return (HANDLE)sock == INVALID_HANDLE_VALUE; } -/* GPL */ +/* License: Artistic or GPL */ static int do_select(int nfds, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *timeout) @@ -2658,7 +2667,7 @@ * rest -= wait * return 0 if rest is smaller than wait. */ -/* non GPL */ +/* License: Ruby's */ int rb_w32_time_subtract(struct timeval *rest, const struct timeval *wait) { @@ -2677,7 +2686,7 @@ return rest->tv_sec != 0 || rest->tv_usec != 0; } -/* non GPL */ +/* License: Ruby's */ static inline int compare(const struct timeval *t1, const struct timeval *t2) { @@ -2697,7 +2706,7 @@ int rb_w32_check_interrupt(void *); /* @internal */ /* @internal */ -/* non GPL */ +/* License: Ruby's */ int rb_w32_select_with_thread(int nfds, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *timeout, void *th) @@ -2835,7 +2844,7 @@ return r; } -/* non GPL */ +/* License: Ruby's */ int WSAAPI rb_w32_select(int nfds, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *timeout) @@ -2843,7 +2852,7 @@ return rb_w32_select_with_thread(nfds, rd, wr, ex, timeout, 0); } -/* non GPL */ +/* License: Ruby's */ static FARPROC get_wsa_extension_function(SOCKET s, GUID *guid) { @@ -2859,7 +2868,7 @@ #undef accept -/* GPL */ +/* License: Artistic or GPL */ int WSAAPI rb_w32_accept(int s, struct sockaddr *addr, int *addrlen) { @@ -2895,7 +2904,7 @@ #undef bind -/* GPL */ +/* License: Artistic or GPL */ int WSAAPI rb_w32_bind(int s, const struct sockaddr *addr, int addrlen) { @@ -2914,7 +2923,7 @@ #undef connect -/* GPL */ +/* License: Artistic or GPL */ int WSAAPI rb_w32_connect(int s, const struct sockaddr *addr, int addrlen) { @@ -2938,7 +2947,7 @@ #undef getpeername -/* GPL */ +/* License: Artistic or GPL */ int WSAAPI rb_w32_getpeername(int s, struct sockaddr *addr, int *addrlen) { @@ -2956,7 +2965,7 @@ #undef getsockname -/* GPL */ +/* License: Artistic or GPL */ int WSAAPI rb_w32_getsockname(int s, struct sockaddr *addr, int *addrlen) { @@ -2972,7 +2981,7 @@ return r; } -/* GPL */ +/* License: Artistic or GPL */ int WSAAPI rb_w32_getsockopt(int s, int level, int optname, char *optval, int *optlen) { @@ -2990,7 +2999,7 @@ #undef ioctlsocket -/* GPL */ +/* License: Artistic or GPL */ int WSAAPI rb_w32_ioctlsocket(int s, long cmd, u_long *argp) { @@ -3008,7 +3017,7 @@ #undef listen -/* GPL */ +/* License: Artistic or GPL */ int WSAAPI rb_w32_listen(int s, int backlog) { @@ -3029,7 +3038,7 @@ #undef send #undef sendto -/* non GPL */ +/* License: Ruby's */ static int finish_overlapped_socket(SOCKET s, WSAOVERLAPPED *wol, int result, DWORD *len, DWORD size) { @@ -3068,7 +3077,7 @@ return result; } -/* GPL */ +/* License: Artistic or GPL */ static int overlapped_socket_io(BOOL input, int fd, char *buf, int len, int flags, struct sockaddr *addr, int *addrlen) @@ -3138,14 +3147,14 @@ return r; } -/* non GPL */ +/* License: Ruby's */ int WSAAPI rb_w32_recv(int fd, char *buf, int len, int flags) { return overlapped_socket_io(TRUE, fd, buf, len, flags, NULL, NULL); } -/* non GPL */ +/* License: Ruby's */ int WSAAPI rb_w32_recvfrom(int fd, char *buf, int len, int flags, struct sockaddr *from, int *fromlen) @@ -3153,14 +3162,14 @@ return overlapped_socket_io(TRUE, fd, buf, len, flags, from, fromlen); } -/* non GPL */ +/* License: Ruby's */ int WSAAPI rb_w32_send(int fd, const char *buf, int len, int flags) { return overlapped_socket_io(FALSE, fd, (char *)buf, len, flags, NULL, NULL); } -/* non GPL */ +/* License: Ruby's */ int WSAAPI rb_w32_sendto(int fd, const char *buf, int len, int flags, const struct sockaddr *to, int tolen) @@ -3170,7 +3179,7 @@ } #if (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/