From 977267c2e0218d6b182807ddf9b7c1d929c40bed Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 22 Apr 2010 08:04:13 +0000 Subject: * ext/**/*.[ch]: removed trailing spaces. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/bigdecimal/bigdecimal.h | 18 +- ext/dbm/dbm.c | 2 +- ext/digest/bubblebabble/bubblebabble.c | 2 +- ext/digest/rmd160/rmd160.h | 2 +- ext/digest/sha1/sha1.h | 4 +- ext/digest/sha1/sha1init.c | 4 +- ext/digest/sha2/sha2.c | 8 +- ext/digest/sha2/sha2.h | 10 +- ext/dl/cfunc.c | 16 +- ext/dl/cptr.c | 2 +- ext/etc/etc.c | 36 +- ext/fcntl/fcntl.c | 6 +- ext/gdbm/gdbm.c | 16 +- ext/iconv/iconv.c | 22 +- ext/json/ext/generator/generator.c | 10 +- ext/json/ext/generator/unicode.c | 10 +- ext/json/ext/parser/parser.c | 14 +- ext/json/ext/parser/parser.rl | 14 +- ext/json/ext/parser/unicode.c | 12 +- ext/nkf/nkf-utf8/config.h | 2 +- ext/nkf/nkf-utf8/nkf.c | 4 +- ext/nkf/nkf-utf8/nkf.h | 4 +- ext/nkf/nkf.c | 4 +- ext/objspace/objspace.c | 6 +- ext/openssl/openssl_missing.c | 10 +- ext/openssl/ossl.c | 14 +- ext/openssl/ossl_asn1.c | 20 +- ext/openssl/ossl_asn1.h | 4 +- ext/openssl/ossl_bio.c | 2 +- ext/openssl/ossl_bn.c | 14 +- ext/openssl/ossl_cipher.c | 10 +- ext/openssl/ossl_config.c | 10 +- ext/openssl/ossl_digest.c | 8 +- ext/openssl/ossl_engine.c | 4 +- ext/openssl/ossl_hmac.c | 6 +- ext/openssl/ossl_ns_spki.c | 4 +- ext/openssl/ossl_ocsp.c | 2 +- ext/openssl/ossl_pkcs12.c | 2 +- ext/openssl/ossl_pkcs7.c | 14 +- ext/openssl/ossl_pkey.c | 2 +- ext/openssl/ossl_pkey_dh.c | 14 +- ext/openssl/ossl_pkey_dsa.c | 2 +- ext/openssl/ossl_pkey_ec.c | 8 +- ext/openssl/ossl_pkey_rsa.c | 18 +- ext/openssl/ossl_ssl.c | 10 +- ext/openssl/ossl_ssl.h | 2 +- ext/openssl/ossl_ssl_session.c | 8 +- ext/openssl/ossl_x509attr.c | 12 +- ext/openssl/ossl_x509cert.c | 66 +-- ext/openssl/ossl_x509crl.c | 48 +-- ext/openssl/ossl_x509ext.c | 20 +- ext/openssl/ossl_x509name.c | 8 +- ext/openssl/ossl_x509req.c | 36 +- ext/openssl/ossl_x509revoked.c | 20 +- ext/openssl/ossl_x509store.c | 30 +- ext/racc/cparse/cparse.c | 12 +- ext/readline/readline.c | 52 +-- ext/sdbm/_sdbm.c | 18 +- ext/sdbm/init.c | 2 +- ext/sdbm/sdbm.h | 2 +- ext/socket/addrinfo.h | 4 +- ext/socket/ancdata.c | 24 +- ext/socket/basicsocket.c | 22 +- ext/socket/getaddrinfo.c | 10 +- ext/socket/getnameinfo.c | 4 +- ext/socket/ipsocket.c | 10 +- ext/socket/option.c | 6 +- ext/socket/raddrinfo.c | 14 +- ext/socket/socket.c | 226 +++++----- ext/socket/tcpserver.c | 16 +- ext/socket/udpsocket.c | 12 +- ext/socket/unixserver.c | 12 +- ext/socket/unixsocket.c | 8 +- ext/stringio/stringio.c | 8 +- ext/strscan/strscan.c | 24 +- ext/syck/bytecode.c | 22 +- ext/syck/emitter.c | 34 +- ext/syck/gram.c | 76 ++-- ext/syck/handler.c | 10 +- ext/syck/node.c | 18 +- ext/syck/rubyext.c | 70 +-- ext/syck/syck.c | 12 +- ext/syck/syck.h | 8 +- ext/syck/token.c | 94 ++-- ext/syck/yaml2byte.c | 16 +- ext/syck/yamlbyte.h | 20 +- ext/syslog/syslog.c | 6 +- ext/tk/stubs.c | 24 +- ext/tk/tcltklib.c | 762 ++++++++++++++++---------------- ext/tk/tkutil/tkutil.c | 84 ++-- ext/win32ole/win32ole.c | 764 ++++++++++++++++----------------- ext/zlib/zlib.c | 14 +- 92 files changed, 1588 insertions(+), 1588 deletions(-) diff --git a/ext/bigdecimal/bigdecimal.h b/ext/bigdecimal/bigdecimal.h index dbef10dd4e..247d26a6ca 100644 --- a/ext/bigdecimal/bigdecimal.h +++ b/ext/bigdecimal/bigdecimal.h @@ -1,12 +1,12 @@ /* * - * Ruby BigDecimal(Variable decimal precision) extension library. + * Ruby BigDecimal(Variable decimal precision) extension library. * - * Copyright(C) 2002 by Shigeo Kobayashi(shigeo@tinyforest.gr.jp) + * Copyright(C) 2002 by Shigeo Kobayashi(shigeo@tinyforest.gr.jp) * - * You may distribute under the terms of either the GNU General Public - * License or the Artistic License, as specified in the README file - * of this BigDecimal distribution. + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file + * of this BigDecimal distribution. * * NOTES: * 2003-03-28 V1.0 checked in. @@ -29,10 +29,10 @@ extern "C" { #define SZ_NINF "-Infinity" /* - * #define VP_EXPORT other than static to let VP_ routines + * #define VP_EXPORT other than static to let VP_ routines * be called from outside of this module. */ -#define VP_EXPORT static +#define VP_EXPORT static #define U_LONG unsigned long #define S_LONG long @@ -96,7 +96,7 @@ typedef struct { U_LONG frac[1]; /* Pointer to array of fraction part. */ } Real; -/* +/* * ------------------ * EXPORTables. * ------------------ @@ -161,7 +161,7 @@ VP_EXPORT int VpPower(Real *y,Real *x,S_INT n); /* VP constants */ VP_EXPORT Real *VpOne(void); -/* +/* * ------------------ * MACRO definitions. * ------------------ diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c index 84d331ae53..893146d582 100644 --- a/ext/dbm/dbm.c +++ b/ext/dbm/dbm.c @@ -317,7 +317,7 @@ fdbm_shift(VALUE obj) GetDBM2(obj, dbmp, dbm); dbmp->di_size = -1; - key = dbm_firstkey(dbm); + key = dbm_firstkey(dbm); if (!key.dptr) return Qnil; val = dbm_fetch(dbm, key); keystr = rb_tainted_str_new(key.dptr, key.dsize); diff --git a/ext/digest/bubblebabble/bubblebabble.c b/ext/digest/bubblebabble/bubblebabble.c index 10bde6ff71..c92ae52cd9 100644 --- a/ext/digest/bubblebabble/bubblebabble.c +++ b/ext/digest/bubblebabble/bubblebabble.c @@ -54,7 +54,7 @@ bubblebabble_str_new(VALUE str_digest) p[j++] = consonants[16]; p[j++] = vowels[seed / 6]; break; - } + } byte1 = digest[i++]; p[j++] = vowels[(((byte1 >> 6) & 3) + seed) % 6]; diff --git a/ext/digest/rmd160/rmd160.h b/ext/digest/rmd160/rmd160.h index 54d1ca9140..2c98f11cd0 100644 --- a/ext/digest/rmd160/rmd160.h +++ b/ext/digest/rmd160/rmd160.h @@ -7,7 +7,7 @@ * FILE: rmd160.h * * CONTENTS: Header file for a sample C-implementation of the - * RIPEMD-160 hash-function. + * RIPEMD-160 hash-function. * TARGET: any computer with an ANSI C compiler * * AUTHOR: Antoon Bosselaers, ESAT-COSIC diff --git a/ext/digest/sha1/sha1.h b/ext/digest/sha1/sha1.h index 60e3b01fe2..55997e73dd 100644 --- a/ext/digest/sha1/sha1.h +++ b/ext/digest/sha1/sha1.h @@ -15,7 +15,7 @@ typedef struct { uint32_t state[5]; - uint32_t count[2]; + uint32_t count[2]; uint8_t buffer[64]; } SHA1_CTX; @@ -35,5 +35,5 @@ void SHA1_Finish _((SHA1_CTX *context, uint8_t digest[20])); #define SHA1_BLOCK_LENGTH 64 #define SHA1_DIGEST_LENGTH 20 #define SHA1_DIGEST_STRING_LENGTH (SHA1_DIGEST_LENGTH * 2 + 1) - + #endif /* _SYS_SHA1_H_ */ diff --git a/ext/digest/sha1/sha1init.c b/ext/digest/sha1/sha1init.c index d46a1cd67d..06e7378950 100644 --- a/ext/digest/sha1/sha1init.c +++ b/ext/digest/sha1/sha1init.c @@ -27,9 +27,9 @@ void Init_sha1() { VALUE mDigest, cDigest_Base, cDigest_SHA1; - + rb_require("digest"); - + mDigest = rb_path2class("Digest"); cDigest_Base = rb_path2class("Digest::Base"); diff --git a/ext/digest/sha2/sha2.c b/ext/digest/sha2/sha2.c index 6e4a99c1e3..60e47c242a 100644 --- a/ext/digest/sha2/sha2.c +++ b/ext/digest/sha2/sha2.c @@ -1,7 +1,7 @@ /* * FILE: sha2.c * AUTHOR: Aaron D. Gifford - http://www.aarongifford.com/ - * + * * Copyright (c) 2000-2001, Aaron D. Gifford * All rights reserved. * @@ -16,7 +16,7 @@ * 3. Neither the name of the copyright holder nor the names of contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -77,7 +77,7 @@ * * And for little-endian machines, add: * - * #define BYTE_ORDER LITTLE_ENDIAN + * #define BYTE_ORDER LITTLE_ENDIAN * * Or for big-endian machines: * @@ -494,7 +494,7 @@ void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) { s1 = sigma1_256(s1); /* Apply the SHA-256 compression function to update a..h */ - T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + + T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); T2 = Sigma0_256(a) + Maj(a, b, c); h = g; diff --git a/ext/digest/sha2/sha2.h b/ext/digest/sha2/sha2.h index 1231de5ca2..465398ee19 100644 --- a/ext/digest/sha2/sha2.h +++ b/ext/digest/sha2/sha2.h @@ -1,7 +1,7 @@ /* * FILE: sha2.h * AUTHOR: Aaron D. Gifford - http://www.aarongifford.com/ - * + * * Copyright (c) 2000-2001, Aaron D. Gifford * All rights reserved. * @@ -16,7 +16,7 @@ * 3. Neither the name of the copyright holder nor the names of contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -51,7 +51,7 @@ extern "C" { #ifdef RUBY # ifdef HAVE_PROTOTYPES -# undef NOPROTO +# undef NOPROTO # else # define NOPROTO # endif /* HAVE_PROTOTYPES */ @@ -61,7 +61,7 @@ extern "C" { # ifdef WORDS_BIGENDIAN # define BYTE_ORDER BIG_ENDIAN # else -# define BYTE_ORDER LITTLE_ENDIAN +# define BYTE_ORDER LITTLE_ENDIAN # endif # endif /* BYTE_ORDER */ # define SHA2_USE_INTTYPES_H @@ -111,7 +111,7 @@ typedef unsigned long long uint64_t; /* 8-bytes (64-bits) */ * * #include * - * If you choose to use then please define: + * If you choose to use then please define: * * #define SHA2_USE_INTTYPES_H * diff --git a/ext/dl/cfunc.c b/ext/dl/cfunc.c index 729dbe9ac6..e1cf9d1629 100644 --- a/ext/dl/cfunc.c +++ b/ext/dl/cfunc.c @@ -147,12 +147,12 @@ rb_dlcfunc_initialize(int argc, VALUE argv[], VALUE self) struct cfunc_data *data; void *saddr; const char *sname; - + rb_scan_args(argc, argv, "13", &addr, &type, &name, &calltype); - + saddr = (void*)(NUM2PTR(rb_Integer(addr))); sname = NIL_P(name) ? NULL : StringValuePtr(name); - + TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, data); if( data->name ) xfree(data->name); data->ptr = saddr; @@ -286,9 +286,9 @@ rb_dlcfunc_inspect(VALUE self) char *str; int str_size; struct cfunc_data *cfunc; - + TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, cfunc); - + str_size = (cfunc->name ? strlen(cfunc->name) : 0) + 100; str = ruby_xmalloc(str_size); snprintf(str, str_size - 1, @@ -339,14 +339,14 @@ rb_dlcfunc_call(VALUE self, VALUE ary) memset(stack, 0, sizeof(DLSTACK_TYPE) * DLSTACK_SIZE); Check_Type(ary, T_ARRAY); - + TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, cfunc); if( cfunc->ptr == 0 ){ rb_raise(rb_eDLError, "can't call null-function"); return Qnil; } - + for( i = 0; i < RARRAY_LEN(ary); i++ ){ if( i >= DLSTACK_SIZE ){ rb_raise(rb_eDLError, "too many arguments (stack overflow)"); @@ -354,7 +354,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary) rb_check_safe_obj(RARRAY_PTR(ary)[i]); stack[i] = NUM2LONG(RARRAY_PTR(ary)[i]); } - + /* calltype == CFUNC_CDECL */ if( cfunc->calltype == CFUNC_CDECL #ifndef FUNC_STDCALL diff --git a/ext/dl/cptr.c b/ext/dl/cptr.c index 8ae1829efa..5edd13cc97 100644 --- a/ext/dl/cptr.c +++ b/ext/dl/cptr.c @@ -104,7 +104,7 @@ rb_dlptr2cptr(VALUE val) else{ rb_raise(rb_eTypeError, "DL::PtrData was expected"); } - + return ptr; } diff --git a/ext/etc/etc.c b/ext/etc/etc.c index fc96b5f548..a1f9669e98 100644 --- a/ext/etc/etc.c +++ b/ext/etc/etc.c @@ -133,7 +133,7 @@ etc_getpwuid(int argc, VALUE *argv, VALUE obj) pwd = getpwuid(uid); if (pwd == 0) rb_raise(rb_eArgError, "can't find user for %d", (int)uid); return setup_passwd(pwd); -#else +#else return Qnil; #endif } @@ -156,7 +156,7 @@ etc_getpwnam(VALUE obj, VALUE nam) pwd = getpwnam(RSTRING_PTR(nam)); if (pwd == 0) rb_raise(rb_eArgError, "can't find user for %s", RSTRING_PTR(nam)); return setup_passwd(pwd); -#else +#else return Qnil; #endif } @@ -194,10 +194,10 @@ each_passwd(void) } #endif -/* Provides a convenient Ruby iterator which executes a block for each entry +/* Provides a convenient Ruby iterator which executes a block for each entry * in the /etc/passwd file. * - * The code block is passed an Struct::Passwd struct; see getpwent above for + * The code block is passed an Struct::Passwd struct; see getpwent above for * details. * * Example: @@ -229,7 +229,7 @@ etc_passwd(VALUE obj) /* Iterates for each entry in the /etc/passwd file if a block is given. * If no block is given, returns the enumerator. * - * The code block is passed an Struct::Passwd struct; see getpwent above for + * The code block is passed an Struct::Passwd struct; see getpwent above for * details. * * Example: @@ -279,7 +279,7 @@ etc_endpwent(VALUE obj) } /* Returns an entry from the /etc/passwd file. The first time it is called it - * opens the file and returns the first entry; each successive call returns + * opens the file and returns the first entry; each successive call returns * the next entry, or nil if the end of the file has been reached. * * To close the file when processing is complete, call endpwent. @@ -296,8 +296,8 @@ etc_endpwent(VALUE obj) * * - Passwd#gid contains the integer group ID (gid) of the user's primary group. * - * - Passwd#gecos contains a longer String description of the user, such as - * a full name. Some Unix systems provide structured information in the + * - Passwd#gecos contains a longer String description of the user, such as + * a full name. Some Unix systems provide structured information in the * gecos field, but this is system-dependent. * * - Passwd#dir contains the path to the home directory of the user as a String. @@ -340,7 +340,7 @@ setup_group(struct group *grp) } #endif -/* Returns information about the group with specified integer group id (gid), +/* Returns information about the group with specified integer group id (gid), * as found in /etc/group. * * The information is returned as a Struct::Group; see getgrent above for @@ -373,7 +373,7 @@ etc_getgrgid(int argc, VALUE *argv, VALUE obj) #endif } -/* Returns information about the group with specified String name, as found +/* Returns information about the group with specified String name, as found * in /etc/group. * * The information is returned as a Struct::Group; see getgrent above for @@ -432,10 +432,10 @@ each_group(void) } #endif -/* Provides a convenient Ruby iterator which executes a block for each entry +/* Provides a convenient Ruby iterator which executes a block for each entry * in the /etc/group file. * - * The code block is passed an Struct::Group struct; see getgrent above for + * The code block is passed an Struct::Group struct; see getgrent above for * details. * * Example: @@ -468,7 +468,7 @@ etc_group(VALUE obj) /* Iterates for each entry in the /etc/group file if a block is given. * If no block is given, returns the enumerator. * - * The code block is passed an Struct::Group struct; see getpwent above for + * The code block is passed an Struct::Group struct; see getpwent above for * details. * * Example: @@ -504,7 +504,7 @@ etc_setgrent(VALUE obj) return Qnil; } -/* Ends the process of scanning through the /etc/group file begun by +/* Ends the process of scanning through the /etc/group file begun by * getgrent, and closes the file. */ static VALUE @@ -517,7 +517,7 @@ etc_endgrent(VALUE obj) } /* Returns an entry from the /etc/group file. The first time it is called it - * opens the file and returns the first entry; each successive call returns + * opens the file and returns the first entry; each successive call returns * the next entry, or nil if the end of the file has been reached. * * To close the file when processing is complete, call endgrent. @@ -527,13 +527,13 @@ etc_endgrent(VALUE obj) * - Group#name contains the name of the group as a String. * * - Group#passwd contains the encrypted password as a String. An 'x' is - * returned if password access to the group is not available; an empty - * string is returned if no password is needed to obtain membership of + * returned if password access to the group is not available; an empty + * string is returned if no password is needed to obtain membership of * the group. * * - Group#gid contains the group's numeric ID as an integer. * - * - Group#mem is an Array of Strings containing the short login names of the + * - Group#mem is an Array of Strings containing the short login names of the * members of the group. */ static VALUE diff --git a/ext/fcntl/fcntl.c b/ext/fcntl/fcntl.c index fdb9f82b1e..b0992f30d8 100644 --- a/ext/fcntl/fcntl.c +++ b/ext/fcntl/fcntl.c @@ -42,7 +42,7 @@ pack up your own arguments to pass as args for locking functions, etc. * Documented by mathew * * = Usage - * + * * To perform a fcntl(2) operation, use IO::fcntl in the core classes. * * To perform an open(2) operation, use IO::sysopen. @@ -99,10 +99,10 @@ pack up your own arguments to pass as args for locking functions, etc. * - O_ACCMODE - mask to extract read/write flags. * * Example: - * + * * require 'fcntl' * - * fd = IO::sysopen('/tmp/tempfile', + * fd = IO::sysopen('/tmp/tempfile', * Fcntl::O_WRONLY | Fcntl::O_EXCL | Fcntl::O_CREAT) * f = IO.open(fd) * f.syswrite("TEMP DATA") diff --git a/ext/gdbm/gdbm.c b/ext/gdbm/gdbm.c index 3c95cde2f7..d0616cc63a 100644 --- a/ext/gdbm/gdbm.c +++ b/ext/gdbm/gdbm.c @@ -44,7 +44,7 @@ * 1. Opening/creating a database, and filling it with some entries: * * require 'gdbm' - * + * * gdbm = GDBM.new("fruitstore.db") * gdbm["ananas"] = "3" * gdbm["banana"] = "8" @@ -54,7 +54,7 @@ * 2. Reading out a database: * * require 'gdbm' - * + * * gdbm = GDBM.new("fruitstore.db") * gdbm.each_pair do |key, value| * print "#{key}: #{value}\n" @@ -206,19 +206,19 @@ fgdbm_initialize(int argc, VALUE *argv, VALUE obj) if (flags & RUBY_GDBM_RW_BIT) { flags &= ~RUBY_GDBM_RW_BIT; - dbm = gdbm_open(RSTRING_PTR(file), MY_BLOCK_SIZE, + dbm = gdbm_open(RSTRING_PTR(file), MY_BLOCK_SIZE, flags, mode, MY_FATAL_FUNC); } else { dbm = 0; if (mode >= 0) - dbm = gdbm_open(RSTRING_PTR(file), MY_BLOCK_SIZE, + dbm = gdbm_open(RSTRING_PTR(file), MY_BLOCK_SIZE, GDBM_WRCREAT|flags, mode, MY_FATAL_FUNC); if (!dbm) - dbm = gdbm_open(RSTRING_PTR(file), MY_BLOCK_SIZE, + dbm = gdbm_open(RSTRING_PTR(file), MY_BLOCK_SIZE, GDBM_WRITER|flags, 0, MY_FATAL_FUNC); if (!dbm) - dbm = gdbm_open(RSTRING_PTR(file), MY_BLOCK_SIZE, + dbm = gdbm_open(RSTRING_PTR(file), MY_BLOCK_SIZE, GDBM_READER|flags, 0, MY_FATAL_FUNC); } @@ -537,7 +537,7 @@ fgdbm_delete(VALUE obj, VALUE keystr) * call-seq: * gdbm.shift -> (key, value) or nil * - * Removes a key-value-pair from this database and returns it as a + * Removes a key-value-pair from this database and returns it as a * two-item array [ _key_, _value_ ]. Returns nil if the database is empty. */ static VALUE @@ -619,7 +619,7 @@ fgdbm_clear(VALUE obj) free(key.dptr); rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno)); } - free(key.dptr); + free(key.dptr); } #else while (key = gdbm_firstkey(dbm), key.dptr) { diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index c1d59c5fc6..964cfff7a0 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -26,20 +26,20 @@ * == Summary * * Ruby extension for charset conversion. - * + * * == Abstract * * Iconv is a wrapper class for the UNIX 95 iconv() function family, * which translates string between various encoding systems. - * + * * See Open Group's on-line documents for more details. * * iconv.h: http://www.opengroup.org/onlinepubs/007908799/xsh/iconv.h.html * * iconv_open(): http://www.opengroup.org/onlinepubs/007908799/xsh/iconv_open.html * * iconv(): http://www.opengroup.org/onlinepubs/007908799/xsh/iconv.html * * iconv_close(): http://www.opengroup.org/onlinepubs/007908799/xsh/iconv_close.html - * + * * Which coding systems are available is platform-dependent. - * + * * == Examples * * 1. Simple conversion between two charsets. @@ -622,7 +622,7 @@ get_iconv_opt(struct rb_iconv_opt_t *opt, VALUE options) * * Creates new code converter from a coding-system designated with +from+ * to another one designated with +to+. - * + * * === Parameters * * +to+:: encoding name for destination @@ -1104,7 +1104,7 @@ iconv_failure_success(VALUE self) * call-seq: failed * * Returns substring of the original string passed to Iconv that starts at the - * character caused the exception. + * character caused the exception. */ static VALUE iconv_failure_failed(VALUE self) @@ -1134,13 +1134,13 @@ iconv_failure_inspect(VALUE self) /* * Document-class: Iconv::InvalidEncoding - * + * * Requested coding-system is not available on this system. */ /* * Document-class: Iconv::IllegalSequence - * + * * Input conversion stopped due to an input byte that does not belong to * the input codeset, or the output codeset does not contain the * character. @@ -1148,20 +1148,20 @@ iconv_failure_inspect(VALUE self) /* * Document-class: Iconv::InvalidCharacter - * + * * Input conversion stopped due to an incomplete character or shift * sequence at the end of the input buffer. */ /* * Document-class: Iconv::OutOfRange - * + * * Iconv library internal error. Must not occur. */ /* * Document-class: Iconv::BrokenLibrary - * + * * Detected a bug of underlying iconv(3) libray. * * returns an error without setting errno properly */ diff --git a/ext/json/ext/generator/generator.c b/ext/json/ext/generator/generator.c index c6c63c1a5e..482938ac47 100644 --- a/ext/json/ext/generator/generator.c +++ b/ext/json/ext/generator/generator.c @@ -62,7 +62,7 @@ typedef struct JSON_Generator_StateStruct { JSON_Generator_State *state; \ Data_Get_Struct(self, JSON_Generator_State, state); -/* +/* * Document-module: JSON::Ext::Generator * * This is the JSON generator implemented as a C extension. It can be @@ -459,7 +459,7 @@ static VALUE mObject_to_json(int argc, VALUE *argv, VALUE self) return result; } -/* +/* * Document-class: JSON::Ext::Generator::State * * This class is used to create State instances, that are use to hold data @@ -586,7 +586,7 @@ static VALUE cState_to_h(VALUE self) * * *indent*: a string used to indent levels (default: ''), * * *space*: a string that is put after, a : or , delimiter (default: ''), * * *space_before*: a string that is put before a : pair delimiter (default: ''), - * * *object_nl*: a string that is put at the end of a JSON object (default: ''), + * * *object_nl*: a string that is put at the end of a JSON object (default: ''), * * *array_nl*: a string that is put at the end of a JSON array (default: ''), * * *check_circular*: true if checking for circular data structures * should be done, false (the default) otherwise. @@ -808,7 +808,7 @@ static VALUE cState_allow_nan_p(VALUE self) /* * call-seq: seen?(object) * - * Returns _true_, if _object_ was already seen during this generating run. + * Returns _true_, if _object_ was already seen during this generating run. */ static VALUE cState_seen_p(VALUE self, VALUE object) { @@ -820,7 +820,7 @@ static VALUE cState_seen_p(VALUE self, VALUE object) * call-seq: remember(object) * * Remember _object_, to find out if it was already encountered (if a cyclic - * data structure is rendered). + * data structure is rendered). */ static VALUE cState_remember(VALUE self, VALUE object) { diff --git a/ext/json/ext/generator/unicode.c b/ext/json/ext/generator/unicode.c index 93e8502b08..947e2d6bda 100644 --- a/ext/json/ext/generator/unicode.c +++ b/ext/json/ext/generator/unicode.c @@ -6,9 +6,9 @@ /* * Copyright 2001-2004 Unicode, Inc. - * + * * Disclaimer - * + * * This source code is provided as is by Unicode, Inc. No claims are * made as to fitness for any particular purpose. No warranties of any * kind are expressed or implied. The recipient agrees to determine @@ -16,9 +16,9 @@ * purchased on magnetic or optical media from Unicode, Inc., the * sole remedy for any claim will be exchange of defective media * within 90 days of receipt. - * + * * Limitations on Rights to Redistribute This Code - * + * * Unicode, Inc. hereby grants the right to freely use the information * supplied in this file in the creation of products supporting the * Unicode Standard, and to make copies of this file in any form @@ -49,7 +49,7 @@ static const char trailingBytesForUTF8[256] = { * This table contains as many values as there might be trailing bytes * in a UTF-8 sequence. */ -static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL, +static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL, 0x03C82080UL, 0xFA082080UL, 0x82082080UL }; /* diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c index 6851e06235..a71c3b8e98 100644 --- a/ext/json/ext/parser/parser.c +++ b/ext/json/ext/parser/parser.c @@ -29,7 +29,7 @@ static VALUE mJSON, mExt, cParser, eParserError, eNestingError; static VALUE CNaN, CInfinity, CMinusInfinity; static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions, - i_chr, i_max_nesting, i_allow_nan, i_object_class, i_array_class; + i_chr, i_max_nesting, i_allow_nan, i_object_class, i_array_class; #define MinusInfinity "-Infinity" @@ -201,7 +201,7 @@ tr11: #line 92 "parser.rl" { VALUE v = Qnil; - char *np = JSON_parse_value(json, p, pe, &v); + char *np = JSON_parse_value(json, p, pe, &v); if (np == NULL) { p--; {p++; cs = 9; goto _out;} } else { @@ -503,7 +503,7 @@ tr2: goto st21; tr5: #line 202 "parser.rl" - { + { char *np; json->current_nesting++; np = JSON_parse_array(json, p, pe, result); @@ -513,7 +513,7 @@ tr5: goto st21; tr9: #line 210 "parser.rl" - { + { char *np; json->current_nesting++; np = JSON_parse_object(json, p, pe, result); @@ -1066,7 +1066,7 @@ tr2: #line 312 "parser.rl" { VALUE v = Qnil; - char *np = JSON_parse_value(json, p, pe, &v); + char *np = JSON_parse_value(json, p, pe, &v); if (np == NULL) { p--; {p++; cs = 3; goto _out;} } else { @@ -1286,7 +1286,7 @@ static VALUE json_string_unescape(char *p, char *pe) p++; break; case 'u': - if (p > pe - 4) { + if (p > pe - 4) { return Qnil; } else { p = JSON_convert_UTF16_to_UTF8(result, p, pe, strictConversion); @@ -1474,7 +1474,7 @@ static const int JSON_en_main = 1; #line 473 "parser.rl" -/* +/* * Document-class: JSON::Ext::Parser * * This is the JSON parser implemented as a C extension. It can be configured diff --git a/ext/json/ext/parser/parser.rl b/ext/json/ext/parser/parser.rl index 384ab9f42f..3f180c4ec9 100644 --- a/ext/json/ext/parser/parser.rl +++ b/ext/json/ext/parser/parser.rl @@ -27,7 +27,7 @@ static VALUE mJSON, mExt, cParser, eParserError, eNestingError; static VALUE CNaN, CInfinity, CMinusInfinity; static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions, - i_chr, i_max_nesting, i_allow_nan, i_object_class, i_array_class; + i_chr, i_max_nesting, i_allow_nan, i_object_class, i_array_class; #define MinusInfinity "-Infinity" @@ -91,7 +91,7 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul action parse_value { VALUE v = Qnil; - char *np = JSON_parse_value(json, fpc, pe, &v); + char *np = JSON_parse_value(json, fpc, pe, &v); if (np == NULL) { fhold; fbreak; } else { @@ -199,7 +199,7 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu fhold; fbreak; } - action parse_array { + action parse_array { char *np; json->current_nesting++; np = JSON_parse_array(json, fpc, pe, result); @@ -207,7 +207,7 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu if (np == NULL) { fhold; fbreak; } else fexec np; } - action parse_object { + action parse_object { char *np; json->current_nesting++; np = JSON_parse_object(json, fpc, pe, result); @@ -311,7 +311,7 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul action parse_value { VALUE v = Qnil; - char *np = JSON_parse_value(json, fpc, pe, &v); + char *np = JSON_parse_value(json, fpc, pe, &v); if (np == NULL) { fhold; fbreak; } else { @@ -385,7 +385,7 @@ static VALUE json_string_unescape(char *p, char *pe) p++; break; case 'u': - if (p > pe - 4) { + if (p > pe - 4) { return Qnil; } else { p = JSON_convert_UTF16_to_UTF8(result, p, pe, strictConversion); @@ -472,7 +472,7 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu ) ignore*; }%% -/* +/* * Document-class: JSON::Ext::Parser * * This is the JSON parser implemented as a C extension. It can be configured diff --git a/ext/json/ext/parser/unicode.c b/ext/json/ext/parser/unicode.c index 80e5c6f036..1af2878476 100644 --- a/ext/json/ext/parser/unicode.c +++ b/ext/json/ext/parser/unicode.c @@ -2,9 +2,9 @@ /* * Copyright 2001-2004 Unicode, Inc. - * + * * Disclaimer - * + * * This source code is provided as is by Unicode, Inc. No claims are * made as to fitness for any particular purpose. No warranties of any * kind are expressed or implied. The recipient agrees to determine @@ -12,9 +12,9 @@ * purchased on magnetic or optical media from Unicode, Inc., the * sole remedy for any claim will be exchange of defective media * within 90 days of receipt. - * + * * Limitations on Rights to Redistribute This Code - * + * * Unicode, Inc. hereby grants the right to freely use the information * supplied in this file in the creation of products supporting the * Unicode Standard, and to make copies of this file in any form @@ -45,7 +45,7 @@ static const char trailingBytesForUTF8[256] = { * This table contains as many values as there might be trailing bytes * in a UTF-8 sequence. */ -static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL, +static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL, 0x03C82080UL, 0xFA082080UL, 0x82082080UL }; /* @@ -89,7 +89,7 @@ char *JSON_convert_UTF16_to_UTF8 ( UTF32 ch; unsigned short bytesToWrite = 0; const UTF32 byteMask = 0xBF; - const UTF32 byteMark = 0x80; + const UTF32 byteMark = 0x80; ch = *tmpPtr++; /* If we have a surrogate pair, convert to UTF32 first. */ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) { diff --git a/ext/nkf/nkf-utf8/config.h b/ext/nkf/nkf-utf8/config.h index 752ed38d59..51dc2a5152 100644 --- a/ext/nkf/nkf-utf8/config.h +++ b/ext/nkf/nkf-utf8/config.h @@ -39,7 +39,7 @@ /* * Select Default Output Encoding - * + * */ /* #define DEFAULT_CODE_JIS */ diff --git a/ext/nkf/nkf-utf8/nkf.c b/ext/nkf/nkf-utf8/nkf.c index a8bfc9a58b..bdb2a4d72d 100644 --- a/ext/nkf/nkf-utf8/nkf.c +++ b/ext/nkf/nkf-utf8/nkf.c @@ -820,7 +820,7 @@ nkf_buf_new(int length) buf->capa = length; buf->len = 0; return buf; -} +} #if 0 static void @@ -5870,7 +5870,7 @@ finished: /* * int options(unsigned char *cp) - * + * * return values: * 0: success * -1: ArgumentError diff --git a/ext/nkf/nkf-utf8/nkf.h b/ext/nkf/nkf-utf8/nkf.h index 49f3b7ff34..dd479a0f87 100644 --- a/ext/nkf/nkf-utf8/nkf.h +++ b/ext/nkf/nkf-utf8/nkf.h @@ -1,7 +1,7 @@ /* - * + * * nkf.h - Header file for nkf - * + * * $Id$ */ diff --git a/ext/nkf/nkf.c b/ext/nkf/nkf.c index 82327bf356..1eb4104357 100644 --- a/ext/nkf/nkf.c +++ b/ext/nkf/nkf.c @@ -203,7 +203,7 @@ rb_nkf_guess(VALUE obj, VALUE src) /* - * NKF - Ruby extension for Network Kanji Filter + * NKF - Ruby extension for Network Kanji Filter * * == Description * @@ -341,7 +341,7 @@ rb_nkf_guess(VALUE obj, VALUE src) * To see ISO8859-1 (Latin-1) -l is necessary. * * [-mB] Decode MIME base64 encoded stream. Remove header or other part before - * conversion. + * conversion. * * [-mQ] Decode MIME quoted stream. '_' in quoted stream is converted to space. * diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c index aa39f58221..817380f83c 100644 --- a/ext/objspace/objspace.c +++ b/ext/objspace/objspace.c @@ -15,7 +15,7 @@ /* objspace library extends ObjectSpace module and add several * methods to get internal statistic information about * object/memory management. - * + * * Generally, you *SHOULD NOT*use this library if you do not know * about the MRI implementation. Mainly, this library is for (memory) * profiler developers and MRI developers who need to know how MRI @@ -203,7 +203,7 @@ cos_i(void *vstart, void *vend, size_t stride, void *data) * * It returns a hash as: * {:TOTAL=>1461154, :T_CLASS=>158280, :T_MODULE=>20672, :T_STRING=>527249, ...} - * + * * If the optional argument, result_hash, is given, * it is overwritten and returned. * This is intended to avoid probe effect. @@ -532,7 +532,7 @@ count_tdata_objects(int argc, VALUE *argv, VALUE self) /* objspace library extends ObjectSpace module and add several * methods to get internal statistic information about * object/memory management. - * + * * Generally, you *SHOULD NOT*use this library if you do not know * about the MRI implementation. Mainly, this library is for (memory) * profiler developers and MRI developers who need to know how MRI diff --git a/ext/openssl/openssl_missing.c b/ext/openssl/openssl_missing.c index 724f36b8ae..2d880796ff 100644 --- a/ext/openssl/openssl_missing.c +++ b/ext/openssl/openssl_missing.c @@ -41,7 +41,7 @@ int X509_STORE_set_ex_data(X509_STORE *str, int idx, void *data) { return CRYPTO_set_ex_data(&str->ex_data, idx, data); } - + void *X509_STORE_get_ex_data(X509_STORE *str, int idx) { return CRYPTO_get_ex_data(&str->ex_data, idx); @@ -111,7 +111,7 @@ HMAC_CTX_cleanup(HMAC_CTX *ctx) #endif #if !defined(HAVE_EVP_CIPHER_CTX_COPY) -/* +/* * this function does not exist in OpenSSL yet... or ever?. * a future version may break this function. * tested on 0.9.7d. @@ -180,12 +180,12 @@ OSSL_X509_REVOKED_cmp(const X509_REVOKED * const *a, const X509_REVOKED * const (ASN1_STRING *)(*a)->serialNumber, (ASN1_STRING *)(*b)->serialNumber)); } - + int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev) { X509_CRL_INFO *inf; - + inf = crl->crl; if (!inf->revoked) inf->revoked = sk_X509_REVOKED_new(OSSL_X509_REVOKED_cmp); @@ -313,7 +313,7 @@ PEM_def_callback(char *buf, int num, int w, void *key) { int i,j; const char *prompt; - + if (key) { i = strlen(key); i = (i > num) ? num : i; diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c index 85ba654061..510fbdf297 100644 --- a/ext/openssl/ossl.c +++ b/ext/openssl/ossl.c @@ -48,7 +48,7 @@ string2hex(const unsigned char *buf, int buf_len, char **hexbuf, int *hexbuf_len * Data Conversion */ STACK_OF(X509) * -ossl_x509_ary2sk0(VALUE ary) +ossl_x509_ary2sk0(VALUE ary) { STACK_OF(X509) *sk; VALUE val; @@ -57,13 +57,13 @@ ossl_x509_ary2sk0(VALUE ary) Check_Type(ary, T_ARRAY); sk = sk_X509_new_null(); - if (!sk) ossl_raise(eOSSLError, NULL); + if (!sk) ossl_raise(eOSSLError, NULL); for (i = 0; i < RARRAY_LEN(ary); i++) { val = rb_ary_entry(ary, i); if (!rb_obj_is_kind_of(val, cX509Cert)) { sk_X509_pop_free(sk, X509_free); - ossl_raise(eOSSLError, "object not X509 cert in array"); + ossl_raise(eOSSLError, "object not X509 cert in array"); } x509 = DupX509CertPtr(val); /* NEED TO DUP */ sk_X509_push(sk, x509); @@ -157,7 +157,7 @@ ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd) { int len, status = 0; VALUE rflag, pass; - + if (pwd || !rb_block_given_p()) return PEM_def_callback(buf, max_len, flag, pwd); @@ -192,12 +192,12 @@ int ossl_verify_cb_idx; VALUE ossl_call_verify_cb_proc(struct ossl_verify_cb_args *args) -{ +{ return rb_funcall(args->proc, rb_intern("call"), 2, args->preverify_ok, args->store_ctx); } - -int + +int ossl_verify_cb(int ok, X509_STORE_CTX *ctx) { VALUE proc, rctx, ret; diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c index 6aff2b7e95..5068876e28 100644 --- a/ext/openssl/ossl_asn1.c +++ b/ext/openssl/ossl_asn1.c @@ -27,7 +27,7 @@ asn1time_to_time(ASN1_TIME *time) { struct tm tm; VALUE argv[6]; - + if (!time || !time->data) return Qnil; memset(&tm, 0, sizeof(struct tm)); @@ -36,7 +36,7 @@ asn1time_to_time(ASN1_TIME *time) if (sscanf((const char *)time->data, "%2d%2d%2d%2d%2d%2dZ", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) { ossl_raise(rb_eTypeError, "bad UTCTIME format"); - } + } if (tm.tm_year < 69) { tm.tm_year += 2000; } else { @@ -47,7 +47,7 @@ asn1time_to_time(ASN1_TIME *time) if (sscanf((const char *)time->data, "%4d%2d%2d%2d%2d%2dZ", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) { ossl_raise(rb_eTypeError, "bad GENERALIZEDTIME format" ); - } + } break; default: rb_warning("unknown time format"); @@ -144,7 +144,7 @@ ASN1_INTEGER * num_to_asn1integer(VALUE obj, ASN1_INTEGER *ai) { BIGNUM *bn = GetBNPtr(obj); - + if (!(ai = BN_to_ASN1_INTEGER(bn, ai))) { ossl_raise(eOSSLError, NULL); } @@ -321,7 +321,7 @@ decode_int(unsigned char* der, int length) { ASN1_INTEGER *ai; const unsigned char *p; - VALUE ret; + VALUE ret; int status = 0; p = der; @@ -361,7 +361,7 @@ decode_enum(unsigned char* der, int length) { ASN1_ENUMERATED *ai; const unsigned char *p; - VALUE ret; + VALUE ret; int status = 0; p = der; @@ -524,7 +524,7 @@ ossl_asn1_get_asn1type(VALUE obj) case V_ASN1_ISO64STRING: /* FALLTHROUGH */ case V_ASN1_GENERALSTRING: /* FALLTHROUGH */ case V_ASN1_UNIVERSALSTRING: /* FALLTHROUGH */ - case V_ASN1_BMPSTRING: + case V_ASN1_BMPSTRING: ptr = obj_to_asn1str(value); free_func = ASN1_STRING_free; break; @@ -660,8 +660,8 @@ ossl_asn1data_initialize(VALUE self, VALUE value, VALUE tag, VALUE tag_class) return self; } -static VALUE -join_der_i(VALUE i, VALUE str) +static VALUE +join_der_i(VALUE i, VALUE str) { i = ossl_to_der_if_possible(i); StringValue(i); @@ -737,7 +737,7 @@ ossl_asn1_decode0(unsigned char **pp, long length, long *offset, long depth, rb_yield(arg); } length -= hlen; - off += hlen; + off += hlen; if(len > length) ossl_raise(eASN1Error, "value is too short"); if((tc & V_ASN1_PRIVATE) == V_ASN1_PRIVATE) tag_class = sPRIVATE; diff --git a/ext/openssl/ossl_asn1.h b/ext/openssl/ossl_asn1.h index 8aad9f970d..718f43f068 100644 --- a/ext/openssl/ossl_asn1.h +++ b/ext/openssl/ossl_asn1.h @@ -32,12 +32,12 @@ ASN1_INTEGER *num_to_asn1integer(VALUE, ASN1_INTEGER *); * ASN1 module */ extern VALUE mASN1; -extern VALUE eASN1Error; +extern VALUE eASN1Error; extern VALUE cASN1Data; extern VALUE cASN1Primitive; extern VALUE cASN1Constructive; - + extern VALUE cASN1Boolean; /* BOOLEAN */ extern VALUE cASN1Integer, cASN1Enumerated; /* INTEGER */ extern VALUE cASN1BitString; /* BIT STRING */ diff --git a/ext/openssl/ossl_bio.c b/ext/openssl/ossl_bio.c index 6db1fb9a62..dc8732d9d9 100644 --- a/ext/openssl/ossl_bio.c +++ b/ext/openssl/ossl_bio.c @@ -72,7 +72,7 @@ ossl_protect_membio2str(BIO *bio, int *status) return rb_protect((VALUE(*)_((VALUE)))ossl_membio2str0, (VALUE)bio, status); } -VALUE +VALUE ossl_membio2str(BIO *bio) { VALUE ret; diff --git a/ext/openssl/ossl_bn.c b/ext/openssl/ossl_bn.c index 6db9670bb7..350e465e3c 100644 --- a/ext/openssl/ossl_bn.c +++ b/ext/openssl/ossl_bn.c @@ -380,7 +380,7 @@ ossl_bn_div(VALUE self, VALUE other) } WrapBN(CLASS_OF(self), obj1, r1); WrapBN(CLASS_OF(self), obj2, r2); - + return rb_ary_new3(2, obj1, obj2); } @@ -591,7 +591,7 @@ ossl_bn_s_generate_prime(int argc, VALUE *argv, VALUE klass) ossl_raise(eBNError, NULL); } WrapBN(klass, obj, result); - + return obj; } @@ -615,14 +615,14 @@ static VALUE ossl_bn_copy(VALUE self, VALUE other) { BIGNUM *bn1, *bn2; - + rb_check_frozen(self); - + if (self == other) return self; - + GetBN(self, bn1); bn2 = GetBNPtr(other); - + if (!BN_copy(bn1, bn2)) { ossl_raise(eBNError, NULL); } @@ -793,7 +793,7 @@ Init_ossl_bn() * value_one - DON'T IMPL. * set_word * get_word */ - + rb_define_singleton_method(cBN, "rand", ossl_bn_s_rand, -1); rb_define_singleton_method(cBN, "pseudo_rand", ossl_bn_s_pseudo_rand, -1); rb_define_singleton_method(cBN, "rand_range", ossl_bn_s_rand_range, 1); diff --git a/ext/openssl/ossl_cipher.c b/ext/openssl/ossl_cipher.c index df7856b6f0..73f2c58190 100644 --- a/ext/openssl/ossl_cipher.c +++ b/ext/openssl/ossl_cipher.c @@ -287,7 +287,7 @@ ossl_cipher_pkcs5_keyivgen(int argc, VALUE *argv, VALUE self) digest = NIL_P(vdigest) ? EVP_md5() : GetDigestPtr(vdigest); GetCipher(self, ctx); EVP_BytesToKey(EVP_CIPHER_CTX_cipher(ctx), digest, salt, - (unsigned char *)RSTRING_PTR(vpass), RSTRING_LEN(vpass), iter, key, iv); + (unsigned char *)RSTRING_PTR(vpass), RSTRING_LEN(vpass), iter, key, iv); if (EVP_CipherInit_ex(ctx, NULL, NULL, key, iv, -1) != 1) ossl_raise(eCipherError, NULL); OPENSSL_cleanse(key, sizeof key); @@ -305,7 +305,7 @@ ossl_cipher_pkcs5_keyivgen(int argc, VALUE *argv, VALUE self) * +data+ is a nonempty string. * +buffer+ is an optional string to store the result. */ -static VALUE +static VALUE ossl_cipher_update(int argc, VALUE *argv, VALUE self) { EVP_CIPHER_CTX *ctx; @@ -345,7 +345,7 @@ ossl_cipher_update(int argc, VALUE *argv, VALUE self) * * See EVP_CipherFinal_ex for further information. */ -static VALUE +static VALUE ossl_cipher_final(VALUE self) { EVP_CIPHER_CTX *ctx; @@ -445,7 +445,7 @@ ossl_cipher_set_key_length(VALUE self, VALUE key_length) { int len = NUM2INT(key_length); EVP_CIPHER_CTX *ctx; - + GetCipher(self, ctx); if (EVP_CIPHER_CTX_set_key_length(ctx, len) != 1) ossl_raise(eCipherError, NULL); @@ -515,7 +515,7 @@ static VALUE ossl_cipher_block_size() { } /* * INIT */ -void +void Init_ossl_cipher(void) { #if 0 /* let rdoc know about mOSSL */ diff --git a/ext/openssl/ossl_config.c b/ext/openssl/ossl_config.c index aac51f9f5d..c7a2bf482a 100644 --- a/ext/openssl/ossl_config.c +++ b/ext/openssl/ossl_config.c @@ -33,8 +33,8 @@ VALUE cConfig; VALUE eConfigError; -/* - * Public +/* + * Public */ static CONF *parse_config(VALUE, CONF*); @@ -154,7 +154,7 @@ ossl_config_initialize(int argc, VALUE *argv, VALUE self) _CONF_new_data(conf); } #endif - + return self; } @@ -187,7 +187,7 @@ ossl_config_add_value(VALUE self, VALUE section, VALUE name, VALUE value) OPENSSL_free(cv); ossl_raise(eConfigError, "_CONF_add_string failure"); } - + return value; #endif } @@ -233,7 +233,7 @@ static VALUE ossl_config_get_value_old(int argc, VALUE *argv, VALUE self) { VALUE section, name; - + rb_scan_args(argc, argv, "11", §ion, &name); /* support conf.value(nil, "HOME") -> conf.get_value("", "HOME") */ diff --git a/ext/openssl/ossl_digest.c b/ext/openssl/ossl_digest.c index 9b8ced5233..506d48035a 100644 --- a/ext/openssl/ossl_digest.c +++ b/ext/openssl/ossl_digest.c @@ -56,14 +56,14 @@ GetDigestPtr(VALUE obj) VALUE ossl_digest_new(const EVP_MD *md) -{ +{ VALUE ret; EVP_MD_CTX *ctx; ret = ossl_digest_alloc(cDigest); GetDigest(ret, ctx); EVP_DigestInit_ex(ctx, md, NULL); - + return ret; } @@ -104,7 +104,7 @@ ossl_digest_initialize(int argc, VALUE *argv, VALUE self) GetDigest(self, ctx); EVP_DigestInit_ex(ctx, md, NULL); - + if (!NIL_P(data)) return ossl_digest_update(self, data); return self; } @@ -113,7 +113,7 @@ static VALUE ossl_digest_copy(VALUE self, VALUE other) { EVP_MD_CTX *ctx1, *ctx2; - + rb_check_frozen(self); if (self == other) return self; diff --git a/ext/openssl/ossl_engine.c b/ext/openssl/ossl_engine.c index ec6f7fdf96..57e7971b98 100644 --- a/ext/openssl/ossl_engine.c +++ b/ext/openssl/ossl_engine.c @@ -29,7 +29,7 @@ GetPKCS7(obj, engine); \ } while (0) -/* +/* * Classes */ VALUE cEngine; @@ -327,7 +327,7 @@ ossl_engine_inspect(VALUE self) { VALUE str; const char *cname = rb_class2name(rb_obj_class(self)); - + str = rb_str_new2("#<"); rb_str_cat2(str, cname); rb_str_cat2(str, " id=\""); diff --git a/ext/openssl/ossl_hmac.c b/ext/openssl/ossl_hmac.c index aa7644aa5c..f26a6f5b7a 100644 --- a/ext/openssl/ossl_hmac.c +++ b/ext/openssl/ossl_hmac.c @@ -80,7 +80,7 @@ static VALUE ossl_hmac_copy(VALUE self, VALUE other) { HMAC_CTX *ctx1, *ctx2; - + rb_check_frozen(self); if (self == other) return self; @@ -139,7 +139,7 @@ ossl_hmac_digest(VALUE self) GetHMAC(self, ctx); hmac_final(ctx, &buf, &buf_len); digest = ossl_buf2str((char *)buf, buf_len); - + return digest; } @@ -247,7 +247,7 @@ Init_ossl_hmac() rb_define_alloc_func(cHMAC, ossl_hmac_alloc); rb_define_singleton_method(cHMAC, "digest", ossl_hmac_s_digest, 3); rb_define_singleton_method(cHMAC, "hexdigest", ossl_hmac_s_hexdigest, 3); - + rb_define_method(cHMAC, "initialize", ossl_hmac_initialize, 2); rb_define_copy_func(cHMAC, ossl_hmac_copy); diff --git a/ext/openssl/ossl_ns_spki.c b/ext/openssl/ossl_ns_spki.c index 5ff58c3108..2ebad18891 100644 --- a/ext/openssl/ossl_ns_spki.c +++ b/ext/openssl/ossl_ns_spki.c @@ -91,7 +91,7 @@ ossl_spki_to_der(VALUE self) if (i2d_NETSCAPE_SPKI(spki, &p) <= 0) ossl_raise(eX509CertError, NULL); ossl_str_adjust(str, p); - + return str; } @@ -187,7 +187,7 @@ ossl_spki_set_challenge(VALUE self, VALUE str) RSTRING_LEN(str))) { ossl_raise(eSPKIError, NULL); } - + return str; } diff --git a/ext/openssl/ossl_ocsp.c b/ext/openssl/ossl_ocsp.c index 898b2ad753..1c53147a03 100644 --- a/ext/openssl/ossl_ocsp.c +++ b/ext/openssl/ossl_ocsp.c @@ -558,7 +558,7 @@ ossl_ocspbres_get_status(VALUE self) } return ret; -} +} static VALUE ossl_ocspbres_sign(int argc, VALUE *argv, VALUE self) diff --git a/ext/openssl/ossl_pkcs12.c b/ext/openssl/ossl_pkcs12.c index a58d5e05e8..85e092b251 100644 --- a/ext/openssl/ossl_pkcs12.c +++ b/ext/openssl/ossl_pkcs12.c @@ -81,7 +81,7 @@ ossl_pkcs12_s_create(int argc, VALUE *argv, VALUE self) STACK_OF(X509) *x509s; int nkey = 0, ncert = 0, kiter = 0, miter = 0, ktype = 0; PKCS12 *p12; - + rb_scan_args(argc, argv, "46", &pass, &name, &pkey, &cert, &ca, &key_nid, &cert_nid, &key_iter, &mac_iter, &keytype); passphrase = NIL_P(pass) ? NULL : StringValuePtr(pass); friendlyname = NIL_P(name) ? NULL : StringValuePtr(name); diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c index b0cc656d4c..e61c022982 100644 --- a/ext/openssl/ossl_pkcs7.c +++ b/ext/openssl/ossl_pkcs7.c @@ -68,7 +68,7 @@ #define ossl_pkcs7_set_err_string(o,v) rb_iv_set((o), "@error_string", (v)) #define ossl_pkcs7_get_err_string(o) rb_iv_get((o), "@error_string") -/* +/* * Classes */ VALUE cPKCS7; @@ -295,7 +295,7 @@ ossl_pkcs7_alloc(VALUE klass) ossl_raise(ePKCS7Error, NULL); } WrapPKCS7(klass, obj, pkcs7); - + return obj; } @@ -495,7 +495,7 @@ ossl_pkcs7_get_signer(VALUE self) PKCS7_SIGNER_INFO *si; int num, i; VALUE ary; - + GetPKCS7(self, pkcs7); if (!(sk = PKCS7_get_signer_info(pkcs7))) { OSSL_Debug("OpenSSL::PKCS7#get_signer_info == NULL!"); @@ -537,7 +537,7 @@ ossl_pkcs7_get_recipient(VALUE self) PKCS7_RECIP_INFO *si; int num, i; VALUE ary; - + GetPKCS7(self, pkcs7); if (PKCS7_type_is_enveloped(pkcs7)) sk = pkcs7->d.enveloped->recipientinfo; @@ -777,7 +777,7 @@ ossl_pkcs7_add_data(VALUE self, VALUE data) } if(!PKCS7_dataFinal(pkcs7, out)) goto err; ossl_pkcs7_set_data(self, Qnil); - + err: BIO_free(out); BIO_free(in); @@ -1021,10 +1021,10 @@ Init_ossl_pkcs7() cPKCS7Recipient = rb_define_class_under(cPKCS7,"RecipientInfo",rb_cObject); rb_define_alloc_func(cPKCS7Recipient, ossl_pkcs7ri_alloc); - rb_define_method(cPKCS7Recipient, "initialize", ossl_pkcs7ri_initialize,1); + rb_define_method(cPKCS7Recipient, "initialize", ossl_pkcs7ri_initialize,1); rb_define_method(cPKCS7Recipient, "issuer", ossl_pkcs7ri_get_issuer,0); rb_define_method(cPKCS7Recipient, "serial", ossl_pkcs7ri_get_serial,0); - rb_define_method(cPKCS7Recipient, "enc_key", ossl_pkcs7ri_get_enc_key,0); + rb_define_method(cPKCS7Recipient, "enc_key", ossl_pkcs7ri_get_enc_key,0); #define DefPKCS7Const(x) rb_define_const(cPKCS7, #x, INT2NUM(PKCS7_##x)) diff --git a/ext/openssl/ossl_pkey.c b/ext/openssl/ossl_pkey.c index 903a3bb1e5..37a9f8cc0c 100644 --- a/ext/openssl/ossl_pkey.c +++ b/ext/openssl/ossl_pkey.c @@ -214,7 +214,7 @@ Init_ossl_pkey() #if 0 /* let rdoc know about mOSSL */ mOSSL = rb_define_module("OpenSSL"); #endif - + mPKey = rb_define_module_under(mOSSL, "PKey"); ePKeyError = rb_define_class_under(mPKey, "PKeyError", eOSSLError); diff --git a/ext/openssl/ossl_pkey_dh.c b/ext/openssl/ossl_pkey_dh.c index 768cda86b7..4ce8264860 100644 --- a/ext/openssl/ossl_pkey_dh.c +++ b/ext/openssl/ossl_pkey_dh.c @@ -85,7 +85,7 @@ static DH * dh_generate(int size, int gen) { DH *dh; - + dh = DH_generate_parameters(size, gen, rb_block_given_p() ? ossl_generate_cb : NULL, NULL); @@ -244,7 +244,7 @@ ossl_dh_export(VALUE self) */ static VALUE ossl_dh_to_der(VALUE self) -{ +{ EVP_PKEY *pkey; unsigned char *p; long len; @@ -284,7 +284,7 @@ ossl_dh_get_params(VALUE self) rb_hash_aset(hash, rb_str_new2("g"), ossl_bn_new(pkey->pkey.dh->g)); rb_hash_aset(hash, rb_str_new2("pub_key"), ossl_bn_new(pkey->pkey.dh->pub_key)); rb_hash_aset(hash, rb_str_new2("priv_key"), ossl_bn_new(pkey->pkey.dh->priv_key)); - + return hash; } @@ -351,7 +351,7 @@ ossl_dh_check_params(VALUE self) DH *dh; EVP_PKEY *pkey; int codes; - + GetPKeyDH(self, pkey); dh = pkey->pkey.dh; @@ -436,10 +436,10 @@ static unsigned char DEFAULT_DH_512_PRIM[] = { 0x08, 0x04, 0x8c, 0x52, 0x8f, 0xe3, 0x4a, 0x31, 0x44, 0x47, 0x19, 0xa1, 0x4a, 0xc8, 0x8b, 0xcb, }; -static unsigned char DEFAULT_DH_512_GEN[] = { 0x02 }; +static unsigned char DEFAULT_DH_512_GEN[] = { 0x02 }; DH *OSSL_DEFAULT_DH_512 = NULL; - -/* + +/* * -----BEGIN DH PARAMETERS----- * MIGHAoGBAJ0lOVy0VIr/JebWn0zDwY2h+rqITFOpdNr6ugsgvkDXuucdcChhYExJ * AV/ZD2AWPbrTqV76mGRgJg4EddgT1zG0jq3rnFdMj2XzkBYx3BVvfR0Arnby0RHR diff --git a/ext/openssl/ossl_pkey_dsa.c b/ext/openssl/ossl_pkey_dsa.c index d39933b754..7b2db70ced 100644 --- a/ext/openssl/ossl_pkey_dsa.c +++ b/ext/openssl/ossl_pkey_dsa.c @@ -320,7 +320,7 @@ ossl_dsa_get_params(VALUE self) rb_hash_aset(hash, rb_str_new2("g"), ossl_bn_new(pkey->pkey.dsa->g)); rb_hash_aset(hash, rb_str_new2("pub_key"), ossl_bn_new(pkey->pkey.dsa->pub_key)); rb_hash_aset(hash, rb_str_new2("priv_key"), ossl_bn_new(pkey->pkey.dsa->priv_key)); - + return hash; } diff --git a/ext/openssl/ossl_pkey_ec.c b/ext/openssl/ossl_pkey_ec.c index edb5695fb4..a7907cda95 100644 --- a/ext/openssl/ossl_pkey_ec.c +++ b/ext/openssl/ossl_pkey_ec.c @@ -274,7 +274,7 @@ static VALUE ossl_ec_key_get_group(VALUE self) * the group. * * Setting the group will immediately destroy any previously assigned group object. - * The group is internally copied by OpenSSL. Modifying the original group after + * The group is internally copied by OpenSSL. Modifying the original group after * assignment will not effect the internal key structure. * (your changes may be lost). BE CAREFUL. * @@ -1023,7 +1023,7 @@ static VALUE ossl_ec_group_set_asn1_flag(VALUE self, VALUE flag_v) } /* call-seq: - * group.point_conversion_form => :uncompressed | :compressed | :hybrid + * group.point_conversion_form => :uncompressed | :compressed | :hybrid * * See the OpenSSL documentation for EC_GROUP_get_point_conversion_form() */ @@ -1043,7 +1043,7 @@ static VALUE ossl_ec_group_get_point_conversion_form(VALUE self) case POINT_CONVERSION_HYBRID: ret = ID_hybrid; break; default: rb_raise(eEC_GROUP, "unsupported point conversion form: %d, this module should be updated", form); } - + return ID2SYM(ret); } @@ -1270,7 +1270,7 @@ static VALUE ossl_ec_point_initialize(int argc, VALUE *argv, VALUE self) rb_raise(rb_eArgError, "1st argument must be OpenSSL::PKey::EC::Group"); group_v = arg1; SafeRequire_EC_GROUP(group_v, group); - + if (rb_obj_is_kind_of(arg2, cBN)) { const BIGNUM *bn = GetBNPtr(arg2); diff --git a/ext/openssl/ossl_pkey_rsa.c b/ext/openssl/ossl_pkey_rsa.c index 80665cddbd..0421ec5e99 100644 --- a/ext/openssl/ossl_pkey_rsa.c +++ b/ext/openssl/ossl_pkey_rsa.c @@ -124,7 +124,7 @@ ossl_rsa_s_generate(int argc, VALUE *argv, VALUE klass) * * +pass+ is an optional string with the password to decrypt the encoded key. * * === Examples - * * RSA.new(2048) -> rsa + * * RSA.new(2048) -> rsa * * RSA.new(File.read("rsa.pem")) -> rsa * * RSA.new(File.read("rsa.pem"), "mypassword") -> rsa */ @@ -211,7 +211,7 @@ ossl_rsa_is_private(VALUE self) EVP_PKEY *pkey; GetPKeyRSA(self, pkey); - + return (RSA_PRIVATE(self, pkey->pkey.rsa)) ? Qtrue : Qfalse; } @@ -262,7 +262,7 @@ ossl_rsa_export(int argc, VALUE *argv, VALUE self) } } str = ossl_membio2str(out); - + return str; } @@ -346,7 +346,7 @@ ossl_rsa_public_decrypt(int argc, VALUE *argv, VALUE self) pad); if (buf_len < 0) ossl_raise(eRSAError, NULL); rb_str_set_len(str, buf_len); - + return str; } @@ -375,7 +375,7 @@ ossl_rsa_private_encrypt(int argc, VALUE *argv, VALUE self) pad); if (buf_len < 0) ossl_raise(eRSAError, NULL); rb_str_set_len(str, buf_len); - + return str; } @@ -435,7 +435,7 @@ ossl_rsa_get_params(VALUE self) rb_hash_aset(hash, rb_str_new2("dmp1"), ossl_bn_new(pkey->pkey.rsa->dmp1)); rb_hash_aset(hash, rb_str_new2("dmq1"), ossl_bn_new(pkey->pkey.rsa->dmq1)); rb_hash_aset(hash, rb_str_new2("iqmp"), ossl_bn_new(pkey->pkey.rsa->iqmp)); - + return hash; } @@ -479,7 +479,7 @@ ossl_rsa_to_public_key(VALUE self) EVP_PKEY *pkey; RSA *rsa; VALUE obj; - + GetPKeyRSA(self, pkey); /* err check performed by rsa_instance */ rsa = RSAPublicKey_dup(pkey->pkey.rsa); @@ -498,7 +498,7 @@ static VALUE ossl_rsa_blinding_on(VALUE self) { EVP_PKEY *pkey; - + GetPKeyRSA(self, pkey); if (RSA_blinding_on(pkey->pkey.rsa, ossl_bn_ctx) != 1) { @@ -511,7 +511,7 @@ static VALUE ossl_rsa_blinding_off(VALUE self) { EVP_PKEY *pkey; - + GetPKeyRSA(self, pkey); RSA_blinding_off(pkey->pkey.rsa); diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c index e70a868620..c17d0ab839 100644 --- a/ext/openssl/ossl_ssl.c +++ b/ext/openssl/ossl_ssl.c @@ -91,7 +91,7 @@ static const char *ossl_ssl_attrs[] = { #ifdef HAVE_SSL_SET_TLSEXT_HOST_NAME "hostname", #endif - "sync_close", + "sync_close", }; ID ID_callback_state; @@ -304,7 +304,7 @@ static VALUE ossl_call_session_get_cb(VALUE ary) { VALUE ssl_obj, sslctx_obj, cb; - + Check_Type(ary, T_ARRAY); ssl_obj = rb_ary_entry(ary, 0); @@ -351,7 +351,7 @@ static VALUE ossl_call_session_new_cb(VALUE ary) { VALUE ssl_obj, sslctx_obj, cb; - + Check_Type(ary, T_ARRAY); ssl_obj = rb_ary_entry(ary, 0); @@ -398,7 +398,7 @@ static VALUE ossl_call_session_remove_cb(VALUE ary) { VALUE sslctx_obj, cb; - + Check_Type(ary, T_ARRAY); sslctx_obj = rb_ary_entry(ary, 0); @@ -1585,7 +1585,7 @@ Init_ossl_ssl() rb_define_method(cSSLContext, "setup", ossl_sslctx_setup, 0); - + rb_define_const(cSSLContext, "SESSION_CACHE_OFF", LONG2FIX(SSL_SESS_CACHE_OFF)); rb_define_const(cSSLContext, "SESSION_CACHE_CLIENT", LONG2FIX(SSL_SESS_CACHE_CLIENT)); /* doesn't actually do anything in 0.9.8e */ rb_define_const(cSSLContext, "SESSION_CACHE_SERVER", LONG2FIX(SSL_SESS_CACHE_SERVER)); diff --git a/ext/openssl/ossl_ssl.h b/ext/openssl/ossl_ssl.h index 487f41216c..92df5f5599 100644 --- a/ext/openssl/ossl_ssl.h +++ b/ext/openssl/ossl_ssl.h @@ -22,7 +22,7 @@ OSSL_Check_Kind(obj, cSSLSession); \ GetSSLSession(obj, sess); \ } while (0) - + extern VALUE mSSL; extern VALUE eSSLError; extern VALUE cSSLSocket; diff --git a/ext/openssl/ossl_ssl_session.c b/ext/openssl/ossl_ssl_session.c index d5fdba6aed..21aafede9c 100644 --- a/ext/openssl/ossl_ssl_session.c +++ b/ext/openssl/ossl_ssl_session.c @@ -15,7 +15,7 @@ OSSL_Check_Kind(obj, cSSLSession); \ GetSSLSession(obj, sess); \ } while (0) - + VALUE cSSLSession; static VALUE eSSLSession; @@ -214,7 +214,7 @@ static VALUE ossl_ssl_session_to_pem(VALUE self) BUF_MEM *buf; VALUE str; int i; - + GetSSLSession(self, ctx); if (!(out = BIO_new(BIO_s_mem()))) { @@ -246,7 +246,7 @@ static VALUE ossl_ssl_session_to_text(VALUE self) BIO *out; BUF_MEM *buf; VALUE str; - + GetSSLSession(self, ctx); if (!(out = BIO_new(BIO_s_mem()))) { @@ -264,7 +264,7 @@ static VALUE ossl_ssl_session_to_text(VALUE self) return str; } - + void Init_ossl_ssl_session(void) { diff --git a/ext/openssl/ossl_x509attr.c b/ext/openssl/ossl_x509attr.c index 2a4c481ee3..1ab13692d4 100644 --- a/ext/openssl/ossl_x509attr.c +++ b/ext/openssl/ossl_x509attr.c @@ -41,7 +41,7 @@ ossl_x509attr_new(X509_ATTRIBUTE *attr) { X509_ATTRIBUTE *new; VALUE obj; - + if (!attr) { new = X509_ATTRIBUTE_new(); } else { @@ -77,7 +77,7 @@ ossl_x509attr_alloc(VALUE klass) X509_ATTRIBUTE *attr; VALUE obj; - if (!(attr = X509_ATTRIBUTE_new())) + if (!(attr = X509_ATTRIBUTE_new())) ossl_raise(eX509AttrError, NULL); WrapX509Attr(klass, obj, attr); @@ -123,14 +123,14 @@ ossl_x509attr_set_oid(VALUE self, VALUE oid) X509_ATTRIBUTE *attr; ASN1_OBJECT *obj; char *s; - + s = StringValuePtr(oid); obj = OBJ_txt2obj(s, 0); if(!obj) obj = OBJ_txt2obj(s, 1); if(!obj) ossl_raise(eX509AttrError, NULL); GetX509Attr(self, attr); X509_ATTRIBUTE_set1_object(attr, obj); - + return oid; } @@ -157,7 +157,7 @@ ossl_x509attr_get_oid(VALUE self) i2a_ASN1_OBJECT(out, oid); ret = ossl_membio2str(out); } - + return ret; } @@ -251,7 +251,7 @@ ossl_x509attr_to_der(VALUE self) p = (unsigned char *)RSTRING_PTR(str); if(i2d_X509_ATTRIBUTE(attr, &p) <= 0) ossl_raise(eX509AttrError, NULL); - rb_str_set_len(str, p - (unsigned char*)RSTRING_PTR(str)); + rb_str_set_len(str, p - (unsigned char*)RSTRING_PTR(str)); return str; } diff --git a/ext/openssl/ossl_x509cert.c b/ext/openssl/ossl_x509cert.c index fec2d8b1a3..09f4d6b251 100644 --- a/ext/openssl/ossl_x509cert.c +++ b/ext/openssl/ossl_x509cert.c @@ -55,7 +55,7 @@ ossl_x509_new(X509 *x509) return obj; } -VALUE +VALUE ossl_x509_new_from_file(VALUE filename) { X509 *x509; @@ -111,7 +111,7 @@ DupX509CertPtr(VALUE obj) /* * Private */ -static VALUE +static VALUE ossl_x509_alloc(VALUE klass) { X509 *x509; @@ -130,7 +130,7 @@ ossl_x509_alloc(VALUE klass) * Certificate.new => cert * Certificate.new(string) => cert */ -static VALUE +static VALUE ossl_x509_initialize(int argc, VALUE *argv, VALUE self) { BIO *in; @@ -152,7 +152,7 @@ ossl_x509_initialize(int argc, VALUE *argv, VALUE self) } BIO_free(in); if (!x509) ossl_raise(eX509CertError, NULL); - + return self; } @@ -169,7 +169,7 @@ ossl_x509_copy(VALUE self, VALUE other) x509 = X509_dup(b); if (!x509) ossl_raise(eX509CertError, NULL); - + DATA_PTR(self) = x509; X509_free(a); @@ -180,7 +180,7 @@ ossl_x509_copy(VALUE self, VALUE other) * call-seq: * cert.to_der => string */ -static VALUE +static VALUE ossl_x509_to_der(VALUE self) { X509 *x509; @@ -196,7 +196,7 @@ ossl_x509_to_der(VALUE self) if (i2d_X509(x509, &p) <= 0) ossl_raise(eX509CertError, NULL); ossl_str_adjust(str, p); - + return str; } @@ -204,7 +204,7 @@ ossl_x509_to_der(VALUE self) * call-seq: * cert.to_pem => string */ -static VALUE +static VALUE ossl_x509_to_pem(VALUE self) { X509 *x509; @@ -253,7 +253,7 @@ ossl_x509_to_text(VALUE self) /* * Makes from X509 X509_REQuest */ -static VALUE +static VALUE ossl_x509_to_req(VALUE self) { X509 *x509; @@ -275,7 +275,7 @@ ossl_x509_to_req(VALUE self) * call-seq: * cert.version => integer */ -static VALUE +static VALUE ossl_x509_get_version(VALUE self) { X509 *x509; @@ -289,7 +289,7 @@ ossl_x509_get_version(VALUE self) * call-seq: * cert.version = integer => integer */ -static VALUE +static VALUE ossl_x509_set_version(VALUE self, VALUE version) { X509 *x509; @@ -310,7 +310,7 @@ ossl_x509_set_version(VALUE self, VALUE version) * call-seq: * cert.serial => integer */ -static VALUE +static VALUE ossl_x509_get_serial(VALUE self) { X509 *x509; @@ -324,7 +324,7 @@ ossl_x509_get_serial(VALUE self) * call-seq: * cert.serial = integer => integer */ -static VALUE +static VALUE ossl_x509_set_serial(VALUE self, VALUE num) { X509 *x509; @@ -341,7 +341,7 @@ ossl_x509_set_serial(VALUE self, VALUE num) * call-seq: * cert.signature_algorithm => string */ -static VALUE +static VALUE ossl_x509_get_signature_algorithm(VALUE self) { X509 *x509; @@ -365,7 +365,7 @@ ossl_x509_get_signature_algorithm(VALUE self) * call-seq: * cert.subject => name */ -static VALUE +static VALUE ossl_x509_get_subject(VALUE self) { X509 *x509; @@ -383,7 +383,7 @@ ossl_x509_get_subject(VALUE self) * call-seq: * cert.subject = name => name */ -static VALUE +static VALUE ossl_x509_set_subject(VALUE self, VALUE subject) { X509 *x509; @@ -400,7 +400,7 @@ ossl_x509_set_subject(VALUE self, VALUE subject) * call-seq: * cert.issuer => name */ -static VALUE +static VALUE ossl_x509_get_issuer(VALUE self) { X509 *x509; @@ -418,7 +418,7 @@ ossl_x509_get_issuer(VALUE self) * call-seq: * cert.issuer = name => name */ -static VALUE +static VALUE ossl_x509_set_issuer(VALUE self, VALUE issuer) { X509 *x509; @@ -435,7 +435,7 @@ ossl_x509_set_issuer(VALUE self, VALUE issuer) * call-seq: * cert.not_before => time */ -static VALUE +static VALUE ossl_x509_get_not_before(VALUE self) { X509 *x509; @@ -453,7 +453,7 @@ ossl_x509_get_not_before(VALUE self) * call-seq: * cert.not_before = time => time */ -static VALUE +static VALUE ossl_x509_set_not_before(VALUE self, VALUE time) { X509 *x509; @@ -472,7 +472,7 @@ ossl_x509_set_not_before(VALUE self, VALUE time) * call-seq: * cert.not_after => time */ -static VALUE +static VALUE ossl_x509_get_not_after(VALUE self) { X509 *x509; @@ -490,7 +490,7 @@ ossl_x509_get_not_after(VALUE self) * call-seq: * cert.not_before = time => time */ -static VALUE +static VALUE ossl_x509_set_not_after(VALUE self, VALUE time) { X509 *x509; @@ -509,7 +509,7 @@ ossl_x509_set_not_after(VALUE self, VALUE time) * call-seq: * cert.public_key => key */ -static VALUE +static VALUE ossl_x509_get_public_key(VALUE self) { X509 *x509; @@ -527,7 +527,7 @@ ossl_x509_get_public_key(VALUE self) * call-seq: * cert.public_key = key => key */ -static VALUE +static VALUE ossl_x509_set_public_key(VALUE self, VALUE key) { X509 *x509; @@ -544,7 +544,7 @@ ossl_x509_set_public_key(VALUE self, VALUE key) * call-seq: * cert.sign(key, digest) => self */ -static VALUE +static VALUE ossl_x509_sign(VALUE self, VALUE key, VALUE digest) { X509 *x509; @@ -567,7 +567,7 @@ ossl_x509_sign(VALUE self, VALUE key, VALUE digest) * * Checks that cert signature is made with PRIVversion of this PUBLIC 'key' */ -static VALUE +static VALUE ossl_x509_verify(VALUE self, VALUE key) { X509 *x509; @@ -578,7 +578,7 @@ ossl_x509_verify(VALUE self, VALUE key) GetX509(self, x509); if ((i = X509_verify(x509, pkey)) < 0) { ossl_raise(eX509CertError, NULL); - } + } if (i > 0) { return Qtrue; } @@ -592,7 +592,7 @@ ossl_x509_verify(VALUE self, VALUE key) * * Checks if 'key' is PRIV key for this cert */ -static VALUE +static VALUE ossl_x509_check_private_key(VALUE self, VALUE key) { X509 *x509; @@ -613,7 +613,7 @@ ossl_x509_check_private_key(VALUE self, VALUE key) * call-seq: * cert.extensions => [extension...] */ -static VALUE +static VALUE ossl_x509_get_extensions(VALUE self) { X509 *x509; @@ -639,7 +639,7 @@ ossl_x509_get_extensions(VALUE self) * call-seq: * cert.extensions = [ext...] => [ext...] */ -static VALUE +static VALUE ossl_x509_set_extensions(VALUE self, VALUE ary) { X509 *x509; @@ -671,7 +671,7 @@ ossl_x509_set_extensions(VALUE self, VALUE ary) * call-seq: * cert.add_extension(extension) => extension */ -static VALUE +static VALUE ossl_x509_add_extension(VALUE self, VALUE extension) { X509 *x509; @@ -725,7 +725,7 @@ ossl_x509_inspect(VALUE self) /* * INIT */ -void +void Init_ossl_x509cert() { eX509CertError = rb_define_class_under(mX509, "CertificateError", eOSSLError); @@ -735,7 +735,7 @@ Init_ossl_x509cert() rb_define_alloc_func(cX509Cert, ossl_x509_alloc); rb_define_method(cX509Cert, "initialize", ossl_x509_initialize, -1); rb_define_copy_func(cX509Cert, ossl_x509_copy); - + rb_define_method(cX509Cert, "to_der", ossl_x509_to_der, 0); rb_define_method(cX509Cert, "to_pem", ossl_x509_to_pem, 0); rb_define_alias(cX509Cert, "to_s", "to_pem"); diff --git a/ext/openssl/ossl_x509crl.c b/ext/openssl/ossl_x509crl.c index 818fdbaddb..ef03fe1f7e 100644 --- a/ext/openssl/ossl_x509crl.c +++ b/ext/openssl/ossl_x509crl.c @@ -66,14 +66,14 @@ ossl_x509crl_new(X509_CRL *crl) tmp = crl ? X509_CRL_dup(crl) : X509_CRL_new(); if(!tmp) ossl_raise(eX509CRLError, NULL); WrapX509CRL(cX509CRL, obj, tmp); - + return obj; } /* * PRIVATE */ -static VALUE +static VALUE ossl_x509crl_alloc(VALUE klass) { X509_CRL *crl; @@ -87,7 +87,7 @@ ossl_x509crl_alloc(VALUE klass) return obj; } -static VALUE +static VALUE ossl_x509crl_initialize(int argc, VALUE *argv, VALUE self) { BIO *in; @@ -130,7 +130,7 @@ ossl_x509crl_copy(VALUE self, VALUE other) return self; } -static VALUE +static VALUE ossl_x509crl_get_version(VALUE self) { X509_CRL *crl; @@ -142,7 +142,7 @@ ossl_x509crl_get_version(VALUE self) return LONG2NUM(ver); } -static VALUE +static VALUE ossl_x509crl_set_version(VALUE self, VALUE version) { X509_CRL *crl; @@ -159,7 +159,7 @@ ossl_x509crl_set_version(VALUE self, VALUE version) return version; } -static VALUE +static VALUE ossl_x509crl_get_signature_algorithm(VALUE self) { X509_CRL *crl; @@ -181,7 +181,7 @@ ossl_x509crl_get_signature_algorithm(VALUE self) return str; } -static VALUE +static VALUE ossl_x509crl_get_issuer(VALUE self) { X509_CRL *crl; @@ -191,7 +191,7 @@ ossl_x509crl_get_issuer(VALUE self) return ossl_x509name_new(X509_CRL_get_issuer(crl)); /* NO DUP - don't free */ } -static VALUE +static VALUE ossl_x509crl_set_issuer(VALUE self, VALUE issuer) { X509_CRL *crl; @@ -204,7 +204,7 @@ ossl_x509crl_set_issuer(VALUE self, VALUE issuer) return issuer; } -static VALUE +static VALUE ossl_x509crl_get_last_update(VALUE self) { X509_CRL *crl; @@ -214,7 +214,7 @@ ossl_x509crl_get_last_update(VALUE self) return asn1time_to_time(X509_CRL_get_lastUpdate(crl)); } -static VALUE +static VALUE ossl_x509crl_set_last_update(VALUE self, VALUE time) { X509_CRL *crl; @@ -229,7 +229,7 @@ ossl_x509crl_set_last_update(VALUE self, VALUE time) return time; } -static VALUE +static VALUE ossl_x509crl_get_next_update(VALUE self) { X509_CRL *crl; @@ -239,7 +239,7 @@ ossl_x509crl_get_next_update(VALUE self) return asn1time_to_time(X509_CRL_get_nextUpdate(crl)); } -static VALUE +static VALUE ossl_x509crl_set_next_update(VALUE self, VALUE time) { X509_CRL *crl; @@ -280,7 +280,7 @@ ossl_x509crl_get_revoked(VALUE self) return ary; } -static VALUE +static VALUE ossl_x509crl_set_revoked(VALUE self, VALUE ary) { X509_CRL *crl; @@ -306,7 +306,7 @@ ossl_x509crl_set_revoked(VALUE self, VALUE ary) return ary; } -static VALUE +static VALUE ossl_x509crl_add_revoked(VALUE self, VALUE revoked) { X509_CRL *crl; @@ -322,7 +322,7 @@ ossl_x509crl_add_revoked(VALUE self, VALUE revoked) return revoked; } -static VALUE +static VALUE ossl_x509crl_sign(VALUE self, VALUE key, VALUE digest) { X509_CRL *crl; @@ -339,7 +339,7 @@ ossl_x509crl_sign(VALUE self, VALUE key, VALUE digest) return self; } -static VALUE +static VALUE ossl_x509crl_verify(VALUE self, VALUE key) { X509_CRL *crl; @@ -356,7 +356,7 @@ ossl_x509crl_verify(VALUE self, VALUE key) return Qfalse; } -static VALUE +static VALUE ossl_x509crl_to_der(VALUE self) { X509_CRL *crl; @@ -379,7 +379,7 @@ ossl_x509crl_to_der(VALUE self) return str; } -static VALUE +static VALUE ossl_x509crl_to_pem(VALUE self) { X509_CRL *crl; @@ -402,7 +402,7 @@ ossl_x509crl_to_pem(VALUE self) return str; } -static VALUE +static VALUE ossl_x509crl_to_text(VALUE self) { X509_CRL *crl; @@ -428,7 +428,7 @@ ossl_x509crl_to_text(VALUE self) /* * Gets X509v3 extensions as array of X509Ext objects */ -static VALUE +static VALUE ossl_x509crl_get_extensions(VALUE self) { X509_CRL *crl; @@ -454,7 +454,7 @@ ossl_x509crl_get_extensions(VALUE self) /* * Sets X509_EXTENSIONs */ -static VALUE +static VALUE ossl_x509crl_set_extensions(VALUE self, VALUE ary) { X509_CRL *crl; @@ -481,7 +481,7 @@ ossl_x509crl_set_extensions(VALUE self, VALUE ary) return ary; } -static VALUE +static VALUE ossl_x509crl_add_extension(VALUE self, VALUE extension) { X509_CRL *crl; @@ -501,7 +501,7 @@ ossl_x509crl_add_extension(VALUE self, VALUE extension) /* * INIT */ -void +void Init_ossl_x509crl() { eX509CRLError = rb_define_class_under(mX509, "CRLError", eOSSLError); @@ -511,7 +511,7 @@ Init_ossl_x509crl() rb_define_alloc_func(cX509CRL, ossl_x509crl_alloc); rb_define_method(cX509CRL, "initialize", ossl_x509crl_initialize, -1); rb_define_copy_func(cX509CRL, ossl_x509crl_copy); - + rb_define_method(cX509CRL, "version", ossl_x509crl_get_version, 0); rb_define_method(cX509CRL, "version=", ossl_x509crl_set_version, 1); rb_define_method(cX509CRL, "signature_algorithm", ossl_x509crl_get_signature_algorithm, 0); diff --git a/ext/openssl/ossl_x509ext.c b/ext/openssl/ossl_x509ext.c index d79615499b..d703edcd20 100644 --- a/ext/openssl/ossl_x509ext.c +++ b/ext/openssl/ossl_x509ext.c @@ -49,7 +49,7 @@ VALUE eX509ExtError; /* * Public */ -VALUE +VALUE ossl_x509ext_new(X509_EXTENSION *ext) { X509_EXTENSION *new; @@ -103,7 +103,7 @@ ossl_x509extfactory_free(X509V3_CTX *ctx) OPENSSL_free(ctx); } -static VALUE +static VALUE ossl_x509extfactory_alloc(VALUE klass) { X509V3_CTX *ctx; @@ -115,7 +115,7 @@ ossl_x509extfactory_alloc(VALUE klass) return obj; } -static VALUE +static VALUE ossl_x509extfactory_set_issuer_cert(VALUE self, VALUE cert) { X509V3_CTX *ctx; @@ -127,7 +127,7 @@ ossl_x509extfactory_set_issuer_cert(VALUE self, VALUE cert) return cert; } -static VALUE +static VALUE ossl_x509extfactory_set_subject_cert(VALUE self, VALUE cert) { X509V3_CTX *ctx; @@ -139,7 +139,7 @@ ossl_x509extfactory_set_subject_cert(VALUE self, VALUE cert) return cert; } -static VALUE +static VALUE ossl_x509extfactory_set_subject_req(VALUE self, VALUE req) { X509V3_CTX *ctx; @@ -151,7 +151,7 @@ ossl_x509extfactory_set_subject_req(VALUE self, VALUE req) return req; } -static VALUE +static VALUE ossl_x509extfactory_set_crl(VALUE self, VALUE crl) { X509V3_CTX *ctx; @@ -181,7 +181,7 @@ ossl_x509extfactory_set_config(VALUE self, VALUE config) #define rb_f_fork rb_f_notimplement #endif -static VALUE +static VALUE ossl_x509extfactory_initialize(int argc, VALUE *argv, VALUE self) { /*X509V3_CTX *ctx;*/ @@ -211,7 +211,7 @@ ossl_x509extfactory_initialize(int argc, VALUE *argv, VALUE self) * ["ln", "critical,value"] or the same for sn * ["ln", "value"] => not critical */ -static VALUE +static VALUE ossl_x509extfactory_create_ext(int argc, VALUE *argv, VALUE self) { X509V3_CTX *ctx; @@ -351,7 +351,7 @@ ossl_x509ext_set_critical(VALUE self, VALUE flag) return flag; } -static VALUE +static VALUE ossl_x509ext_get_oid(VALUE obj) { X509_EXTENSION *ext; @@ -427,7 +427,7 @@ void Init_ossl_x509ext() { eX509ExtError = rb_define_class_under(mX509, "ExtensionError", eOSSLError); - + cX509ExtFactory = rb_define_class_under(mX509, "ExtensionFactory", rb_cObject); rb_define_alloc_func(cX509ExtFactory, ossl_x509extfactory_alloc); diff --git a/ext/openssl/ossl_x509name.c b/ext/openssl/ossl_x509name.c index fd8e329a85..12e8022517 100644 --- a/ext/openssl/ossl_x509name.c +++ b/ext/openssl/ossl_x509name.c @@ -41,7 +41,7 @@ VALUE eX509NameError; /* * Public */ -VALUE +VALUE ossl_x509name_new(X509_NAME *name) { X509_NAME *new; @@ -56,7 +56,7 @@ ossl_x509name_new(X509_NAME *name) ossl_raise(eX509NameError, NULL); } WrapX509Name(cX509Name, obj, new); - + return obj; } @@ -222,7 +222,7 @@ ossl_x509name_to_s(int argc, VALUE *argv, VALUE self) * call-seq: * name.to_a => [[name, data, type], ...] */ -static VALUE +static VALUE ossl_x509name_to_a(VALUE self) { X509_NAME *name; @@ -333,7 +333,7 @@ ossl_x509name_to_der(VALUE self) /* * INIT */ -void +void Init_ossl_x509name() { VALUE utf8str, ptrstr, ia5str, hash; diff --git a/ext/openssl/ossl_x509req.c b/ext/openssl/ossl_x509req.c index 7c1b610159..1821a4305b 100644 --- a/ext/openssl/ossl_x509req.c +++ b/ext/openssl/ossl_x509req.c @@ -81,7 +81,7 @@ DupX509ReqPtr(VALUE obj) /* * Private functions */ -static VALUE +static VALUE ossl_x509req_alloc(VALUE klass) { X509_REQ *req; @@ -95,7 +95,7 @@ ossl_x509req_alloc(VALUE klass) return obj; } -static VALUE +static VALUE ossl_x509req_initialize(int argc, VALUE *argv, VALUE self) { BIO *in; @@ -138,7 +138,7 @@ ossl_x509req_copy(VALUE self, VALUE other) return self; } -static VALUE +static VALUE ossl_x509req_to_pem(VALUE self) { X509_REQ *req; @@ -181,7 +181,7 @@ ossl_x509req_to_der(VALUE self) return str; } -static VALUE +static VALUE ossl_x509req_to_text(VALUE self) { X509_REQ *req; @@ -208,7 +208,7 @@ ossl_x509req_to_text(VALUE self) /* * Makes X509 from X509_REQuest */ -static VALUE +static VALUE ossl_x509req_to_x509(VALUE self, VALUE days, VALUE key) { X509_REQ *req; @@ -224,7 +224,7 @@ ossl_x509req_to_x509(VALUE self, VALUE days, VALUE key) } #endif -static VALUE +static VALUE ossl_x509req_get_version(VALUE self) { X509_REQ *req; @@ -236,7 +236,7 @@ ossl_x509req_get_version(VALUE self) return LONG2FIX(version); } -static VALUE +static VALUE ossl_x509req_set_version(VALUE self, VALUE version) { X509_REQ *req; @@ -253,7 +253,7 @@ ossl_x509req_set_version(VALUE self, VALUE version) return version; } -static VALUE +static VALUE ossl_x509req_get_subject(VALUE self) { X509_REQ *req; @@ -267,7 +267,7 @@ ossl_x509req_get_subject(VALUE self) return ossl_x509name_new(name); } -static VALUE +static VALUE ossl_x509req_set_subject(VALUE self, VALUE subject) { X509_REQ *req; @@ -281,7 +281,7 @@ ossl_x509req_set_subject(VALUE self, VALUE subject) return subject; } -static VALUE +static VALUE ossl_x509req_get_signature_algorithm(VALUE self) { X509_REQ *req; @@ -304,7 +304,7 @@ ossl_x509req_get_signature_algorithm(VALUE self) return str; } -static VALUE +static VALUE ossl_x509req_get_public_key(VALUE self) { X509_REQ *req; @@ -318,7 +318,7 @@ ossl_x509req_get_public_key(VALUE self) return ossl_pkey_new(pkey); /* NO DUP - OK */ } -static VALUE +static VALUE ossl_x509req_set_public_key(VALUE self, VALUE key) { X509_REQ *req; @@ -333,7 +333,7 @@ ossl_x509req_set_public_key(VALUE self, VALUE key) return key; } -static VALUE +static VALUE ossl_x509req_sign(VALUE self, VALUE key, VALUE digest) { X509_REQ *req; @@ -353,7 +353,7 @@ ossl_x509req_sign(VALUE self, VALUE key, VALUE digest) /* * Checks that cert signature is made with PRIVversion of this PUBLIC 'key' */ -static VALUE +static VALUE ossl_x509req_verify(VALUE self, VALUE key) { X509_REQ *req; @@ -372,7 +372,7 @@ ossl_x509req_verify(VALUE self, VALUE key) return Qfalse; } -static VALUE +static VALUE ossl_x509req_get_attributes(VALUE self) { X509_REQ *req; @@ -396,7 +396,7 @@ ossl_x509req_get_attributes(VALUE self) return ary; } -static VALUE +static VALUE ossl_x509req_set_attributes(VALUE self, VALUE ary) { X509_REQ *req; @@ -421,7 +421,7 @@ ossl_x509req_set_attributes(VALUE self, VALUE ary) return ary; } -static VALUE +static VALUE ossl_x509req_add_attribute(VALUE self, VALUE attr) { X509_REQ *req; @@ -437,7 +437,7 @@ ossl_x509req_add_attribute(VALUE self, VALUE attr) /* * X509_REQUEST init */ -void +void Init_ossl_x509req() { eX509ReqError = rb_define_class_under(mX509, "RequestError", eOSSLError); diff --git a/ext/openssl/ossl_x509revoked.c b/ext/openssl/ossl_x509revoked.c index d0f816bad4..1654cc6196 100644 --- a/ext/openssl/ossl_x509revoked.c +++ b/ext/openssl/ossl_x509revoked.c @@ -36,7 +36,7 @@ VALUE eX509RevError; /* * PUBLIC */ -VALUE +VALUE ossl_x509revoked_new(X509_REVOKED *rev) { X509_REVOKED *new; @@ -71,7 +71,7 @@ DupX509RevokedPtr(VALUE obj) /* * PRIVATE */ -static VALUE +static VALUE ossl_x509revoked_alloc(VALUE klass) { X509_REVOKED *rev; @@ -85,14 +85,14 @@ ossl_x509revoked_alloc(VALUE klass) return obj; } -static VALUE +static VALUE ossl_x509revoked_initialize(int argc, VALUE *argv, VALUE self) { /* EMPTY */ return self; } -static VALUE +static VALUE ossl_x509revoked_get_serial(VALUE self) { X509_REVOKED *rev; @@ -102,7 +102,7 @@ ossl_x509revoked_get_serial(VALUE self) return asn1integer_to_num(rev->serialNumber); } -static VALUE +static VALUE ossl_x509revoked_set_serial(VALUE self, VALUE num) { X509_REVOKED *rev; @@ -113,7 +113,7 @@ ossl_x509revoked_set_serial(VALUE self, VALUE num) return num; } -static VALUE +static VALUE ossl_x509revoked_get_time(VALUE self) { X509_REVOKED *rev; @@ -123,7 +123,7 @@ ossl_x509revoked_get_time(VALUE self) return asn1time_to_time(rev->revocationDate); } -static VALUE +static VALUE ossl_x509revoked_set_time(VALUE self, VALUE time) { X509_REVOKED *rev; @@ -140,7 +140,7 @@ ossl_x509revoked_set_time(VALUE self, VALUE time) /* * Gets X509v3 extensions as array of X509Ext objects */ -static VALUE +static VALUE ossl_x509revoked_get_extensions(VALUE self) { X509_REVOKED *rev; @@ -166,7 +166,7 @@ ossl_x509revoked_get_extensions(VALUE self) /* * Sets X509_EXTENSIONs */ -static VALUE +static VALUE ossl_x509revoked_set_extensions(VALUE self, VALUE ary) { X509_REVOKED *rev; @@ -196,7 +196,7 @@ static VALUE ossl_x509revoked_add_extension(VALUE self, VALUE ext) { X509_REVOKED *rev; - + GetX509Rev(self, rev); if(!X509_REVOKED_add_ext(rev, DupX509ExtPtr(ext), -1)) { ossl_raise(eX509RevError, NULL); diff --git a/ext/openssl/ossl_x509store.c b/ext/openssl/ossl_x509store.c index e9923c0475..7b4a005110 100644 --- a/ext/openssl/ossl_x509store.c +++ b/ext/openssl/ossl_x509store.c @@ -54,7 +54,7 @@ VALUE eX509StoreError; /* * Public functions */ -VALUE +VALUE ossl_x509store_new(X509_STORE *store) { VALUE obj; @@ -76,19 +76,19 @@ GetX509StorePtr(VALUE obj) X509_STORE * DupX509StorePtr(VALUE obj) -{ +{ X509_STORE *store; SafeGetX509Store(obj, store); CRYPTO_add(&store->references, 1, CRYPTO_LOCK_X509_STORE); - + return store; } /* * Private functions */ -static VALUE +static VALUE ossl_x509store_alloc(VALUE klass) { X509_STORE *store; @@ -171,7 +171,7 @@ ossl_x509store_set_purpose(VALUE self, VALUE purpose) #if (OPENSSL_VERSION_NUMBER >= 0x00907000L) X509_STORE *store; long p = NUM2LONG(purpose); - + GetX509Store(self, store); X509_STORE_set_purpose(store, p); #else @@ -197,14 +197,14 @@ ossl_x509store_set_trust(VALUE self, VALUE trust) return trust; } -static VALUE +static VALUE ossl_x509store_set_time(VALUE self, VALUE time) { rb_iv_set(self, "@time", time); return time; } -static VALUE +static VALUE ossl_x509store_add_file(VALUE self, VALUE file) { X509_STORE *store; @@ -225,7 +225,7 @@ ossl_x509store_add_file(VALUE self, VALUE file) return self; } -static VALUE +static VALUE ossl_x509store_add_path(VALUE self, VALUE dir) { X509_STORE *store; @@ -293,7 +293,7 @@ static VALUE ossl_x509stctx_get_err(VALUE); static VALUE ossl_x509stctx_get_err_string(VALUE); static VALUE ossl_x509stctx_get_chain(VALUE); -static VALUE +static VALUE ossl_x509store_verify(int argc, VALUE *argv, VALUE self) { VALUE cert, chain; @@ -350,7 +350,7 @@ ossl_x509stctx_free(X509_STORE_CTX *ctx) X509_STORE_CTX_free(ctx); } -static VALUE +static VALUE ossl_x509stctx_alloc(VALUE klass) { X509_STORE_CTX *ctx; @@ -442,7 +442,7 @@ ossl_x509stctx_get_chain(VALUE self) return ary; } -static VALUE +static VALUE ossl_x509stctx_get_err(VALUE self) { X509_STORE_CTX *ctx; @@ -463,7 +463,7 @@ ossl_x509stctx_set_error(VALUE self, VALUE err) return err; } -static VALUE +static VALUE ossl_x509stctx_get_err_string(VALUE self) { X509_STORE_CTX *ctx; @@ -475,7 +475,7 @@ ossl_x509stctx_get_err_string(VALUE self) return rb_str_new2(X509_verify_cert_error_string(err)); } -static VALUE +static VALUE ossl_x509stctx_get_err_depth(VALUE self) { X509_STORE_CTX *ctx; @@ -485,7 +485,7 @@ ossl_x509stctx_get_err_depth(VALUE self) return INT2FIX(X509_STORE_CTX_get_error_depth(ctx)); } -static VALUE +static VALUE ossl_x509stctx_get_curr_cert(VALUE self) { X509_STORE_CTX *ctx; @@ -577,7 +577,7 @@ ossl_x509stctx_set_time(VALUE self, VALUE time) /* * INIT */ -void +void Init_ossl_x509store() { VALUE x509stctx; diff --git a/ext/racc/cparse/cparse.c b/ext/racc/cparse/cparse.c index 77d2d86fa0..3a2a8ae74e 100644 --- a/ext/racc/cparse/cparse.c +++ b/ext/racc/cparse/cparse.c @@ -1,9 +1,9 @@ /* cparse.c -- Racc Runtime Core - + Copyright (c) 1999-2006 Minero Aoki - + This library is free software. You can distribute/modify this program under the same terms of ruby. @@ -293,7 +293,7 @@ lexer_i(VALUE block_args, VALUE data, VALUE self) extract_user_token(v, block_args, &tok, &val); parse_main(v, tok, val, 1); if (v->fin && v->fin != CP_FIN_ACCEPT) - rb_iter_break(); + rb_iter_break(); return Qnil; } @@ -460,7 +460,7 @@ parse_main(struct cparse_params *v, VALUE tok, VALUE val, int resume) if (resume) goto resume; - + while (1) { D_puts(""); D_puts("---- enter new loop ----"); @@ -519,7 +519,7 @@ parse_main(struct cparse_params *v, VALUE tok, VALUE val, int resume) act_fixed: D_printf("act=%ld\n", act); goto handle_act; - + notfound: D_puts("(act) not found: use default"); act_value = AREF(v->action_default, v->curstate); @@ -620,7 +620,7 @@ parse_main(struct cparse_params *v, VALUE tok, VALUE val, int resume) D_puts("(err) found: can handle error token"); break; - + error_pop: D_puts("(err) act not found: can't handle error token; pop"); diff --git a/ext/readline/readline.c b/ext/readline/readline.c index ff30be1503..df66ea6187 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -81,7 +81,7 @@ static char **readline_attempted_completion_function(const char *text, * GNU Readline:: http://www.gnu.org/directory/readline.html * libedit:: http://www.thrysoee.dk/editline/ * - * Reads one inputted line with line edit by Readline.readline method. + * Reads one inputted line with line edit by Readline.readline method. * At this time, the facilitatation completion and the key * bind like Emacs can be operated like GNU Readline. * @@ -173,9 +173,9 @@ readline_get(VALUE prompt) * * * Catches the Interrupt exception by pressed ^C after returns * terminal status: - * + * * require "readline" - * + * * stty_save = `stty -g`.chomp * begin * while buf = Readline.readline @@ -187,25 +187,25 @@ readline_get(VALUE prompt) * end * end * end - * + * * * Catches the INT signal by pressed ^C after returns terminal * status: - * + * * require "readline" - * + * * stty_save = `stty -g`.chomp * trap("INT") { system "stty", stty_save; exit } - * + * * while buf = Readline.readline * p buf * end * * * Ignores pressing ^C: - * + * * require "readline" - * + * * trap("INT", "SIG_IGN") - * + * * while buf = Readline.readline * p buf * end @@ -215,18 +215,18 @@ readline_get(VALUE prompt) * the same it as last one. * * require "readline" - * + * * while buf = Readline.readline("> ", true) * # p Readline::HISTORY.to_a * Readline::HISTORY.pop if /^\s*$/ =~ buf - * + * * begin * if Readline::HISTORY[Readline::HISTORY.length-2] == buf - * Readline::HISTORY.pop + * Readline::HISTORY.pop * end * rescue IndexError * end - * + * * # p Readline::HISTORY.to_a * print "-> ", buf, "\n" * end @@ -389,7 +389,7 @@ readline_s_set_completion_case_fold(VALUE self, VALUE val) * Readline.completion_case_fold= method. * * require "readline" - * + * * Readline.completion_case_fold = "This is a String." * p Readline.completion_case_fold # => "This is a String." * @@ -521,7 +521,7 @@ readline_attempted_completion_function(const char *text, int start, int end) * * Set terminal size to +rows+ and +columns+. * - * See GNU Readline's rl_set_screen_size function. + * See GNU Readline's rl_set_screen_size function. * * Raises NotImplementedError if the using readline library does not support. * @@ -545,7 +545,7 @@ readline_s_set_screen_size(VALUE self, VALUE rows, VALUE columns) * * Returns the terminal's rows and columns. * - * See GNU Readline's rl_get_screen_size function. + * See GNU Readline's rl_get_screen_size function. * * Raises NotImplementedError if the using readline library does not support. * @@ -556,7 +556,7 @@ readline_s_get_screen_size(VALUE self) { int rows, columns; VALUE res; - + rb_secure(4); rl_get_screen_size(&rows, &columns); res = rb_ary_new(); @@ -667,20 +667,20 @@ readline_s_emacs_editing_mode_p(VALUE self) * * For example: * require "readline" - * + * * Readline.readline("> ", true) * Readline.completion_append_character = " " * * Result: * > * Input "/var/li". - * + * * > /var/li * Press TAB key. - * + * * > /var/lib * Completes "b" and appends " ". So, you can continuously input "/usr". - * + * * > /var/lib /usr * * NOTE: Only one character can be specified. When "string" is @@ -788,7 +788,7 @@ readline_s_set_basic_word_break_characters(VALUE self, VALUE str) * * Gets the basic list of characters that signal a break between words * for the completer routine. - * + * * Raises NotImplementedError if the using readline library does not support. * * Raises SecurityError exception if $SAFE is 4. @@ -849,7 +849,7 @@ readline_s_set_completer_word_break_characters(VALUE self, VALUE str) * * Gets the basic list of characters that signal a break between words * for rl_complete_internal(). - * + * * Raises NotImplementedError if the using readline library does not support. * * Raises SecurityError exception if $SAFE is 4. @@ -1143,7 +1143,7 @@ static VALUE hist_push_method(int argc, VALUE *argv, VALUE self) { VALUE str; - + rb_secure(4); while (argc--) { str = *argv++; @@ -1422,7 +1422,7 @@ Init_readline() #if defined HAVE_RL_LIBRARY_VERSION version = rb_str_new_cstr(rl_library_version); #if defined HAVE_CLEAR_HISTORY || defined HAVE_REMOVE_HISTORY - if (strncmp(rl_library_version, EDIT_LINE_LIBRARY_VERSION, + if (strncmp(rl_library_version, EDIT_LINE_LIBRARY_VERSION, strlen(EDIT_LINE_LIBRARY_VERSION)) == 0) { add_history("1"); if (history_get(history_get_offset_func(0)) == NULL) { diff --git a/ext/sdbm/_sdbm.c b/ext/sdbm/_sdbm.c index b3a598dbc6..0b46056af5 100644 --- a/ext/sdbm/_sdbm.c +++ b/ext/sdbm/_sdbm.c @@ -186,7 +186,7 @@ sdbm_prep(char *dirname, char *pagname, int flags, int mode) db->blkptr = 0; db->keyptr = 0; /* - * adjust user flags so that WRONLY becomes RDWR, + * adjust user flags so that WRONLY becomes RDWR, * as required by this package. Also set our internal * flag for RDONLY. */ @@ -407,7 +407,7 @@ makroom(register DBM *db, long int hash, int need) * need to read in anything. BUT we have to write the current * [deferred] page out, as the window of failure is too great. */ - db->curbit = 2 * db->curbit + + db->curbit = 2 * db->curbit + ((hash & (db->hmask + 1)) ? 2 : 1); db->hmask |= (db->hmask + 1); @@ -483,7 +483,7 @@ getpage(register DBM *db, register long int hash) * see if the block we need is already in memory. * note: this lookaside cache has about 10% hit rate. */ - if (pagb != db->pagbno) { + if (pagb != db->pagbno) { /* * note: here, we assume a "hole" is read as 0s. * if not, must zero pagbuf first. @@ -608,8 +608,8 @@ getnext(register DBM *db) #define exhash(item) sdbm_hash((item).dptr, (item).dsize) -/* - * forward +/* + * forward */ static int seepair proto((char *, int, char *, int)); @@ -829,7 +829,7 @@ splpage(char *pag, char *new, long int sbit) n = GET_SHORT(ino,0); for (ino++; n > 0; ino += 2) { - key.dptr = cur + GET_SHORT(ino,0); + key.dptr = cur + GET_SHORT(ino,0); key.dsize = off - GET_SHORT(ino,0); val.dptr = cur + GET_SHORT(ino,1); val.dsize = GET_SHORT(ino,0) - GET_SHORT(ino,1); @@ -842,13 +842,13 @@ splpage(char *pag, char *new, long int sbit) n -= 2; } - debug(("%d split %d/%d\n", ((short *) cur)[0] / 2, + debug(("%d split %d/%d\n", ((short *) cur)[0] / 2, ((short *) new)[0] / 2, ((short *) pag)[0] / 2)); } /* - * check page sanity: + * check page sanity: * number of entries should be something * reasonable, and all offsets in the index should be in order. * this could be made more rigorous. @@ -891,7 +891,7 @@ chkpage(char *pag) * [this seems to work remarkably well, in fact better * then the ndbm hash function. Replace at your own risk] * use: 65599 nice. - * 65587 even better. + * 65587 even better. */ long sdbm_hash(register char *str, register int len) diff --git a/ext/sdbm/init.c b/ext/sdbm/init.c index f630dc3cc9..fdb7fd42c9 100644 --- a/ext/sdbm/init.c +++ b/ext/sdbm/init.c @@ -293,7 +293,7 @@ fsdbm_shift(VALUE obj) fdbm_modify(obj); GetDBM2(obj, dbmp, dbm); - key = sdbm_firstkey(dbm); + key = sdbm_firstkey(dbm); if (!key.dptr) return Qnil; val = sdbm_fetch(dbm, key); keystr = rb_external_str_new(key.dptr, key.dsize); diff --git a/ext/sdbm/sdbm.h b/ext/sdbm/sdbm.h index 0c7ed1ba9b..9691b29855 100644 --- a/ext/sdbm/sdbm.h +++ b/ext/sdbm/sdbm.h @@ -2,7 +2,7 @@ * sdbm - ndbm work-alike hashed database library * based on Per-Ake Larson's Dynamic Hashing algorithms. BIT 18 (1978). * author: oz@nexus.yorku.ca - * status: public domain. + * status: public domain. */ #ifndef _SDBM_H_ #define _SDBM_H_ diff --git a/ext/socket/addrinfo.h b/ext/socket/addrinfo.h index 806b00e368..f0b977d79c 100644 --- a/ext/socket/addrinfo.h +++ b/ext/socket/addrinfo.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c index a1d12190f7..a42aea73e4 100644 --- a/ext/socket/ancdata.c +++ b/ext/socket/ancdata.c @@ -65,7 +65,7 @@ ip_cmsg_type_to_sym(int level, int cmsg_type) * p Socket::AncillaryData.new(:INET, :TCP, :NODELAY, "") * #=> # * - * p Socket::AncillaryData.new(:INET6, :IPV6, :PKTINFO, "") + * p Socket::AncillaryData.new(:INET6, :IPV6, :PKTINFO, "") * #=> # * */ @@ -228,7 +228,7 @@ ancillary_s_unix_rights(int argc, VALUE *argv, VALUE klass) * * returns the array of IO objects for SCM_RIGHTS control message in UNIX domain socket. * - * The class of the IO objects in the array is IO or Socket. + * The class of the IO objects in the array is IO or Socket. * * The array is attached to _ancillarydata_ when it is instantiated. * For example, BasicSocket#recvmsg attach the array when @@ -356,7 +356,7 @@ ancillary_timestamp(VALUE self) * * Creates a new Socket::AncillaryData object which contains a int as data. * - * The size and endian is dependent on the host. + * The size and endian is dependent on the host. * * p Socket::AncillaryData.int(:UNIX, :SOCKET, :RIGHTS, STDERR.fileno) * #=> # @@ -377,7 +377,7 @@ ancillary_s_int(VALUE klass, VALUE vfamily, VALUE vlevel, VALUE vtype, VALUE int * * Returns the data in _ancillarydata_ as an int. * - * The size and endian is dependent on the host. + * The size and endian is dependent on the host. * * ancdata = Socket::AncillaryData.int(:UNIX, :SOCKET, :RIGHTS, STDERR.fileno) * p ancdata.int #=> 2 @@ -592,7 +592,7 @@ extract_ipv6_pktinfo(VALUE self, struct in6_pktinfo *pktinfo_ptr, struct sockadd * * IPV6_PKTINFO is defined by RFC 3542. * - * addr = Addrinfo.ip("::1") + * addr = Addrinfo.ip("::1") * ifindex = 0 * ancdata = Socket::AncillaryData.ipv6_pktinfo(addr, ifindex) * p ancdata.ipv6_pktinfo #=> [#, 0] @@ -778,7 +778,7 @@ anc_inspect_ip_recvdstaddr(int level, int type, VALUE data, VALUE ret) { if (level == IPPROTO_IP && type == IP_RECVDSTADDR && RSTRING_LEN(data) == sizeof(struct in_addr)) { - struct in_addr addr; + struct in_addr addr; char addrbuf[INET_ADDRSTRLEN]; memcpy(&addr, RSTRING_PTR(data), sizeof(addr)); if (inet_ntop(AF_INET, &addr, addrbuf, sizeof(addrbuf)) == NULL) @@ -829,7 +829,7 @@ anc_inspect_ipv6_pktinfo(int level, int type, VALUE data, VALUE ret) if (level == IPPROTO_IPV6 && type == IPV6_PKTINFO && RSTRING_LEN(data) == sizeof(struct in6_pktinfo)) { struct in6_pktinfo *pktinfo = (struct in6_pktinfo *)RSTRING_PTR(data); - struct in6_addr addr; + struct in6_addr addr; unsigned int ifindex; char addrbuf[INET6_ADDRSTRLEN], ifbuf[IFNAMSIZ]; memcpy(&addr, &pktinfo->ipi6_addr, sizeof(addr)); @@ -1033,7 +1033,7 @@ ancillary_inspect(VALUE self) # endif } break; - + case AF_INET: #ifdef INET6 case AF_INET6: @@ -1211,18 +1211,18 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock) if (last_pad) { /* * This code removes the last padding from msg_controllen. - * + * * 4.3BSD-Reno reject the padding for SCM_RIGHTS. (There was no 64bit environments in those days?) * RFC 2292 require the padding. * RFC 3542 relaxes the condition - implementation must accept both as valid. - * + * * Actual problems: * * - NetBSD 4.0.1 * SCM_RIGHTS with padding causes EINVAL * IPV6_PKTINFO without padding causes "page fault trap" * http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=40661 - * + * * - OpenBSD 4.4 * IPV6_PKTINFO without padding causes EINVAL * @@ -1317,7 +1317,7 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock) * sendmsg can be used to implement send_io as follows: * * # use Socket::AncillaryData. - * ancdata = Socket::AncillaryData.int(:UNIX, :SOCKET, :RIGHTS, io.fileno) + * ancdata = Socket::AncillaryData.int(:UNIX, :SOCKET, :RIGHTS, io.fileno) * sock.sendmsg("a", 0, nil, ancdata) * * # use 3-element array. diff --git a/ext/socket/basicsocket.c b/ext/socket/basicsocket.c index a4c42ee848..0316f9965a 100644 --- a/ext/socket/basicsocket.c +++ b/ext/socket/basicsocket.c @@ -57,7 +57,7 @@ bsock_s_for_fd(VALUE klass, VALUE fd) * s2.close * p s1.read #=> "pong\n" * } - * + * */ static VALUE bsock_shutdown(int argc, VALUE *argv, VALUE sock) @@ -179,15 +179,15 @@ bsock_close_write(VALUE sock) * * Some socket options are integers with boolean values, in this case * #setsockopt could be called like this: - * sock.setsockopt(:SOCKET, :REUSEADDR, true) + * sock.setsockopt(:SOCKET, :REUSEADDR, true) * sock.setsockopt(Socket::SOL_SOCKET,Socket::SO_REUSEADDR, true) * sock.setsockopt(Socket::Option.bool(:INET, :SOCKET, :REUSEADDR, true)) * * Some socket options are integers with numeric values, in this case * #setsockopt could be called like this: - * sock.setsockopt(:IP, :TTL, 255) + * sock.setsockopt(:IP, :TTL, 255) * sock.setsockopt(Socket::IPPROTO_IP, Socket::IP_TTL, 255) - * sock.setsockopt(Socket::Option.int(:INET, :IP, :TTL, 255)) + * sock.setsockopt(Socket::Option.int(:INET, :IP, :TTL, 255)) * * Option values may be structs. Passing them can be complex as it involves * examining your system headers to determine the correct definition. An @@ -196,7 +196,7 @@ bsock_close_write(VALUE sock) * struct in_addr imr_multiaddr; * struct in_addr imr_interface; * }; - * + * * In this case #setsockopt could be called like this: * optval = IPAddr.new("224.0.0.251").hton + * IPAddr.new(Socket::INADDR_ANY, Socket::AF_INET).hton @@ -303,7 +303,7 @@ bsock_setsockopt(int argc, VALUE *argv, VALUE sock) * int l_onoff; * int l_linger; * }; - * + * * In this case #getsockopt could be called like this: * * # Socket::Option knows linger structure. @@ -647,7 +647,7 @@ bsock_recv(int argc, VALUE *argv, VALUE sock) * call-seq: * basicsocket.recv_nonblock(maxlen) => mesg * basicsocket.recv_nonblock(maxlen, flags) => mesg - * + * * Receives up to _maxlen_ bytes from +socket+ using recvfrom(2) after * O_NONBLOCK is set for the underlying file descriptor. * _flags_ is zero or more of the +MSG_+ options. @@ -656,11 +656,11 @@ bsock_recv(int argc, VALUE *argv, VALUE sock) * When recvfrom(2) returns 0, Socket#recv_nonblock returns * an empty string as data. * The meaning depends on the socket: EOF on TCP, empty packet on UDP, etc. - * + * * === Parameters * * +maxlen+ - the number of bytes to receive from the socket - * * +flags+ - zero or more of the +MSG_+ options - * + * * +flags+ - zero or more of the +MSG_+ options + * * === Example * serv = TCPServer.new("127.0.0.1", 0) * af, port, host, addr = serv.addr @@ -675,7 +675,7 @@ bsock_recv(int argc, VALUE *argv, VALUE sock) * end * * Refer to Socket#recvfrom for the exceptions that may be thrown if the call - * to _recv_nonblock_ fails. + * to _recv_nonblock_ fails. * * BasicSocket#recv_nonblock may raise any error corresponding to recvfrom(2) failure, * including Errno::EWOULDBLOCK. diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c index d5ef517943..a4f01c0405 100644 --- a/ext/socket/getaddrinfo.c +++ b/ext/socket/getaddrinfo.c @@ -1,7 +1,7 @@ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -45,7 +45,7 @@ #include #ifndef _WIN32 #include -#if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE) +#if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE) # include #else # include @@ -97,7 +97,7 @@ static const char in_addrany[] = { 0, 0, 0, 0 }; static const char in6_addrany[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -static const char in_loopback[] = { 127, 0, 0, 1 }; +static const char in_loopback[] = { 127, 0, 0, 1 }; static const char in6_loopback[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; @@ -502,7 +502,7 @@ getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *h */ get_name(pton, &afdl[i], &top, pton, pai, port); goto good; - } else + } else ERR(EAI_FAMILY); /*xxx*/ } } diff --git a/ext/socket/getnameinfo.c b/ext/socket/getnameinfo.c index 7f090e9655..fca3bcfcc8 100644 --- a/ext/socket/getnameinfo.c +++ b/ext/socket/getnameinfo.c @@ -1,7 +1,7 @@ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/ext/socket/ipsocket.c b/ext/socket/ipsocket.c index b6b2426e97..68ff5a1301 100644 --- a/ext/socket/ipsocket.c +++ b/ext/socket/ipsocket.c @@ -159,10 +159,10 @@ rsock_revlookup_flag(VALUE revlookup, int *norevlookup) /* * call-seq: - * ipsocket.addr([reverse_lookup]) => [address_family, port, hostname, numeric_address] + * ipsocket.addr([reverse_lookup]) => [address_family, port, hostname, numeric_address] * * Returns the local address as an array which contains - * address_family, port, hostname and numeric_address. + * address_family, port, hostname and numeric_address. * * If +reverse_lookup+ is +true+ or +:hostname+, * hostname is obtained from numeric_address using reverse lookup. @@ -199,10 +199,10 @@ ip_addr(int argc, VALUE *argv, VALUE sock) /* * call-seq: - * ipsocket.peeraddr([reverse_lookup]) => [address_family, port, hostname, numeric_address] + * ipsocket.peeraddr([reverse_lookup]) => [address_family, port, hostname, numeric_address] * * Returns the remote address as an array which contains - * address_family, port, hostname and numeric_address. + * address_family, port, hostname and numeric_address. * It is defined for connection oriented socket such as TCPSocket. * * If +reverse_lookup+ is +true+ or +:hostname+, @@ -257,7 +257,7 @@ ip_peeraddr(int argc, VALUE *argv, VALUE sock) * u2 = UDPSocket.new * u2.send "uuuu", 0, "127.0.0.1", 4913 * p u1.recvfrom(10) #=> ["uuuu", ["AF_INET", 33230, "localhost", "127.0.0.1"]] - * + * */ static VALUE ip_recvfrom(int argc, VALUE *argv, VALUE sock) diff --git a/ext/socket/option.c b/ext/socket/option.c index dde8b416f2..23afbe21d5 100644 --- a/ext/socket/option.c +++ b/ext/socket/option.c @@ -148,7 +148,7 @@ sockopt_data(VALUE self) * * Creates a new Socket::Option object which contains an int as data. * - * The size and endian is dependent on the platform. + * The size and endian is dependent on the platform. * * p Socket::Option.int(:INET, :SOCKET, :KEEPALIVE, 1) * #=> # @@ -169,7 +169,7 @@ sockopt_s_int(VALUE klass, VALUE vfamily, VALUE vlevel, VALUE voptname, VALUE vi * * Returns the data in _sockopt_ as an int. * - * The size and endian is dependent on the platform. + * The size and endian is dependent on the platform. * * sockopt = Socket::Option.int(:INET, :SOCKET, :KEEPALIVE, 1) * p sockopt.int => 1 @@ -280,7 +280,7 @@ sockopt_linger(VALUE self) VALUE vonoff, vsecs; if (level != SOL_SOCKET || optname != SO_LINGER) - rb_raise(rb_eTypeError, "linger socket option expected"); + rb_raise(rb_eTypeError, "linger socket option expected"); if (RSTRING_LEN(data) != sizeof(l)) rb_raise(rb_eTypeError, "size differ. expected as sizeof(struct linger)=%d but %ld", (int)sizeof(struct linger), (long)RSTRING_LEN(data)); diff --git a/ext/socket/raddrinfo.c b/ext/socket/raddrinfo.c index b035f2ed16..8f89240f45 100644 --- a/ext/socket/raddrinfo.c +++ b/ext/socket/raddrinfo.c @@ -743,7 +743,7 @@ init_unix_addrinfo(rb_addrinfo_t *rai, VALUE path, int socktype) un.sun_family = AF_UNIX; memcpy((void*)&un.sun_path, RSTRING_PTR(path), RSTRING_LEN(path)); - + init_addrinfo(rai, (struct sockaddr *)&un, sizeof(un), PF_UNIX, socktype, 0, Qnil, Qnil); } #endif @@ -766,9 +766,9 @@ init_unix_addrinfo(rb_addrinfo_t *rai, VALUE path, int socktype) * Socket.sockaddr_in or Socket.unpack_sockaddr_un. * * sockaddr examples: - * - ["AF_INET", 46102, "localhost.localdomain", "127.0.0.1"] - * - ["AF_INET6", 42304, "ip6-localhost", "::1"] - * - ["AF_UNIX", "/tmp/sock"] + * - ["AF_INET", 46102, "localhost.localdomain", "127.0.0.1"] + * - ["AF_INET6", 42304, "ip6-localhost", "::1"] + * - ["AF_UNIX", "/tmp/sock"] * - Socket.sockaddr_in("smtp", "2001:DB8::1") * - Socket.sockaddr_in(80, "172.18.22.42") * - Socket.sockaddr_in(80, "www.ruby-lang.org") @@ -1374,7 +1374,7 @@ addrinfo_protocol(VALUE self) * * returns the socket address as packed struct sockaddr string. * - * Addrinfo.tcp("localhost", 80).to_sockaddr + * Addrinfo.tcp("localhost", 80).to_sockaddr * #=> "\x02\x00\x00P\x7F\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00" * */ @@ -1928,11 +1928,11 @@ addrinfo_unix_path(VALUE self) * nodename or service can be nil if no conversion intended. * * family, socktype and protocol are hint for preferred protocol. - * If the result will be used for a socket with SOCK_STREAM, + * If the result will be used for a socket with SOCK_STREAM, * SOCK_STREAM should be specified as socktype. * If so, Addrinfo.getaddrinfo returns addrinfo list appropriate for SOCK_STREAM. * If they are omitted or nil is given, the result is not restricted. - * + * * Similarly, PF_INET6 as family restricts for IPv6. * * flags should be bitwise OR of Socket::AI_??? constants. diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 204f81a9c2..1c499d9f08 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -135,13 +135,13 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass) /* * call-seq: * socket.connect(remote_sockaddr) => 0 - * + * * Requests a connection to be made on the given +remote_sockaddr+. Returns 0 if * successful, otherwise an exception is raised. - * + * * === Parameter * * +remote_sockaddr+ - the +struct+ sockaddr contained in a string or Addrinfo object - * + * * === Example: * # Pull down Google's web page * require 'socket' @@ -150,17 +150,17 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass) * sockaddr = Socket.pack_sockaddr_in( 80, 'www.google.com' ) * socket.connect( sockaddr ) * socket.write( "GET / HTTP/1.0\r\n\r\n" ) - * results = socket.read - * + * results = socket.read + * * === Unix-based Exceptions - * On unix-based systems the following system exceptions may be raised if + * On unix-based systems the following system exceptions may be raised if * the call to _connect_ fails: * * Errno::EACCES - search permission is denied for a component of the prefix * path or write access to the +socket+ is denied * * Errno::EADDRINUSE - the _sockaddr_ is already in use * * Errno::EADDRNOTAVAIL - the specified _sockaddr_ is not available from the * local machine - * * Errno::EAFNOSUPPORT - the specified _sockaddr_ is not a valid address for + * * Errno::EAFNOSUPPORT - the specified _sockaddr_ is not a valid address for * the address family of the specified +socket+ * * Errno::EALREADY - a connection is already in progress for the specified * socket @@ -169,7 +169,7 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass) * refused the connection request * * Errno::ECONNRESET - the remote host reset the connection request * * Errno::EFAULT - the _sockaddr_ cannot be accessed - * * Errno::EHOSTUNREACH - the destination host cannot be reached (probably + * * Errno::EHOSTUNREACH - the destination host cannot be reached (probably * because the host is down or a remote router cannot reach it) * * Errno::EINPROGRESS - the O_NONBLOCK is set for the +socket+ and the * connection cannot be immediately established; the connection will be @@ -179,46 +179,46 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass) * asynchronously * * Errno::EISCONN - the specified +socket+ is already connected * * Errno::EINVAL - the address length used for the _sockaddr_ is not a valid - * length for the address family or there is an invalid family in _sockaddr_ + * length for the address family or there is an invalid family in _sockaddr_ * * Errno::ENAMETOOLONG - the pathname resolved had a length which exceeded * PATH_MAX * * Errno::ENETDOWN - the local interface used to reach the destination is down * * Errno::ENETUNREACH - no route to the network is present * * Errno::ENOBUFS - no buffer space is available - * * Errno::ENOSR - there were insufficient STREAMS resources available to + * * Errno::ENOSR - there were insufficient STREAMS resources available to * complete the operation * * Errno::ENOTSOCK - the +socket+ argument does not refer to a socket * * Errno::EOPNOTSUPP - the calling +socket+ is listening and cannot be connected - * * Errno::EPROTOTYPE - the _sockaddr_ has a different type than the socket + * * Errno::EPROTOTYPE - the _sockaddr_ has a different type than the socket * bound to the specified peer address * * Errno::ETIMEDOUT - the attempt to connect time out before a connection * was made. - * + * * On unix-based systems if the address family of the calling +socket+ is * AF_UNIX the follow exceptions may be raised if the call to _connect_ * fails: - * * Errno::EIO - an i/o error occurred while reading from or writing to the + * * Errno::EIO - an i/o error occurred while reading from or writing to the * file system * * Errno::ELOOP - too many symbolic links were encountered in translating * the pathname in _sockaddr_ - * * Errno::ENAMETOOLLONG - a component of a pathname exceeded NAME_MAX + * * Errno::ENAMETOOLLONG - a component of a pathname exceeded NAME_MAX * characters, or an entire pathname exceeded PATH_MAX characters * * Errno::ENOENT - a component of the pathname does not name an existing file * or the pathname is an empty string * * Errno::ENOTDIR - a component of the path prefix of the pathname in _sockaddr_ - * is not a directory - * + * is not a directory + * * === Windows Exceptions - * On Windows systems the following system exceptions may be raised if + * On Windows systems the following system exceptions may be raised if * the call to _connect_ fails: * * Errno::ENETDOWN - the network is down * * Errno::EADDRINUSE - the socket's local address is already in use * * Errno::EINTR - the socket was cancelled * * Errno::EINPROGRESS - a blocking socket is in progress or the service provider - * is still processing a callback function. Or a nonblocking connect call is + * is still processing a callback function. Or a nonblocking connect call is * in progress on the +socket+. * * Errno::EALREADY - see Errno::EINVAL - * * Errno::EADDRNOTAVAIL - the remote address is not a valid address, such as + * * Errno::EADDRNOTAVAIL - the remote address is not a valid address, such as * ADDR_ANY TODO check ADDRANY TO INADDR_ANY * * Errno::EAFNOSUPPORT - addresses in the specified family cannot be used with * with this +socket+ @@ -234,11 +234,11 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass) * * Errno::ENOTSOCK - the +socket+ argument does not refer to a socket * * Errno::ETIMEDOUT - the attempt to connect time out before a connection * was made. - * * Errno::EWOULDBLOCK - the socket is marked as nonblocking and the + * * Errno::EWOULDBLOCK - the socket is marked as nonblocking and the * connection cannot be completed immediately - * * Errno::EACCES - the attempt to connect the datagram socket to the + * * Errno::EACCES - the attempt to connect the datagram socket to the * broadcast address failed - * + * * === See * * connect manual pages on unix-based systems * * connect function in Microsoft's Winsock functions reference @@ -264,14 +264,14 @@ sock_connect(VALUE sock, VALUE addr) /* * call-seq: * socket.connect_nonblock(remote_sockaddr) => 0 - * + * * Requests a connection to be made on the given +remote_sockaddr+ after * O_NONBLOCK is set for the underlying file descriptor. * Returns 0 if successful, otherwise an exception is raised. - * + * * === Parameter * * +remote_sockaddr+ - the +struct+ sockaddr contained in a string or Addrinfo object - * + * * === Example: * # Pull down Google's web page * require 'socket' @@ -283,15 +283,15 @@ sock_connect(VALUE sock, VALUE addr) * rescue IO::WaitWritable * IO.select(nil, [socket]) # wait 3-way handshake completion * begin - * socket.connect_nonblock(sockaddr) # check connection failure + * socket.connect_nonblock(sockaddr) # check connection failure * rescue Errno::EISCONN * end * end * socket.write("GET / HTTP/1.0\r\n\r\n") - * results = socket.read - * + * results = socket.read + * * Refer to Socket#connect for the exceptions that may be thrown if the call - * to _connect_nonblock_ fails. + * to _connect_nonblock_ fails. * * Socket#connect_nonblock may raise any error corresponding to connect(2) failure, * including Errno::EINPROGRESS. @@ -326,9 +326,9 @@ sock_connect_nonblock(VALUE sock, VALUE addr) /* * call-seq: * socket.bind(local_sockaddr) => 0 - * + * * Binds to the given local address. - * + * * === Parameter * * +local_sockaddr+ - the +struct+ sockaddr contained in a string or an Addrinfo object * @@ -345,9 +345,9 @@ sock_connect_nonblock(VALUE sock, VALUE addr) * socket = Socket.new( AF_INET, SOCK_STREAM, 0 ) * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' ) * socket.bind( sockaddr ) - * + * * === Unix-based Exceptions - * On unix-based based systems the following system exceptions may be raised if + * On unix-based based systems the following system exceptions may be raised if * the call to _bind_ fails: * * Errno::EACCES - the specified _sockaddr_ is protected and the current * user does not have permission to bind to it @@ -358,7 +358,7 @@ sock_connect_nonblock(VALUE sock, VALUE addr) * the family of the calling +socket+ * * Errno::EBADF - the _sockaddr_ specified is not a valid file descriptor * * Errno::EFAULT - the _sockaddr_ argument cannot be accessed - * * Errno::EINVAL - the +socket+ is already bound to an address, and the + * * Errno::EINVAL - the +socket+ is already bound to an address, and the * protocol does not support binding to the new _sockaddr_ or the +socket+ * has been shut down. * * Errno::EINVAL - the address length is not a valid length for the address @@ -366,12 +366,12 @@ sock_connect_nonblock(VALUE sock, VALUE addr) * * Errno::ENAMETOOLONG - the pathname resolved had a length which exceeded * PATH_MAX * * Errno::ENOBUFS - no buffer space is available - * * Errno::ENOSR - there were insufficient STREAMS resources available to + * * Errno::ENOSR - there were insufficient STREAMS resources available to * complete the operation * * Errno::ENOTSOCK - the +socket+ does not refer to a socket - * * Errno::EOPNOTSUPP - the socket type of the +socket+ does not support + * * Errno::EOPNOTSUPP - the socket type of the +socket+ does not support * binding to an address - * + * * On unix-based based systems if the address family of the calling +socket+ is * Socket::AF_UNIX the follow exceptions may be raised if the call to _bind_ * fails: @@ -382,19 +382,19 @@ sock_connect_nonblock(VALUE sock, VALUE addr) * * Errno::EIO - an i/o error occurred * * Errno::ELOOP - too many symbolic links were encountered in translating * the pathname in _sockaddr_ - * * Errno::ENAMETOOLLONG - a component of a pathname exceeded NAME_MAX + * * Errno::ENAMETOOLLONG - a component of a pathname exceeded NAME_MAX * characters, or an entire pathname exceeded PATH_MAX characters * * Errno::ENOENT - a component of the pathname does not name an existing file * or the pathname is an empty string * * Errno::ENOTDIR - a component of the path prefix of the pathname in _sockaddr_ * is not a directory * * Errno::EROFS - the name would reside on a read only filesystem - * + * * === Windows Exceptions - * On Windows systems the following system exceptions may be raised if + * On Windows systems the following system exceptions may be raised if * the call to _bind_ fails: * * Errno::ENETDOWN-- the network is down - * * Errno::EACCES - the attempt to connect the datagram socket to the + * * Errno::EACCES - the attempt to connect the datagram socket to the * broadcast address failed * * Errno::EADDRINUSE - the socket's local address is already in use * * Errno::EADDRNOTAVAIL - the specified address is not a valid address for this @@ -404,11 +404,11 @@ sock_connect_nonblock(VALUE sock, VALUE addr) * * Errno::EINVAL - the +socket+ is already bound to an address * * Errno::ENOBUFS - no buffer space is available * * Errno::ENOTSOCK - the +socket+ argument does not refer to a socket - * + * * === See * * bind manual pages on unix-based systems * * bind function in Microsoft's Winsock functions reference - */ + */ static VALUE sock_bind(VALUE sock, VALUE addr) { @@ -425,14 +425,14 @@ sock_bind(VALUE sock, VALUE addr) /* * call-seq: * socket.listen( int ) => 0 - * + * * Listens for connections, using the specified +int+ as the backlog. A call - * to _listen_ only applies if the +socket+ is of type SOCK_STREAM or + * to _listen_ only applies if the +socket+ is of type SOCK_STREAM or * SOCK_SEQPACKET. - * + * * === Parameter * * +backlog+ - the maximum length of the queue for pending connections. - * + * * === Example 1 * require 'socket' * include Socket::Constants @@ -440,43 +440,43 @@ sock_bind(VALUE sock, VALUE addr) * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' ) * socket.bind( sockaddr ) * socket.listen( 5 ) - * + * * === Example 2 (listening on an arbitrary port, unix-based systems only): * require 'socket' * include Socket::Constants * socket = Socket.new( AF_INET, SOCK_STREAM, 0 ) * socket.listen( 1 ) - * + * * === Unix-based Exceptions * On unix based systems the above will work because a new +sockaddr+ struct * is created on the address ADDR_ANY, for an arbitrary port number as handed * off by the kernel. It will not work on Windows, because Windows requires that * the +socket+ is bound by calling _bind_ before it can _listen_. - * + * * If the _backlog_ amount exceeds the implementation-dependent maximum * queue length, the implementation's maximum queue length will be used. - * + * * On unix-based based systems the following system exceptions may be raised if the * call to _listen_ fails: * * Errno::EBADF - the _socket_ argument is not a valid file descriptor - * * Errno::EDESTADDRREQ - the _socket_ is not bound to a local address, and + * * Errno::EDESTADDRREQ - the _socket_ is not bound to a local address, and * the protocol does not support listening on an unbound socket * * Errno::EINVAL - the _socket_ is already connected * * Errno::ENOTSOCK - the _socket_ argument does not refer to a socket * * Errno::EOPNOTSUPP - the _socket_ protocol does not support listen * * Errno::EACCES - the calling process does not have appropriate privileges * * Errno::EINVAL - the _socket_ has been shut down - * * Errno::ENOBUFS - insufficient resources are available in the system to + * * Errno::ENOBUFS - insufficient resources are available in the system to * complete the call - * + * * === Windows Exceptions - * On Windows systems the following system exceptions may be raised if + * On Windows systems the following system exceptions may be raised if * the call to _listen_ fails: * * Errno::ENETDOWN - the network is down - * * Errno::EADDRINUSE - the socket's local address is already in use. This + * * Errno::EADDRINUSE - the socket's local address is already in use. This * usually occurs during the execution of _bind_ but could be delayed * if the call to _bind_ was to a partially wildcard address (involving - * ADDR_ANY) and if a specific address needs to be committed at the + * ADDR_ANY) and if a specific address needs to be committed at the * time of the call to _listen_ * * Errno::EINPROGRESS - a Windows Sockets 1.1 call is in progress or the * service provider is still processing a callback function @@ -487,7 +487,7 @@ sock_bind(VALUE sock, VALUE addr) * * Errno::ENOTSOC - +socket+ is not a socket * * Errno::EOPNOTSUPP - the referenced +socket+ is not a type that supports * the _listen_ method - * + * * === See * * listen manual pages on unix-based systems * * listen function in Microsoft's Winsock functions reference @@ -511,16 +511,16 @@ rsock_sock_listen(VALUE sock, VALUE log) * call-seq: * socket.recvfrom(maxlen) => [mesg, sender_addrinfo] * socket.recvfrom(maxlen, flags) => [mesg, sender_addrinfo] - * + * * Receives up to _maxlen_ bytes from +socket+. _flags_ is zero or more * of the +MSG_+ options. The first element of the results, _mesg_, is the data * received. The second element, _sender_addrinfo_, contains protocol-specific * address information of the sender. - * + * * === Parameters * * +maxlen+ - the maximum number of bytes to receive from the socket - * * +flags+ - zero or more of the +MSG_+ options - * + * * +flags+ - zero or more of the +MSG_+ options + * * === Example * # In one file, start this first * require 'socket' @@ -534,7 +534,7 @@ rsock_sock_listen(VALUE sock, VALUE log) * puts "I only received 20 bytes '#{data}'" * sleep 1 * socket.close - * + * * # In another file, start this second * require 'socket' * include Socket::Constants @@ -542,29 +542,29 @@ rsock_sock_listen(VALUE sock, VALUE log) * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' ) * socket.connect( sockaddr ) * socket.puts "Watch this get cut short!" - * socket.close - * + * socket.close + * * === Unix-based Exceptions * On unix-based based systems the following system exceptions may be raised if the * call to _recvfrom_ fails: * * Errno::EAGAIN - the +socket+ file descriptor is marked as O_NONBLOCK and no * data is waiting to be received; or MSG_OOB is set and no out-of-band data - * is available and either the +socket+ file descriptor is marked as - * O_NONBLOCK or the +socket+ does not support blocking to wait for + * is available and either the +socket+ file descriptor is marked as + * O_NONBLOCK or the +socket+ does not support blocking to wait for * out-of-band-data * * Errno::EWOULDBLOCK - see Errno::EAGAIN * * Errno::EBADF - the +socket+ is not a valid file descriptor * * Errno::ECONNRESET - a connection was forcibly closed by a peer - * * Errno::EFAULT - the socket's internal buffer, address or address length + * * Errno::EFAULT - the socket's internal buffer, address or address length * cannot be accessed or written * * Errno::EINTR - a signal interrupted _recvfrom_ before any data was available * * Errno::EINVAL - the MSG_OOB flag is set and no out-of-band data is available - * * Errno::EIO - an i/o error occurred while reading from or writing to the + * * Errno::EIO - an i/o error occurred while reading from or writing to the * filesystem - * * Errno::ENOBUFS - insufficient resources were available in the system to + * * Errno::ENOBUFS - insufficient resources were available in the system to * perform the operation * * Errno::ENOMEM - insufficient memory was available to fulfill the request - * * Errno::ENOSR - there were insufficient STREAMS resources available to + * * Errno::ENOSR - there were insufficient STREAMS resources available to * complete the operation * * Errno::ENOTCONN - a receive is attempted on a connection-mode socket that * is not connected @@ -572,9 +572,9 @@ rsock_sock_listen(VALUE sock, VALUE log) * * Errno::EOPNOTSUPP - the specified flags are not supported for this socket type * * Errno::ETIMEDOUT - the connection timed out during connection establishment * or due to a transmission timeout on an active connection - * + * * === Windows Exceptions - * On Windows systems the following system exceptions may be raised if + * On Windows systems the following system exceptions may be raised if * the call to _recvfrom_ fails: * * Errno::ENETDOWN - the network is down * * Errno::EFAULT - the internal buffer and from parameters on +socket+ are not @@ -582,31 +582,31 @@ rsock_sock_listen(VALUE sock, VALUE log) * too small to accommodate the peer address * * Errno::EINTR - the (blocking) call was cancelled by an internal call to * the WinSock function WSACancelBlockingCall - * * Errno::EINPROGRESS - a blocking Windows Sockets 1.1 call is in progress or + * * Errno::EINPROGRESS - a blocking Windows Sockets 1.1 call is in progress or * the service provider is still processing a callback function * * Errno::EINVAL - +socket+ has not been bound with a call to _bind_, or an * unknown flag was specified, or MSG_OOB was specified for a socket with * SO_OOBINLINE enabled, or (for byte stream-style sockets only) the internal * len parameter on +socket+ was zero or negative * * Errno::EISCONN - +socket+ is already connected. The call to _recvfrom_ is - * not permitted with a connected socket on a socket that is connection + * not permitted with a connected socket on a socket that is connection * oriented or connectionless. - * * Errno::ENETRESET - the connection has been broken due to the keep-alive + * * Errno::ENETRESET - the connection has been broken due to the keep-alive * activity detecting a failure while the operation was in progress. * * Errno::EOPNOTSUPP - MSG_OOB was specified, but +socket+ is not stream-style * such as type SOCK_STREAM. OOB data is not supported in the communication - * domain associated with +socket+, or +socket+ is unidirectional and + * domain associated with +socket+, or +socket+ is unidirectional and * supports only send operations - * * Errno::ESHUTDOWN - +socket+ has been shutdown. It is not possible to + * * Errno::ESHUTDOWN - +socket+ has been shutdown. It is not possible to * call _recvfrom_ on a socket after _shutdown_ has been invoked. - * * Errno::EWOULDBLOCK - +socket+ is marked as nonblocking and a call to + * * Errno::EWOULDBLOCK - +socket+ is marked as nonblocking and a call to * _recvfrom_ would block. * * Errno::EMSGSIZE - the message was too large to fit into the specified buffer * and was truncated. * * Errno::ETIMEDOUT - the connection has been dropped, because of a network * failure or because the system on the other end went down without * notice - * * Errno::ECONNRESET - the virtual circuit was reset by the remote side + * * Errno::ECONNRESET - the virtual circuit was reset by the remote side * executing a hard or abortive close. The application should close the * socket; it is no longer usable. On a UDP-datagram socket this error * indicates a previous send operation resulted in an ICMP Port Unreachable @@ -622,7 +622,7 @@ sock_recvfrom(int argc, VALUE *argv, VALUE sock) * call-seq: * socket.recvfrom_nonblock(maxlen) => [mesg, sender_addrinfo] * socket.recvfrom_nonblock(maxlen, flags) => [mesg, sender_addrinfo] - * + * * Receives up to _maxlen_ bytes from +socket+ using recvfrom(2) after * O_NONBLOCK is set for the underlying file descriptor. * _flags_ is zero or more of the +MSG_+ options. @@ -633,11 +633,11 @@ sock_recvfrom(int argc, VALUE *argv, VALUE sock) * When recvfrom(2) returns 0, Socket#recvfrom_nonblock returns * an empty string as data. * The meaning depends on the socket: EOF on TCP, empty packet on UDP, etc. - * + * * === Parameters * * +maxlen+ - the maximum number of bytes to receive from the socket - * * +flags+ - zero or more of the +MSG_+ options - * + * * +flags+ - zero or more of the +MSG_+ options + * * === Example * # In one file, start this first * require 'socket' @@ -657,7 +657,7 @@ sock_recvfrom(int argc, VALUE *argv, VALUE sock) * puts "I only received 20 bytes '#{data}'" * sleep 1 * socket.close - * + * * # In another file, start this second * require 'socket' * include Socket::Constants @@ -665,10 +665,10 @@ sock_recvfrom(int argc, VALUE *argv, VALUE sock) * sockaddr = Socket.sockaddr_in(2200, 'localhost') * socket.connect(sockaddr) * socket.puts "Watch this get cut short!" - * socket.close - * + * socket.close + * * Refer to Socket#recvfrom for the exceptions that may be thrown if the call - * to _recvfrom_nonblock_ fails. + * to _recvfrom_nonblock_ fails. * * Socket#recvfrom_nonblock may raise any error corresponding to recvfrom(2) failure, * including Errno::EWOULDBLOCK. @@ -717,13 +717,13 @@ sock_accept(VALUE sock) /* * call-seq: * socket.accept_nonblock => [client_socket, client_addrinfo] - * + * * Accepts an incoming connection using accept(2) after * O_NONBLOCK is set for the underlying file descriptor. * It returns an array containing the accepted socket * for the incoming connection, _client_socket_, * and an Addrinfo, _client_addrinfo_. - * + * * === Example * # In one script, start this first * require 'socket' @@ -741,19 +741,19 @@ sock_accept(VALUE sock) * puts "The client said, '#{client_socket.readline.chomp}'" * client_socket.puts "Hello from script one!" * socket.close - * + * * # In another script, start this second * require 'socket' * include Socket::Constants * socket = Socket.new(AF_INET, SOCK_STREAM, 0) * sockaddr = Socket.sockaddr_in(2200, 'localhost') * socket.connect(sockaddr) - * socket.puts "Hello from script 2." + * socket.puts "Hello from script 2." * puts "The server said, '#{socket.readline.chomp}'" * socket.close - * + * * Refer to Socket#accept for the exceptions that may be thrown if the call - * to _accept_nonblock_ fails. + * to _accept_nonblock_ fails. * * Socket#accept_nonblock may raise any error corresponding to accept(2) failure, * including Errno::EWOULDBLOCK. @@ -761,7 +761,7 @@ sock_accept(VALUE sock) * If the exception is Errno::EWOULDBLOCK, Errno::AGAIN, Errno::ECONNABORTED or Errno::EPROTO, * it is extended by IO::WaitReadable. * So IO::WaitReadable can be used to rescue the exceptions for retrying accept_nonblock. - * + * * === See * * Socket#accept */ @@ -781,11 +781,11 @@ sock_accept_nonblock(VALUE sock) /* * call-seq: * socket.sysaccept => [client_socket_fd, client_addrinfo] - * + * * Accepts an incoming connection returning an array containing the (integer) * file descriptor for the incoming connection, _client_socket_fd_, * and an Addrinfo, _client_addrinfo_. - * + * * === Example * # In one script, start this first * require 'socket' @@ -799,20 +799,20 @@ sock_accept_nonblock(VALUE sock) * puts "The client said, '#{client_socket.readline.chomp}'" * client_socket.puts "Hello from script one!" * socket.close - * + * * # In another script, start this second * require 'socket' * include Socket::Constants * socket = Socket.new( AF_INET, SOCK_STREAM, 0 ) * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' ) * socket.connect( sockaddr ) - * socket.puts "Hello from script 2." + * socket.puts "Hello from script 2." * puts "The server said, '#{socket.readline.chomp}'" * socket.close - * + * * Refer to Socket#accept for the exceptions that may be thrown if the call - * to _sysaccept_ fails. - * + * to _sysaccept_ fails. + * * === See * * Socket#accept */ @@ -944,7 +944,7 @@ sock_s_gethostbyname(VALUE obj, VALUE host) * * Obtains the host information for _address_. * - * p Socket.gethostbyaddr([221,186,184,68].pack("CCCC")) + * p Socket.gethostbyaddr([221,186,184,68].pack("CCCC")) * #=> ["carbon.ruby-lang.org", [], 2, "\xDD\xBA\xB8D"] */ static VALUE @@ -1009,7 +1009,7 @@ sock_s_gethostbyaddr(int argc, VALUE *argv) * Socket.getservbyname("smtp") #=> 25 * Socket.getservbyname("shell") #=> 514 * Socket.getservbyname("syslog", "udp") #=> 514 - */ + */ static VALUE sock_s_getservbyname(int argc, VALUE *argv) { @@ -1394,7 +1394,7 @@ sock_s_pack_sockaddr_un(VALUE self, VALUE path) * * _sockaddr_ should be a string or an addrinfo for AF_UNIX. * - * sockaddr = Socket.sockaddr_un("/tmp/sock") + * sockaddr = Socket.sockaddr_un("/tmp/sock") * p Socket.unpack_sockaddr_un(sockaddr) #=> "/tmp/sock" * */ @@ -1800,15 +1800,15 @@ socket_s_ip_address_list(VALUE self) * The constants defined under Socket::Constants are also defined under Socket. * For example, Socket::AF_INET is usable as well as Socket::Constants::AF_INET. * See Socket::Constants for the list of constants. - * + * * === Exception Handling * Ruby's implementation of +Socket+ causes an exception to be raised * based on the error generated by the system dependent implementation. * This is why the methods are documented in a way that isolate * Unix-based system exceptions from Windows based exceptions. If more - * information on particular exception is needed please refer to the + * information on particular exception is needed please refer to the * Unix manual pages or the Windows WinSock reference. - * + * * === Convenient methods * * Although the general way to create socket is Socket.new, @@ -1818,14 +1818,14 @@ socket_s_ip_address_list(VALUE self) * * TCP server socket: Socket.tcp_server_loop, TCPServer.open * * UNIX client socket: Socket.unix, UNIXSocket.open * * UNIX server socket: Socket.unix_server_loop, UNIXServer.open - * + * * === Documentation by * * Zach Dennis * * Sam Roberts - * * Programming Ruby from The Pragmatic Bookshelf. - * - * Much material in this documentation is taken with permission from - * Programming Ruby from The Pragmatic Bookshelf. + * * Programming Ruby from The Pragmatic Bookshelf. + * + * Much material in this documentation is taken with permission from + * Programming Ruby from The Pragmatic Bookshelf. */ void Init_socket() diff --git a/ext/socket/tcpserver.c b/ext/socket/tcpserver.c index faa5ad5007..282bd60b30 100644 --- a/ext/socket/tcpserver.c +++ b/ext/socket/tcpserver.c @@ -41,7 +41,7 @@ tcp_svr_init(int argc, VALUE *argv, VALUE sock) * s.puts Time.now * s.close * } - * + * */ static VALUE tcp_accept(VALUE sock) @@ -49,7 +49,7 @@ tcp_accept(VALUE sock) rb_io_t *fptr; struct sockaddr_storage from; socklen_t fromlen; - + GetOpenFile(sock, fptr); fromlen = sizeof(from); return rsock_s_accept(rb_cTCPSocket, fptr->fd, @@ -59,11 +59,11 @@ tcp_accept(VALUE sock) /* * call-seq: * tcpserver.accept_nonblock => tcpsocket - * + * * Accepts an incoming connection using accept(2) after * O_NONBLOCK is set for the underlying file descriptor. * It returns an accepted TCPSocket for the incoming connection. - * + * * === Example * require 'socket' * serv = TCPServer.new(2202) @@ -74,9 +74,9 @@ tcp_accept(VALUE sock) * retry * end * # sock is an accepted socket. - * + * * Refer to Socket#accept for the exceptions that may be thrown if the call - * to TCPServer#accept_nonblock fails. + * to TCPServer#accept_nonblock fails. * * TCPServer#accept_nonblock may raise any error corresponding to accept(2) failure, * including Errno::EWOULDBLOCK. @@ -84,7 +84,7 @@ tcp_accept(VALUE sock) * If the exception is Errno::EWOULDBLOCK, Errno::AGAIN, Errno::ECONNABORTED, Errno::EPROTO, * it is extended by IO::WaitReadable. * So IO::WaitReadable can be used to rescue the exceptions for retrying accept_nonblock. - * + * * === See * * TCPServer#accept * * Socket#accept @@ -110,7 +110,7 @@ tcp_accept_nonblock(VALUE sock) * * TCPServer.open("127.0.0.1", 28561) {|serv| * fd = serv.sysaccept - * s = IO.for_fd(fd) + * s = IO.for_fd(fd) * s.puts Time.now * s.close * } diff --git a/ext/socket/udpsocket.c b/ext/socket/udpsocket.c index e0ce443090..b278523eba 100644 --- a/ext/socket/udpsocket.c +++ b/ext/socket/udpsocket.c @@ -137,7 +137,7 @@ udp_bind(VALUE sock, VALUE host, VALUE port) * udpsocket.send(mesg, flags) => numbytes_sent * * Sends _mesg_ via _udpsocket_. - * + * * _flags_ should be a bitwise OR of Socket::MSG_* constants. * * u1 = UDPSocket.new @@ -195,7 +195,7 @@ udp_send(int argc, VALUE *argv, VALUE sock) * call-seq: * udpsocket.recvfrom_nonblock(maxlen) => [mesg, sender_inet_addr] * udpsocket.recvfrom_nonblock(maxlen, flags) => [mesg, sender_inet_addr] - * + * * Receives up to _maxlen_ bytes from +udpsocket+ using recvfrom(2) after * O_NONBLOCK is set for the underlying file descriptor. * If _maxlen_ is omitted, its default value is 65536. @@ -206,11 +206,11 @@ udp_send(int argc, VALUE *argv, VALUE sock) * When recvfrom(2) returns 0, * Socket#recvfrom_nonblock returns an empty string as data. * It means an empty packet. - * + * * === Parameters * * +maxlen+ - the number of bytes to receive from the socket - * * +flags+ - zero or more of the +MSG_+ options - * + * * +flags+ - zero or more of the +MSG_+ options + * * === Example * require 'socket' * s1 = UDPSocket.new @@ -228,7 +228,7 @@ udp_send(int argc, VALUE *argv, VALUE sock) * end * * Refer to Socket#recvfrom for the exceptions that may be thrown if the call - * to _recvfrom_nonblock_ fails. + * to _recvfrom_nonblock_ fails. * * UDPSocket#recvfrom_nonblock may raise any error corresponding to recvfrom(2) failure, * including Errno::EWOULDBLOCK. diff --git a/ext/socket/unixserver.c b/ext/socket/unixserver.c index ef830bc359..a6379eb364 100644 --- a/ext/socket/unixserver.c +++ b/ext/socket/unixserver.c @@ -60,11 +60,11 @@ unix_accept(VALUE sock) /* * call-seq: * unixserver.accept_nonblock => unixsocket - * + * * Accepts an incoming connection using accept(2) after * O_NONBLOCK is set for the underlying file descriptor. * It returns an accepted UNIXSocket for the incoming connection. - * + * * === Example * require 'socket' * serv = UNIXServer.new("/tmp/sock") @@ -75,9 +75,9 @@ unix_accept(VALUE sock) * retry * end * # sock is an accepted socket. - * + * * Refer to Socket#accept for the exceptions that may be thrown if the call - * to UNIXServer#accept_nonblock fails. + * to UNIXServer#accept_nonblock fails. * * UNIXServer#accept_nonblock may raise any error corresponding to accept(2) failure, * including Errno::EWOULDBLOCK. @@ -85,7 +85,7 @@ unix_accept(VALUE sock) * If the exception is Errno::EWOULDBLOCK, Errno::AGAIN, Errno::ECONNABORTED or Errno::EPROTO, * it is extended by IO::WaitReadable. * So IO::WaitReadable can be used to rescue the exceptions for retrying accept_nonblock. - * + * * === See * * UNIXServer#accept * * Socket#accept @@ -115,7 +115,7 @@ unix_accept_nonblock(VALUE sock) * fd = serv.sysaccept * s = IO.new(fd) * s.puts "hi" - * s.close + * s.close * p c.read #=> "hi\n" * } * } diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c index 4c3c5a7f7a..e0b081ad06 100644 --- a/ext/socket/unixsocket.c +++ b/ext/socket/unixsocket.c @@ -89,7 +89,7 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server) * * s = UNIXSocket.new("/tmp/sock") * s.send "hello", 0 - * + * */ static VALUE unix_init(VALUE sock, VALUE path) @@ -271,11 +271,11 @@ recvmsg_blocking(void *data) * unixsocket.recv_io([klass [, mode]]) => io * * UNIXServer.open("/tmp/sock") {|serv| - * UNIXSocket.open("/tmp/sock") {|c| + * UNIXSocket.open("/tmp/sock") {|c| * s = serv.accept * - * c.send_io STDOUT - * stdout = s.recv_io + * c.send_io STDOUT + * stdout = s.recv_io * * p STDOUT.fileno #=> 1 * p stdout.fileno #=> 7 diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index bc02d6fece..a554e7187a 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -323,7 +323,7 @@ strio_set_string(VALUE self, VALUE string) * call-seq: * strio.close -> nil * - * Closes strio. The *strio* is unavailable for any further data + * Closes strio. The *strio* is unavailable for any further data * operations; an +IOError+ is raised if such an attempt is made. */ static VALUE @@ -420,7 +420,7 @@ strio_closed_write(VALUE self) * strio.eof -> true or false * strio.eof? -> true or false * - * Returns true if *strio* is at end of file. The stringio must be + * Returns true if *strio* is at end of file. The stringio must be * opened for reading or an +IOError+ will be raised. */ static VALUE @@ -496,7 +496,7 @@ strio_set_lineno(VALUE self, VALUE lineno) * strio.reopen(other_StrIO) -> strio * strio.reopen(string, mode) -> strio * - * Reinitializes *strio* with the given other_StrIO or _string_ + * Reinitializes *strio* with the given other_StrIO or _string_ * and _mode_ (see StringIO#new). */ static VALUE @@ -971,7 +971,7 @@ strio_getline(int argc, VALUE *argv, struct StringIO *ptr) break; } } - str = strio_substr(ptr, s - RSTRING_PTR(ptr->string), e - s); + str = strio_substr(ptr, s - RSTRING_PTR(ptr->string), e - s); } else if (n == 1) { if ((p = memchr(s, RSTRING_PTR(str)[0], e - s)) != 0) { diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c index f7101823f5..2bf1a4faa2 100644 --- a/ext/strscan/strscan.c +++ b/ext/strscan/strscan.c @@ -29,7 +29,7 @@ struct strscanner /* the string to scan */ VALUE str; - + /* scan pointers */ long prev; /* legal only when MATCHED_P(s) */ long curr; /* always legal */ @@ -173,7 +173,7 @@ static VALUE strscan_s_allocate(VALUE klass) { struct strscanner *p; - + p = ALLOC(struct strscanner); MEMZERO(p, struct strscanner, 1); CLEAR_MATCH_STATUS(p); @@ -609,7 +609,7 @@ strscan_exist_p(VALUE self, VALUE re) * * s = StringScanner.new("Fri Dec 12 1975 14:39") * s.skip_until /12/ # -> 10 - * s # + * s # */ static VALUE strscan_skip_until(VALUE self, VALUE re) @@ -893,7 +893,7 @@ strscan_matched_p(VALUE self) /* * Returns the last matched string. - * + * * s = StringScanner.new('test string') * s.match?(/\w+/) # -> 4 * s.matched # -> "test" @@ -951,7 +951,7 @@ strscan_aref(VALUE self, VALUE idx) GET_SCANNER(self, p); if (! MATCHED_P(p)) return Qnil; - + i = NUM2LONG(idx); if (i < 0) i += p->regs.num_regs; @@ -1141,20 +1141,20 @@ inspect2(struct strscanner *p) /* * Document-class: StringScanner - * + * * StringScanner provides for lexical scanning operations on a String. Here is * an example of its usage: * * s = StringScanner.new('This is an example string') * s.eos? # -> false - * + * * p s.scan(/\w+/) # -> "This" * p s.scan(/\w+/) # -> nil * p s.scan(/\s+/) # -> " " * p s.scan(/\s+/) # -> nil * p s.scan(/\w+/) # -> "is" * s.eos? # -> false - * + * * p s.scan(/\s+/) # -> " " * p s.scan(/\w+/) # -> "an" * p s.scan(/\s+/) # -> " " @@ -1162,7 +1162,7 @@ inspect2(struct strscanner *p) * p s.scan(/\s+/) # -> " " * p s.scan(/\w+/) # -> "string" * s.eos? # -> true - * + * * p s.scan(/\s+/) # -> nil * p s.scan(/\w+/) # -> nil * @@ -1191,7 +1191,7 @@ inspect2(struct strscanner *p) * the string without actually scanning. You can access the most recent match. * You can modify the string being scanned, reset or terminate the scanner, * find out or change the position of the scan pointer, skip ahead, and so on. - * + * * === Advancing the Scan Pointer * * - #getch @@ -1222,7 +1222,7 @@ inspect2(struct strscanner *p) * - #reset * - #terminate * - #pos= - * + * * === Match Data * * - #matched @@ -1259,7 +1259,7 @@ Init_strscan() tmp = rb_str_new2("$Id$"); rb_obj_freeze(tmp); rb_const_set(StringScanner, rb_intern("Id"), tmp); - + rb_define_alloc_func(StringScanner, strscan_s_allocate); rb_define_private_method(StringScanner, "initialize", strscan_initialize, -1); rb_define_private_method(StringScanner, "initialize_copy", strscan_init_copy, 1); diff --git a/ext/syck/bytecode.c b/ext/syck/bytecode.c index 25ba678300..5cddb22831 100644 --- a/ext/syck/bytecode.c +++ b/ext/syck/bytecode.c @@ -98,7 +98,7 @@ char *get_inline( SyckParser *parser ); if ( reset == 1 ) YYPOS(0); \ return YAML_IOPEN; \ } \ - } + } /* * Nice little macro to ensure closure of levels. @@ -135,7 +135,7 @@ sycklex_bytecode_utf8( YYSTYPE *sycklval, SyckParser *parser ) { SyckLevel *lvl; syck_parser_ptr = parser; - if ( YYCURSOR == NULL ) + if ( YYCURSOR == NULL ) { syck_parser_read( parser ); } @@ -289,7 +289,7 @@ yy17: ++YYCURSOR; goto yy18; yy18: #line 288 "bytecode.re" -{ ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_str); +{ ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_str); goto Scalar; } #line 296 "" @@ -392,7 +392,7 @@ yy28: { CHK_NL(YYCURSOR); if ( lvl->status == syck_lvl_seq ) { - return YAML_INDENT; + return YAML_INDENT; } else if ( lvl->status == syck_lvl_map ) { @@ -434,12 +434,12 @@ yy33: FORCE_NEXT_TOKEN( '}' ); return '{'; } - + POP_LEVEL(); lvl = CURRENT_LEVEL(); if ( lvl->status == syck_lvl_seq ) { - FORCE_NEXT_TOKEN(YAML_INDENT); + FORCE_NEXT_TOKEN(YAML_INDENT); } else if ( lvl->status == syck_lvl_map ) { @@ -494,7 +494,7 @@ yy39: { complex = 1; } - ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_map); + ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_map); CHK_NL(YYCURSOR); if ( complex ) { @@ -990,7 +990,7 @@ yy70: ++YYCURSOR; yy71: #line 461 "bytecode.re" { YYCURSOR = tok; - goto ScalarEnd; + goto ScalarEnd; } #line 996 "" yy72: ++YYCURSOR; @@ -1001,7 +1001,7 @@ yy72: ++YYCURSOR; yy73: #line 469 "bytecode.re" { CAT(str, cap, idx, tok[0]); - goto Scalar2; + goto Scalar2; } #line 1007 "" yy74: ++YYCURSOR; @@ -1071,7 +1071,7 @@ yy84: #line 456 "bytecode.re" { CHK_NL(tok+1); CAT(str, cap, idx, '\0'); - goto Scalar2; + goto Scalar2; } #line 1077 "" } @@ -1139,7 +1139,7 @@ yy89: ++YYCURSOR; yy90: #line 515 "bytecode.re" { CAT(str, cap, idx, tok[0]); - goto Inline; + goto Inline; } #line 1145 "" yy91: ++YYCURSOR; diff --git a/ext/syck/emitter.c b/ext/syck/emitter.c index 18f2cdefef..eb01033653 100644 --- a/ext/syck/emitter.c +++ b/ext/syck/emitter.c @@ -4,9 +4,9 @@ * $Author$ * * Copyright (C) 2003 why the lucky stiff - * + * * All Base64 code from Ruby's pack.c. - * Ruby is Copyright (C) 1993-2007 Yukihiro Matsumoto + * Ruby is Copyright (C) 1993-2007 Yukihiro Matsumoto */ #include "ruby/ruby.h" @@ -17,7 +17,7 @@ #define DEFAULT_ANCHOR_FORMAT "id%03d" -const char hex_table[] = +const char hex_table[] = "0123456789ABCDEF"; static char b64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; @@ -131,7 +131,7 @@ syck_new_emitter(void) e->output_handler = NULL; e->lvl_idx = 0; e->lvl_capa = ALLOC_CT; - e->levels = S_ALLOC_N( SyckLevel, e->lvl_capa ); + e->levels = S_ALLOC_N( SyckLevel, e->lvl_capa ); syck_emitter_reset_levels( e ); e->bonus = NULL; return e; @@ -197,7 +197,7 @@ syck_emitter_pop_level( SyckEmitter *e ) free( e->levels[e->lvl_idx].domain ); } -void +void syck_emitter_add_level( SyckEmitter *e, int len, enum syck_level_status status ) { ASSERT( e != NULL ); @@ -289,7 +289,7 @@ syck_emitter_write( SyckEmitter *e, const char *str, long len ) { syck_emitter_clear( e ); } - + /* * Flush if at end of buffer */ @@ -360,7 +360,7 @@ syck_emit( SyckEmitter *e, st_data_t n ) int indent = 0; long x = 0; SyckLevel *lvl = syck_emitter_current_level( e ); - + /* * Determine headers. */ @@ -485,7 +485,7 @@ void syck_emit_tag( SyckEmitter *e, const char *tag, const char *ignore ) lvl->anctag = 1; } -/* +/* * Emit a newline and an appropriately spaced indent. */ void syck_emit_indent( SyckEmitter *e ) @@ -569,7 +569,7 @@ syck_scan_scalar( int req_width, const char *cursor, long len ) } else if ( len > 1 && cursor[len-2] == '\n' ) { flags |= SCAN_MANYNL_E; } - if ( + if ( ( len > 0 && ( cursor[0] == ' ' || cursor[0] == '\t' ) ) || ( len > 1 && ( cursor[len-1] == ' ' || cursor[len-1] == '\t' ) ) ) { @@ -594,7 +594,7 @@ syck_scan_scalar( int req_width, const char *cursor, long len ) flags |= SCAN_NEWLINE; if ( len - i >= 3 && strncmp( &cursor[i+1], "---", 3 ) == 0 ) flags |= SCAN_DOCSEP; - if ( cursor[i+1] == ' ' || cursor[i+1] == '\t' ) + if ( cursor[i+1] == ' ' || cursor[i+1] == '\t' ) flags |= SCAN_INDENTED; if ( req_width > 0 && i - start > req_width ) flags |= SCAN_WIDE; @@ -618,12 +618,12 @@ syck_scan_scalar( int req_width, const char *cursor, long len ) } /* remember, if plain collections get implemented, to add nb-plain-flow-char */ else if ( ( cursor[i] == ' ' && cursor[i+1] == '#' ) || - ( cursor[i] == ':' && + ( cursor[i] == ':' && ( cursor[i+1] == ' ' || cursor[i+1] == '\n' || i == len - 1 ) ) ) { flags |= SCAN_INDIC_C; } - else if ( cursor[i] == ',' && + else if ( cursor[i] == ',' && ( cursor[i+1] == ' ' || cursor[i+1] == '\n' || i == len - 1 ) ) { flags |= SCAN_FLOWMAP; @@ -647,12 +647,12 @@ void syck_emit_scalar( SyckEmitter *e, const char *tag, enum scalar_style force_ int scan = 0; const char *match_implicit; char *implicit; - + if ( str == NULL ) str = ""; /* No empty nulls as map keys */ - if ( len == 0 && ( parent->status == syck_lvl_map || parent->status == syck_lvl_imap ) && - parent->ncount % 2 == 1 && syck_tagcmp( tag, "tag:yaml.org,2002:null" ) == 0 ) + if ( len == 0 && ( parent->status == syck_lvl_map || parent->status == syck_lvl_imap ) && + parent->ncount % 2 == 1 && syck_tagcmp( tag, "tag:yaml.org,2002:null" ) == 0 ) { str = "~"; len = 1; @@ -668,8 +668,8 @@ void syck_emit_scalar( SyckEmitter *e, const char *tag, enum scalar_style force_ } else { /* complex key */ if ( parent->status == syck_lvl_map && parent->ncount % 2 == 1 && - ( !( tag == NULL || - ( implicit != NULL && syck_tagcmp( tag, implicit ) == 0 && e->explicit_typing == 0 ) ) ) ) + ( !( tag == NULL || + ( implicit != NULL && syck_tagcmp( tag, implicit ) == 0 && e->explicit_typing == 0 ) ) ) ) { syck_emitter_write( e, "? ", 2 ); parent->status = syck_lvl_mapx; diff --git a/ext/syck/gram.c b/ext/syck/gram.c index 615a594f61..8fe4e4f3b5 100644 --- a/ext/syck/gram.c +++ b/ext/syck/gram.c @@ -1216,7 +1216,7 @@ yyreduce: case 8: #line 76 "gram.y" - { + { syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion ); yyval.nodeData = yyvsp[0].nodeData; } @@ -1232,7 +1232,7 @@ yyreduce: case 10: #line 86 "gram.y" - { + { /* * _Anchors_: The language binding must keep a separate symbol table * for anchors. The actual ID in the symbol table is returned to the @@ -1266,7 +1266,7 @@ yyreduce: case 16: #line 114 "gram.y" - { + { if ( ((SyckParser *)parser)->implicit_typing == 1 ) { try_tag_implicit( yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion ); @@ -1277,7 +1277,7 @@ yyreduce: case 17: #line 122 "gram.y" - { + { syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion ); yyval.nodeData = yyvsp[0].nodeData; } @@ -1293,7 +1293,7 @@ yyreduce: case 19: #line 132 "gram.y" - { + { /* * _Anchors_: The language binding must keep a separate symbol table * for anchors. The actual ID in the symbol table is returned to the @@ -1305,7 +1305,7 @@ yyreduce: case 26: #line 165 "gram.y" - { + { syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion ); yyval.nodeData = yyvsp[0].nodeData; } @@ -1313,7 +1313,7 @@ yyreduce: case 27: #line 170 "gram.y" - { + { syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 ); yyval.nodeData = yyvsp[0].nodeData; } @@ -1321,7 +1321,7 @@ yyreduce: case 28: #line 175 "gram.y" - { + { if ( ((SyckParser *)parser)->implicit_typing == 1 ) { try_tag_implicit( yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion ); @@ -1332,7 +1332,7 @@ yyreduce: case 29: #line 183 "gram.y" - { + { yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData ); } break; @@ -1350,7 +1350,7 @@ yyreduce: case 31: #line 195 "gram.y" - { + { SyckNode *n = yyvsp[0].nodeData; if ( ((SyckParser *)parser)->taguri_expansion == 1 ) { @@ -1373,28 +1373,28 @@ yyreduce: case 39: #line 229 "gram.y" - { + { yyval.nodeData = yyvsp[-1].nodeData; } break; case 40: #line 233 "gram.y" - { + { yyval.nodeData = yyvsp[-1].nodeData; } break; case 41: #line 239 "gram.y" - { + { yyval.nodeId = syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ); } break; case 42: #line 245 "gram.y" - { + { syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion ); yyval.nodeData = yyvsp[0].nodeData; } @@ -1402,7 +1402,7 @@ yyreduce: case 43: #line 250 "gram.y" - { + { syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion ); yyval.nodeData = yyvsp[0].nodeData; } @@ -1410,7 +1410,7 @@ yyreduce: case 44: #line 255 "gram.y" - { + { syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, 0 ); yyval.nodeData = yyvsp[0].nodeData; } @@ -1418,7 +1418,7 @@ yyreduce: case 45: #line 260 "gram.y" - { + { syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 ); yyval.nodeData = yyvsp[0].nodeData; } @@ -1426,14 +1426,14 @@ yyreduce: case 46: #line 265 "gram.y" - { + { yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-2].name, yyvsp[0].nodeData ); } break; case 47: #line 269 "gram.y" - { + { yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData ); } break; @@ -1447,7 +1447,7 @@ yyreduce: case 49: #line 279 "gram.y" - { + { syck_seq_add( yyvsp[-2].nodeData, yyvsp[0].nodeId ); yyval.nodeData = yyvsp[-2].nodeData; } @@ -1455,21 +1455,21 @@ yyreduce: case 50: #line 284 "gram.y" - { + { yyval.nodeData = yyvsp[-1].nodeData; } break; case 51: #line 293 "gram.y" - { + { yyval.nodeData = yyvsp[-1].nodeData; } break; case 52: #line 297 "gram.y" - { + { yyval.nodeData = syck_alloc_seq(); } break; @@ -1483,7 +1483,7 @@ yyreduce: case 54: #line 307 "gram.y" - { + { syck_seq_add( yyvsp[-2].nodeData, syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) ); yyval.nodeData = yyvsp[-2].nodeData; } @@ -1491,7 +1491,7 @@ yyreduce: case 57: #line 321 "gram.y" - { + { apply_seq_in_map( (SyckParser *)parser, yyvsp[-1].nodeData ); yyval.nodeData = yyvsp[-1].nodeData; } @@ -1499,7 +1499,7 @@ yyreduce: case 58: #line 326 "gram.y" - { + { apply_seq_in_map( (SyckParser *)parser, yyvsp[-1].nodeData ); yyval.nodeData = yyvsp[-1].nodeData; } @@ -1507,7 +1507,7 @@ yyreduce: case 59: #line 333 "gram.y" - { + { syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion ); yyval.nodeData = yyvsp[0].nodeData; } @@ -1515,7 +1515,7 @@ yyreduce: case 60: #line 338 "gram.y" - { + { syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion ); yyval.nodeData = yyvsp[0].nodeData; } @@ -1523,7 +1523,7 @@ yyreduce: case 61: #line 343 "gram.y" - { + { syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, 0 ); yyval.nodeData = yyvsp[0].nodeData; } @@ -1531,7 +1531,7 @@ yyreduce: case 62: #line 348 "gram.y" - { + { syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 ); yyval.nodeData = yyvsp[0].nodeData; } @@ -1539,14 +1539,14 @@ yyreduce: case 63: #line 353 "gram.y" - { + { yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-2].name, yyvsp[0].nodeData ); } break; case 64: #line 357 "gram.y" - { + { yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData ); } break; @@ -1561,8 +1561,8 @@ yyreduce: case 68: #line 380 "gram.y" { - yyval.nodeData = syck_new_map( - syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ), + yyval.nodeData = syck_new_map( + syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ), syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) ); } break; @@ -1603,8 +1603,8 @@ yyreduce: case 73: #line 427 "gram.y" { - yyval.nodeData = syck_new_map( - syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ), + yyval.nodeData = syck_new_map( + syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ), syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) ); } break; @@ -1637,8 +1637,8 @@ yyreduce: #line 455 "gram.y" { NULL_NODE( parser, n ); - yyval.nodeData = syck_new_map( - syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ), + yyval.nodeData = syck_new_map( + syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ), syck_hdlr_add_node( (SyckParser *)parser, n ) ); } break; diff --git a/ext/syck/handler.c b/ext/syck/handler.c index d76a72e5cc..40f5ef27d0 100644 --- a/ext/syck/handler.c +++ b/ext/syck/handler.c @@ -9,12 +9,12 @@ #include "ruby/ruby.h" #include "syck.h" -SYMID +SYMID syck_hdlr_add_node( SyckParser *p, SyckNode *n ) { SYMID id; - if ( ! n->id ) + if ( ! n->id ) { n->id = (p->handler)( p, n ); } @@ -89,7 +89,7 @@ syck_hdlr_get_anchor( SyckParser *p, char *a ) if ( st_lookup( p->anchors, (st_data_t)a, (void *)&n ) ) { if ( n != (void *)1 ) - { + { S_FREE( a ); return n; } @@ -116,7 +116,7 @@ syck_hdlr_get_anchor( SyckParser *p, char *a ) if ( n->anchor ) { S_FREE( a ); - } + } else { n->anchor = a; @@ -165,7 +165,7 @@ syck_taguri( const char *domain, const char *type_id, int type_len ) return uri; } -int +int syck_try_implicit( SyckNode *n ) { return 1; diff --git a/ext/syck/node.c b/ext/syck/node.c index fb98f655cc..35c1f45150 100644 --- a/ext/syck/node.c +++ b/ext/syck/node.c @@ -59,7 +59,7 @@ syck_alloc_map(void) n = syck_alloc_node( syck_map_kind ); n->data.pairs = m; - + return n; } @@ -94,7 +94,7 @@ syck_alloc_str(void) n = syck_alloc_node( syck_str_kind ); n->data.str = s; - + return n; } @@ -128,7 +128,7 @@ syck_replace_str( SyckNode *n, char *str, enum scalar_style style ) void syck_replace_str2( SyckNode *n, char *str, long len, enum scalar_style style ) { - if ( n->data.str->ptr != NULL ) + if ( n->data.str->ptr != NULL ) { S_FREE( n->data.str->ptr ); n->data.str->ptr = NULL; @@ -201,7 +201,7 @@ syck_map_add( SyckNode *map, SYMID key, SYMID value ) ASSERT( map != NULL ); ASSERT( map->data.pairs != NULL ); - + m = map->data.pairs; idx = m->idx; m->idx += 1; @@ -226,7 +226,7 @@ syck_map_update( SyckNode *map1, SyckNode *map2 ) m1 = map1->data.pairs; m2 = map2->data.pairs; if ( m2->idx < 1 ) return; - + new_idx = m1->idx; new_idx += m2->idx; new_capa = m1->capa; @@ -242,8 +242,8 @@ syck_map_update( SyckNode *map1, SyckNode *map2 ) } for ( new_idx = 0; new_idx < m2->idx; m1->idx++, new_idx++ ) { - m1->keys[m1->idx] = m2->keys[new_idx]; - m1->values[m1->idx] = m2->values[new_idx]; + m1->keys[m1->idx] = m2->keys[new_idx]; + m1->values[m1->idx] = m2->values[new_idx]; } } @@ -324,7 +324,7 @@ syck_seq_add( SyckNode *arr, SYMID value ) ASSERT( arr != NULL ); ASSERT( arr->data.list != NULL ); - + s = arr->data.list; idx = s->idx; s->idx += 1; @@ -374,7 +374,7 @@ syck_free_members( SyckNode *n ) switch ( n->kind ) { case syck_str_kind: - if ( n->data.str != NULL ) + if ( n->data.str != NULL ) { S_FREE( n->data.str->ptr ); n->data.str->ptr = NULL; diff --git a/ext/syck/rubyext.c b/ext/syck/rubyext.c index da741d687c..af52976ff1 100644 --- a/ext/syck/rubyext.c +++ b/ext/syck/rubyext.c @@ -196,7 +196,7 @@ VALUE syck_get_hash_aref(VALUE hsh, VALUE key) { VALUE val = rb_hash_aref( hsh, key ); - if ( NIL_P( val ) ) + if ( NIL_P( val ) ) { val = rb_hash_new(); rb_hash_aset(hsh, key, val); @@ -537,11 +537,11 @@ yaml_org_handler( SyckNode *n, VALUE *ref ) obj = rb_funcall( cDefaultKey, s_new, 0 ); } else if ( n->data.str->style == scalar_plain && - n->data.str->len > 1 && + n->data.str->len > 1 && strncmp( n->data.str->ptr, ":", 1 ) == 0 ) { - obj = rb_funcall( oDefaultResolver, s_transfer, 2, - rb_str_new2( "tag:ruby.yaml.org,2002:sym" ), + obj = rb_funcall( oDefaultResolver, s_transfer, 2, + rb_str_new2( "tag:ruby.yaml.org,2002:sym" ), rb_str_new( n->data.str->ptr + 1, n->data.str->len - 1 ) ); } else if ( strcmp( type_id, "str" ) == 0 ) @@ -644,7 +644,7 @@ rb_syck_load_handler(SyckParser *p, SyckNode *n) } /* - * Create node, + * Create node, */ obj = rb_funcall( resolver, s_node_import, 1, Data_Wrap_Struct( cNode, NULL, NULL, n ) ); @@ -680,8 +680,8 @@ rb_syck_err_handler(SyckParser *p, const char *msg) rb_raise(rb_eArgError, "%s on line %d, col %"PRIdPTRDIFF": `%s'", msg, p->linect, - p->cursor - p->lineptr, - p->lineptr); + p->cursor - p->lineptr, + p->lineptr); } /* @@ -715,7 +715,7 @@ syck_set_model(VALUE p, VALUE input, VALUE model) if ( NIL_P( input ) ) { - input = rb_ivar_get( p, s_input ); + input = rb_ivar_get( p, s_input ); } if ( input == sym_bytecode ) { @@ -773,7 +773,7 @@ rb_syck_free_parser(SyckParser *p) * YAML::Syck::Parser.allocate */ VALUE syck_parser_s_alloc _((VALUE)); -VALUE +VALUE syck_parser_s_alloc(VALUE class) { VALUE pobj; @@ -880,7 +880,7 @@ syck_parser_load_documents(int argc, VALUE *argv, VALUE self) model = rb_hash_aref( rb_attr_get( self, s_options ), sym_model ); Data_Get_Struct(self, SyckParser, parser); syck_set_model( self, input, model ); - + bonus = (struct parser_xtra *)parser->bonus; bonus->taint = syck_parser_assign_io(parser, &port); bonus->resolver = rb_attr_get( self, s_resolver ); @@ -947,7 +947,7 @@ syck_resolver_use_types_at(VALUE self, VALUE hsh) } /* - * YAML::Syck::Resolver#detect_implicit + * YAML::Syck::Resolver#detect_implicit */ VALUE syck_resolver_detect_implicit(VALUE self, VALUE val) @@ -1075,7 +1075,7 @@ syck_const_find(VALUE const_name) VALUE syck_resolver_transfer(VALUE self, VALUE type, VALUE val) { - if (NIL_P(type) || RSTRING_LEN(StringValue(type)) == 0) + if (NIL_P(type) || RSTRING_LEN(StringValue(type)) == 0) { type = rb_funcall( self, s_detect_implicit, 1, val ); } @@ -1123,7 +1123,7 @@ syck_resolver_transfer(VALUE self, VALUE type, VALUE val) subclass = rb_funcall( target_class, s_tag_read_class, 1, subclass ); subclass_v = syck_const_find( subclass ); - if ( subclass_v != Qnil ) + if ( subclass_v != Qnil ) { subclass = subclass_v; } @@ -1177,7 +1177,7 @@ syck_resolver_transfer(VALUE self, VALUE type, VALUE val) rb_block_call( val, s_each, 0, 0, syck_set_ivars, obj ); } } - else + else { VALUE parts = rb_str_split( type, ":" ); VALUE scheme = rb_ary_shift( parts ); @@ -1219,7 +1219,7 @@ syck_resolver_tagurize(VALUE self, VALUE val) } /* - * YAML::Syck::DefaultResolver#detect_implicit + * YAML::Syck::DefaultResolver#detect_implicit */ VALUE syck_defaultresolver_detect_implicit(VALUE self, VALUE val) @@ -1278,19 +1278,19 @@ syck_genericresolver_node_import(VALUE self, VALUE node) if ( n->data.str->style == scalar_1quote ) { style = sym_1quote; - } + } else if ( n->data.str->style == scalar_2quote ) { style = sym_2quote; - } + } else if ( n->data.str->style == scalar_fold ) { style = sym_fold; - } + } else if ( n->data.str->style == scalar_literal ) { style = sym_literal; - } + } else if ( n->data.str->style == scalar_plain ) { style = sym_plain; @@ -1308,7 +1308,7 @@ syck_genericresolver_node_import(VALUE self, VALUE node) if ( n->data.list->style == seq_inline ) { style = sym_inline; - } + } obj = rb_funcall( cSeq, s_new, 3, t, v, style ); rb_iv_set(obj, "@kind", sym_seq); break; @@ -1322,7 +1322,7 @@ syck_genericresolver_node_import(VALUE self, VALUE node) if ( n->data.pairs->style == map_inline ) { style = sym_inline; - } + } obj = rb_funcall( cMap, s_new, 3, t, v, style ); rb_iv_set(obj, "@kind", sym_map); break; @@ -1347,8 +1347,8 @@ syck_badalias_initialize(VALUE self, VALUE val) VALUE syck_badalias_cmp(VALUE alias1, VALUE alias2) { - VALUE str1 = rb_ivar_get( alias1, s_name ); - VALUE str2 = rb_ivar_get( alias2, s_name ); + VALUE str1 = rb_ivar_get( alias1, s_name ); + VALUE str2 = rb_ivar_get( alias2, s_name ); VALUE val = rb_funcall( str1, s_cmp, 1, str2 ); return val; } @@ -1459,23 +1459,23 @@ syck_scalar_style_set(VALUE self, VALUE style) if ( NIL_P( style ) ) { node->data.str->style = scalar_none; - } + } else if ( style == sym_1quote ) { node->data.str->style = scalar_1quote; - } + } else if ( style == sym_2quote ) { node->data.str->style = scalar_2quote; - } + } else if ( style == sym_fold ) { node->data.str->style = scalar_fold; - } + } else if ( style == sym_literal ) { node->data.str->style = scalar_literal; - } + } else if ( style == sym_plain ) { node->data.str->style = scalar_plain; @@ -1587,7 +1587,7 @@ syck_seq_style_set(VALUE self, VALUE style) if ( style == sym_inline ) { node->data.list->style = seq_inline; - } + } else { node->data.list->style = seq_none; @@ -1709,7 +1709,7 @@ syck_map_style_set(VALUE self, VALUE style) if ( style == sym_inline ) { node->data.pairs->style = map_inline; - } + } else { node->data.pairs->style = map_none; @@ -1865,7 +1865,7 @@ rb_syck_emitter_handler(SyckEmitter *e, st_data_t data) /* * Handle output from the emitter */ -void +void rb_syck_output_handler(SyckEmitter * emitter, char *str, long len) { struct emitter_xtra *bonus = (struct emitter_xtra *)emitter->bonus; @@ -1921,7 +1921,7 @@ rb_syck_free_emitter(SyckEmitter *e) * YAML::Syck::Emitter.allocate */ VALUE syck_emitter_s_alloc _((VALUE)); -VALUE +VALUE syck_emitter_s_alloc(VALUE class) { VALUE pobj; @@ -1982,7 +1982,7 @@ syck_emitter_reset(int argc, VALUE *argv, VALUE self) Check_Type(options, T_HASH); rb_ivar_set(self, s_options, options); } - + emitter->headless = 0; rb_ivar_set(self, s_level, INT2FIX(0)); rb_ivar_set(self, s_resolver, Qnil); @@ -2018,14 +2018,14 @@ syck_emitter_emit(int argc, VALUE *argv, VALUE self) /* Second pass, build emitted string */ level -= 1; rb_ivar_set(self, s_level, INT2FIX(level)); - if ( level == 0 ) + if ( level == 0 ) { syck_emit(emitter, (st_data_t)symple); syck_emitter_flush(emitter, 0); return bonus->port; } - + return symple; } diff --git a/ext/syck/syck.c b/ext/syck/syck.c index e0fc2bc244..6ae48a75be 100644 --- a/ext/syck/syck.c +++ b/ext/syck/syck.c @@ -17,7 +17,7 @@ void syck_parser_pop_level( SyckParser * ); /* * Custom assert */ -void +void syck_assert( const char *file_name, unsigned line_num, const char *expr ) { fflush( NULL ); @@ -160,7 +160,7 @@ syck_new_parser(void) p = S_ALLOC( SyckParser ); S_MEMZERO( p, SyckParser, 1 ); p->lvl_capa = ALLOC_CT; - p->levels = S_ALLOC_N( SyckLevel, p->lvl_capa ); + p->levels = S_ALLOC_N( SyckLevel, p->lvl_capa ); p->input_type = syck_yaml_utf8; p->io_type = syck_io_str; p->io.str = NULL; @@ -378,7 +378,7 @@ syck_parser_pop_level( SyckParser *p ) free( p->levels[p->lvl_idx].domain ); } -void +void syck_parser_add_level( SyckParser *p, int len, enum syck_level_status status ) { ASSERT( p != NULL ); @@ -403,7 +403,7 @@ free_any_io( SyckParser *p ) switch ( p->io_type ) { case syck_io_str: - if ( p->io.str != NULL ) + if ( p->io.str != NULL ) { S_FREE( p->io.str ); p->io.str = NULL; @@ -411,7 +411,7 @@ free_any_io( SyckParser *p ) break; case syck_io_file: - if ( p->io.file != NULL ) + if ( p->io.file != NULL ) { S_FREE( p->io.file ); p->io.file = NULL; @@ -516,7 +516,7 @@ syck_parse( SyckParser *p ) void syck_default_error_handler( SyckParser *p, const char *msg ) { - printf( "Error at [Line %d, Col %"PRIdPTRDIFF"]: %s\n", + printf( "Error at [Line %d, Col %"PRIdPTRDIFF"]: %s\n", p->linect, p->cursor - p->lineptr, msg ); diff --git a/ext/syck/syck.h b/ext/syck/syck.h index 488d27e54a..2cf81a8b9a 100644 --- a/ext/syck/syck.h +++ b/ext/syck/syck.h @@ -153,7 +153,7 @@ typedef struct _syck_level SyckLevel; typedef SYMID (*SyckNodeHandler)(SyckParser *, SyckNode *); typedef void (*SyckErrorHandler)(SyckParser *, const char *); typedef SyckNode * (*SyckBadAnchorHandler)(SyckParser *, char *); -typedef long (*SyckIoFileRead)(char *, SyckIoFile *, long, long); +typedef long (*SyckIoFileRead)(char *, SyckIoFile *, long, long); typedef long (*SyckIoStrRead)(char *, SyckIoStr *, long, long); enum syck_io_type { @@ -205,7 +205,7 @@ struct _syck_str { struct _syck_level { /* Indent */ int spaces; - /* Counts nodes emitted at this level, useful for parsing + /* Counts nodes emitted at this level, useful for parsing * keys and pairs in bytecode */ int ncount; /* Does node have anchors or tags? */ @@ -265,8 +265,8 @@ struct _syck_parser { typedef struct _syck_emitter SyckEmitter; typedef struct _syck_emitter_node SyckEmitterNode; -typedef void (*SyckOutputHandler)(SyckEmitter *, char *, long); -typedef void (*SyckEmitterHandler)(SyckEmitter *, st_data_t); +typedef void (*SyckOutputHandler)(SyckEmitter *, char *, long); +typedef void (*SyckEmitterHandler)(SyckEmitter *, st_data_t); enum doc_stage { doc_open, diff --git a/ext/syck/token.c b/ext/syck/token.c index 1b26e66bdb..1521c5489d 100644 --- a/ext/syck/token.c +++ b/ext/syck/token.c @@ -70,7 +70,7 @@ if ( reset == 1 ) YYPOS(0); \ return YAML_IOPEN; \ } \ - } + } /* * Nice little macro to ensure closure of levels. @@ -278,7 +278,7 @@ sycklex_yaml_utf8( YYSTYPE *sycklval, SyckParser *parser ) { int doc_level = 0; syck_parser_ptr = parser; - if ( YYCURSOR == NULL ) + if ( YYCURSOR == NULL ) { syck_parser_read( parser ); } @@ -331,7 +331,7 @@ yy2: yyaccept = 0; yy3: #line 374 "token.re" { YYPOS(0); - goto Document; + goto Document; } #line 337 "" yy4: yyaccept = 0; @@ -344,7 +344,7 @@ yy5: ++YYCURSOR; goto yy6; yy6: #line 356 "token.re" -{ eat_comments( parser ); +{ eat_comments( parser ); goto Header; } #line 351 "" @@ -355,7 +355,7 @@ yy8: { SyckLevel *lvl = CURRENT_LEVEL(); ENSURE_YAML_IEND(lvl, -1); YYPOS(0); - return 0; + return 0; } #line 361 "" yy9: yyaccept = 1; @@ -364,7 +364,7 @@ yy9: yyaccept = 1; yy10: #line 366 "token.re" { GOBBLE_UP_YAML_INDENT( doc_level, YYTOKEN ); - goto Header; + goto Header; } #line 370 "" yy11: yych = *++YYCURSOR; @@ -432,15 +432,15 @@ yy24: { SyckLevel *lvl = CURRENT_LEVEL(); if ( lvl->status == syck_lvl_header ) { - goto Header; + goto Header; } else { ENSURE_YAML_IEND(lvl, -1); YYPOS(0); - return 0; + return 0; } - return 0; + return 0; } #line 446 "" yy25: ++YYCURSOR; @@ -476,13 +476,13 @@ yy31: if ( lvl->status == syck_lvl_header ) { YYPOS(3); - goto Directive; + goto Directive; } else { ENSURE_YAML_IEND(lvl, -1); YYPOS(0); - return 0; + return 0; } } #line 489 "" @@ -583,7 +583,7 @@ yy39: ++YYCURSOR; yy40: #line 497 "token.re" { ENSURE_YAML_IOPEN(lvl, doc_level, 1); - goto Plain; + goto Plain; } #line 589 "" yy41: ++YYCURSOR; @@ -593,7 +593,7 @@ yy42: { ENSURE_YAML_IOPEN(lvl, doc_level, 1); lvl = CURRENT_LEVEL(); ADD_LEVEL(lvl->spaces + 1, syck_lvl_iseq); - return YYTOKEN[0]; + return YYTOKEN[0]; } #line 599 "" yy43: ++YYCURSOR; @@ -603,7 +603,7 @@ yy44: { ENSURE_YAML_IOPEN(lvl, doc_level, 1); lvl = CURRENT_LEVEL(); ADD_LEVEL(lvl->spaces + 1, syck_lvl_imap); - return YYTOKEN[0]; + return YYTOKEN[0]; } #line 609 "" yy45: ++YYCURSOR; @@ -611,7 +611,7 @@ yy45: ++YYCURSOR; yy46: #line 432 "token.re" { POP_LEVEL(); - return YYTOKEN[0]; + return YYTOKEN[0]; } #line 617 "" yy47: yyaccept = 1; @@ -800,7 +800,7 @@ yy58: ++YYCURSOR; goto yy59; yy59: #line 486 "token.re" -{ eat_comments( parser ); +{ eat_comments( parser ); goto Document; } #line 807 "" @@ -817,7 +817,7 @@ yy63: #line 492 "token.re" { ENSURE_YAML_IEND(lvl, -1); YYPOS(0); - return 0; + return 0; } #line 823 "" yy64: yych = *++YYCURSOR; @@ -859,11 +859,11 @@ yy70: ++YYCURSOR; goto yy71; yy71: #line 479 "token.re" -{ if ( is_newline( YYCURSOR - 1 ) ) +{ if ( is_newline( YYCURSOR - 1 ) ) { YYCURSOR--; } - goto ScalarBlock; + goto ScalarBlock; } #line 869 "" yy72: ++YYCURSOR; @@ -1041,14 +1041,14 @@ yy82: FORCE_NEXT_TOKEN(YAML_IOPEN); if ( *YYCURSOR == '#' || is_newline( YYCURSOR ) || is_newline( YYCURSOR - 1 ) ) { - YYCURSOR--; + YYCURSOR--; ADD_LEVEL((YYTOKEN + 1) - YYLINEPTR, syck_lvl_seq); } else /* spaces followed by content uses the space as indentation */ { ADD_LEVEL(YYCURSOR - YYLINEPTR, syck_lvl_seq); } - return YYTOKEN[0]; + return YYTOKEN[0]; } #line 1054 "" yy83: ++YYCURSOR; @@ -1069,8 +1069,8 @@ yy86: ++YYCURSOR; yy87: #line 436 "token.re" { if ( *YYTOKEN == ':' && lvl->status != syck_lvl_imap ) lvl->status = syck_lvl_map; - YYPOS(1); - return YYTOKEN[0]; + YYPOS(1); + return YYTOKEN[0]; } #line 1076 "" yy88: ++YYCURSOR; @@ -1499,7 +1499,7 @@ Plain: plvl = CURRENT_LEVEL(); GET_TRUE_YAML_INDENT(parentIndent); -Plain2: +Plain2: YYTOKEN = YYCURSOR; Plain3: @@ -1564,7 +1564,7 @@ yy113: } } - goto Plain2; + goto Plain2; } #line 1570 "" yy114: ++YYCURSOR; @@ -1631,13 +1631,13 @@ yy122: ++YYCURSOR; } yy123: #line 617 "token.re" -{ if ( qidx == 0 ) +{ if ( qidx == 0 ) { goto Plain2; } else { - goto Plain3; + goto Plain3; } } #line 1644 "" @@ -1655,7 +1655,7 @@ yy128: ++YYCURSOR; goto yy129; yy129: #line 611 "token.re" -{ eat_comments( parser ); +{ eat_comments( parser ); RETURN_IMPLICIT(); } #line 1662 "" @@ -1801,7 +1801,7 @@ yy147: } } - goto SingleQuote2; + goto SingleQuote2; } #line 1807 "" yy148: ++YYCURSOR; @@ -1811,8 +1811,8 @@ yy148: ++YYCURSOR; } yy149: #line 712 "token.re" -{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1)); - goto SingleQuote2; +{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1)); + goto SingleQuote2; } #line 1818 "" yy150: ++YYCURSOR; @@ -1842,7 +1842,7 @@ yy151: n->data.str->len = qidx; n->data.str->style = scalar_1quote; sycklval->nodeData = n; - return YAML_PLAIN; + return YAML_PLAIN; } #line 1848 "" yy152: yych = *++YYCURSOR; @@ -1854,7 +1854,7 @@ yy154: ++YYCURSOR; yy155: #line 685 "token.re" { QUOTECAT(qstr, qcapa, qidx, '\''); - goto SingleQuote2; + goto SingleQuote2; } #line 1860 "" yy156: yyaccept = 0; @@ -1960,7 +1960,7 @@ yy163: } keep_nl = 1; - goto DoubleQuote2; + goto DoubleQuote2; } #line 1966 "" yy164: ++YYCURSOR; @@ -1970,8 +1970,8 @@ yy164: ++YYCURSOR; } yy165: #line 820 "token.re" -{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1)); - goto DoubleQuote2; +{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1)); + goto DoubleQuote2; } #line 1977 "" yy166: yyaccept = 1; @@ -2010,7 +2010,7 @@ yy168: n->data.str->len = qidx; n->data.str->style = scalar_2quote; sycklval->nodeData = n; - return YAML_PLAIN; + return YAML_PLAIN; } #line 2016 "" yy169: yych = *++YYCURSOR; @@ -2038,7 +2038,7 @@ yy175: #line 792 "token.re" { keep_nl = 0; YYCURSOR--; - goto DoubleQuote2; + goto DoubleQuote2; } #line 2044 "" yy176: yych = *++YYCURSOR; @@ -2076,7 +2076,7 @@ yy179: #line 778 "token.re" { char ch = *( YYCURSOR - 1 ); QUOTECAT(qstr, qcapa, qidx, escape_seq( ch )); - goto DoubleQuote2; + goto DoubleQuote2; } #line 2082 "" yy180: yych = *++YYCURSOR; @@ -2113,7 +2113,7 @@ yy182: ch = strtol( chr_text, NULL, 16 ); free( chr_text ); QUOTECAT(qstr, qcapa, qidx, ch); - goto DoubleQuote2; + goto DoubleQuote2; } #line 2119 "" yy183: yyaccept = 0; @@ -2216,7 +2216,7 @@ yy189: } } - return YAML_TRANSFER; + return YAML_TRANSFER; } #line 2222 "" yy190: yych = *++YYCURSOR; @@ -2230,7 +2230,7 @@ yy192: ++YYCURSOR; } yy193: #line 905 "token.re" -{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1)); +{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1)); goto TransferMethod2; } #line 2237 "" @@ -2505,7 +2505,7 @@ yy214: #line 1046 "token.re" { YYCURSOR--; POP_LEVEL(); - RETURN_YAML_BLOCK(); + RETURN_YAML_BLOCK(); } #line 2511 "" yy215: yyaccept = 1; @@ -2636,7 +2636,7 @@ yy233: ++YYCURSOR; } yy234: #line 1095 "token.re" -{ goto Comment; +{ goto Comment; } #line 2642 "" yy235: yych = *++YYCURSOR; @@ -2699,20 +2699,20 @@ newline_len( char *ptr ) { if ( *ptr == '\n' ) return 1; - + if ( *ptr == '\r' && *( ptr + 1 ) == '\n' ) return 2; return 0; } -int +int syckwrap() { return 1; } -void +void syckerror( const char *msg ) { if ( syck_parser_ptr->error_handler == NULL ) diff --git a/ext/syck/yaml2byte.c b/ext/syck/yaml2byte.c index 1b1ce26c49..390deb6c0d 100644 --- a/ext/syck/yaml2byte.c +++ b/ext/syck/yaml2byte.c @@ -7,7 +7,7 @@ * * WARNING WARNING WARNING --- THIS IS *NOT JUST* PLAYING * ANYMORE! -- WHY HAS EMBRACED THIS AS THE REAL THING! - */ + */ #include "ruby/ruby.h" #include #include @@ -35,7 +35,7 @@ typedef struct { int printed; } bytestring_t; bytestring_t *bytestring_alloc(void) { - bytestring_t *ret; + bytestring_t *ret; /*TRACE0("bytestring_alloc()");*/ ret = S_ALLOC(bytestring_t); ret->hash = HASH; @@ -46,8 +46,8 @@ bytestring_t *bytestring_alloc(void) { ret->printed = 0; return ret; } -void bytestring_append(bytestring_t *str, char code, - char *start, char *finish) +void bytestring_append(bytestring_t *str, char code, + char *start, char *finish) { long grow; long length = 2; /* CODE + LF */ @@ -62,14 +62,14 @@ void bytestring_append(bytestring_t *str, char code, if(length > str->remaining) { grow = (length - str->remaining) + CHUNKSIZE; str->remaining += grow; - str->length += grow; + str->length += grow; str->buffer = S_REALLOC_N( str->buffer, char, str->length + 1 ); assert(str->buffer); } curr = str->buffer + (str->length - str->remaining); *curr = code; curr += 1; - if(start) + if(start) while(start < finish) *curr ++ = *start ++; *curr = '\n'; @@ -99,7 +99,7 @@ void bytestring_extend(bytestring_t *str, bytestring_t *ext) if(length > str->remaining) { grow = (length - str->remaining) + CHUNKSIZE; str->remaining += grow; - str->length += grow; + str->length += grow; str->buffer = S_REALLOC_N( str->buffer, char, str->length + 1 ); } curr = str->buffer + (str->length - str->remaining); @@ -176,7 +176,7 @@ syck_yaml2byte_handler(p, n) { bytestring_append(val,YAMLBYTE_NULLCHAR,NULL,NULL); } - else + else { assert("oops"); } diff --git a/ext/syck/yamlbyte.h b/ext/syck/yamlbyte.h index 0fe4e7b576..a12a36d79b 100644 --- a/ext/syck/yamlbyte.h +++ b/ext/syck/yamlbyte.h @@ -83,11 +83,11 @@ typedef enum { YAMLBYTE_E_OTHER = '?', /* some other error condition */ YAMLBYTE_E_PARSE = 'P', /* parse error, check bytecodes */ } yamlbyte_result_t; - -typedef const yamlbyte_char_t *yamlbyte_buff_t; -/* - * The "Instruction" API +typedef const yamlbyte_char_t *yamlbyte_buff_t; + +/* + * The "Instruction" API */ typedef struct yaml_instruction { @@ -96,7 +96,7 @@ typedef struct yaml_instruction { yamlbyte_buff_t finish; /* open range, *finish is _not_ part */ } *yamlbyte_inst_t; -/* producer pushes the instruction with one bytecode event to the +/* producer pushes the instruction with one bytecode event to the * consumer; if the consumer's result is not YAMLBYTE_OK, then * the producer should stop */ typedef @@ -110,14 +110,14 @@ typedef * case the instruction (and is buffer) are owned by the producer and * will remain valid till the pull function is called once again; * if the instruction is NULL, then there are no more results; and - * it is important to call the pull function till it returns NULL so + * it is important to call the pull function till it returns NULL so * that the producer can clean up its memory allocations */ -typedef +typedef yamlbyte_result_t (*yamlbyte_pull_t)( yamlbyte_producer_t self, yamlbyte_inst_t *inst /* to be filled in by the producer */ - ); + ); /* * Buffer based API @@ -139,12 +139,12 @@ typedef * is set to NULL, then there are no more results; it is important * to call the pull function till it returns NULL so that the * producer can clean up its memory allocations */ -typedef +typedef yamlbyte_result_t (*yamlbyte_pullbuff_t)( yamlbyte_producer_t self, yamlbyte_buff_t *buff /* to be filled in by the producer */ - ); + ); /* convert a pull interface to a push interface; the reverse process * requires threads and thus is language dependent */ diff --git a/ext/syslog/syslog.c b/ext/syslog/syslog.c index 1bd82bf7d0..8eec81e4f8 100644 --- a/ext/syslog/syslog.c +++ b/ext/syslog/syslog.c @@ -1,4 +1,4 @@ -/* +/* * UNIX Syslog extension for Ruby * Amos Gouaux, University of Texas at Dallas * @@ -65,7 +65,7 @@ static VALUE mSyslog_open(int argc, VALUE *argv, VALUE self) rb_scan_args(argc, argv, "03", &ident, &opt, &fac); if (NIL_P(ident)) { - ident = rb_gv_get("$0"); + ident = rb_gv_get("$0"); } SafeStringValue(ident); syslog_ident = strdup(RSTRING_PTR(ident)); @@ -232,7 +232,7 @@ static VALUE mSyslogConstants_LOG_UPTO(VALUE klass, VALUE pri) void Init_syslog() { mSyslog = rb_define_module("Syslog"); - + mSyslogConstants = rb_define_module_under(mSyslog, "Constants"); rb_include_module(mSyslog, mSyslogConstants); diff --git a/ext/tk/stubs.c b/ext/tk/stubs.c index 762fe5ea8d..712c5ced9f 100644 --- a/ext/tk/stubs.c +++ b/ext/tk/stubs.c @@ -46,7 +46,7 @@ _nativethread_consistency_check(ip) return; } - /* If the variable "tcl_platform(threaded)" exists, + /* If the variable "tcl_platform(threaded)" exists, then the Tcl interpreter was compiled with threads enabled. */ if (Tcl_GetVar2(ip, "tcl_platform", "threaded", TCL_GLOBAL_ONLY) != (char*)NULL) { #ifdef HAVE_NATIVETHREAD @@ -195,13 +195,13 @@ ruby_open_tcltk_dll(appname) return( ruby_open_tcl_dll(appname) || ruby_open_tk_dll() ); } -int +int tcl_stubs_init_p() { return(tclStubsPtr != (TclStubs*)NULL); } -int +int tk_stubs_init_p() { return(tkStubsPtr != (TkStubs*)NULL); @@ -246,14 +246,14 @@ ruby_tcl_create_ip_and_stubs_init(st) } } - p_Tcl_CreateInterp + p_Tcl_CreateInterp = (Tcl_Interp *(*)())DL_SYM(tcl_dll, "Tcl_CreateInterp"); if (!p_Tcl_CreateInterp) { if (st) *st = NO_CreateInterp; return (Tcl_Interp*)NULL; } - p_Tcl_DeleteInterp + p_Tcl_DeleteInterp = (Tcl_Interp *(*)())DL_SYM(tcl_dll, "Tcl_DeleteInterp"); if (!p_Tcl_DeleteInterp) { if (st) *st = NO_DeleteInterp; @@ -444,7 +444,7 @@ ruby_open_tcl_dll(appname) return TCLTK_STUBS_OK; } -int +int ruby_open_tk_dll() { if (!open_tcl_dll) { @@ -455,7 +455,7 @@ ruby_open_tk_dll() return TCLTK_STUBS_OK; } -int +int #ifdef HAVE_PROTOTYPES ruby_open_tcltk_dll(char *appname) #else @@ -466,13 +466,13 @@ ruby_open_tcltk_dll(appname) return( ruby_open_tcl_dll(appname) || ruby_open_tk_dll() ); } -int +int tcl_stubs_init_p() { return 1; } -int +int tk_stubs_init_p() { return call_tk_stubs_init; @@ -505,13 +505,13 @@ ruby_tcl_create_ip_and_stubs_init(st) return tcl_ip; } -int +int ruby_tcl_stubs_init() { return TCLTK_STUBS_OK; } -int +int #ifdef HAVE_PROTOTYPES ruby_tk_stubs_init(Tcl_Interp *tcl_ip) #else @@ -559,7 +559,7 @@ ruby_tk_stubs_safeinit(tcl_ip) #endif } -int +int ruby_tcltk_stubs() { /* Tcl_FindExecutable(RSTRING_PTR(rb_argv0)); */ diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c index c14ee1e750..253805009e 100644 --- a/ext/tk/tcltklib.c +++ b/ext/tk/tcltklib.c @@ -93,9 +93,9 @@ set_tcltk_version() { if (tcltk_version.major) return; - Tcl_GetVersion(&(tcltk_version.major), - &(tcltk_version.minor), - &(tcltk_version.patchlevel), + Tcl_GetVersion(&(tcltk_version.major), + &(tcltk_version.minor), + &(tcltk_version.patchlevel), &(tcltk_version.type)); } @@ -412,7 +412,7 @@ struct call_queue { VALUE thread; }; -void +void invoke_queue_mark(struct invoke_queue *q) { rb_gc_mark(q->interp); @@ -420,7 +420,7 @@ invoke_queue_mark(struct invoke_queue *q) rb_gc_mark(q->thread); } -void +void eval_queue_mark(struct eval_queue *q) { rb_gc_mark(q->interp); @@ -428,7 +428,7 @@ eval_queue_mark(struct eval_queue *q) rb_gc_mark(q->thread); } -void +void call_queue_mark(struct call_queue *q) { int i; @@ -455,7 +455,7 @@ static VALUE watchdog_thread; Tcl_Interp *current_interp; -/* thread control strategy */ +/* thread control strategy */ /* multi-tk works with the following settings only ??? : CONTROL_BY_STATUS_OF_RB_THREAD_WAITING_FOR_VALUE 1 : USE_TOGGLE_WINDOW_MODE_FOR_IDLE 0 @@ -475,11 +475,11 @@ Tcl_Interp *current_interp; static int have_rb_thread_waiting_for_value = 0; #endif -/* - * 'event_loop_max' is a maximum events which the eventloop processes in one - * term of thread scheduling. 'no_event_tick' is the count-up value when - * there are no event for processing. - * 'timer_tick' is a limit of one term of thread scheduling. +/* + * 'event_loop_max' is a maximum events which the eventloop processes in one + * term of thread scheduling. 'no_event_tick' is the count-up value when + * there are no event for processing. + * 'timer_tick' is a limit of one term of thread scheduling. * If 'timer_tick' == 0, then not use the timer for thread scheduling. */ #ifdef RUBY_USE_NATIVE_THREAD @@ -882,18 +882,18 @@ tcltkip_init_tk(interp) case TCLTK_STUBS_OK: break; case NO_Tk_Init: - return rb_exc_new2(rb_eLoadError, + return rb_exc_new2(rb_eLoadError, "tcltklib: can't find Tk_SafeInit()"); case FAIL_Tk_Init: - return create_ip_exc(interp, rb_eRuntimeError, - "tcltklib: fail to Tk_SafeInit(). %s", + return create_ip_exc(interp, rb_eRuntimeError, + "tcltklib: fail to Tk_SafeInit(). %s", Tcl_GetStringResult(ptr->ip)); case FAIL_Tk_InitStubs: - return create_ip_exc(interp, rb_eRuntimeError, - "tcltklib: fail to Tk_InitStubs(). %s", + return create_ip_exc(interp, rb_eRuntimeError, + "tcltklib: fail to Tk_InitStubs(). %s", Tcl_GetStringResult(ptr->ip)); default: - return create_ip_exc(interp, rb_eRuntimeError, + return create_ip_exc(interp, rb_eRuntimeError, "tcltklib: unknown error(%d) on ruby_tk_stubs_safeinit", st); } } else { @@ -903,18 +903,18 @@ tcltkip_init_tk(interp) case TCLTK_STUBS_OK: break; case NO_Tk_Init: - return rb_exc_new2(rb_eLoadError, + return rb_exc_new2(rb_eLoadError, "tcltklib: can't find Tk_Init()"); case FAIL_Tk_Init: - return create_ip_exc(interp, rb_eRuntimeError, - "tcltklib: fail to Tk_Init(). %s", + return create_ip_exc(interp, rb_eRuntimeError, + "tcltklib: fail to Tk_Init(). %s", Tcl_GetStringResult(ptr->ip)); case FAIL_Tk_InitStubs: - return create_ip_exc(interp, rb_eRuntimeError, - "tcltklib: fail to Tk_InitStubs(). %s", + return create_ip_exc(interp, rb_eRuntimeError, + "tcltklib: fail to Tk_InitStubs(). %s", Tcl_GetStringResult(ptr->ip)); default: - return create_ip_exc(interp, rb_eRuntimeError, + return create_ip_exc(interp, rb_eRuntimeError, "tcltklib: unknown error(%d) on ruby_tk_stubs_init", st); } } @@ -947,7 +947,7 @@ pending_exception_check0() if (!NIL_P(exc) && rb_obj_is_kind_of(exc, rb_eException)) { DUMP1("find a pending exception"); - if (rbtk_eventloop_depth > 0 + if (rbtk_eventloop_depth > 0 || rbtk_internal_eventloop_handler > 0 ) { return 1; /* pending */ @@ -1015,7 +1015,7 @@ pending_exception_check1(thr_crit_bup, ptr) /* call original 'exit' command */ -static void +static void call_original_exit(ptr, state) struct tcltkip *ptr; int state; @@ -1060,7 +1060,7 @@ call_original_exit(ptr, state) argv[1] = state_obj; argv[2] = (Tcl_Obj *)NULL; - ptr->return_value + ptr->return_value = (*(info->objProc))(info->objClientData, ptr->ip, 2, argv); Tcl_DecrRefCount(cmd_obj); @@ -1136,7 +1136,7 @@ call_original_exit(ptr, state) argv[1] = RSTRING_PTR(rb_fix2str(INT2NUM(state), 10)); argv[2] = (char *)NULL; - ptr->return_value = (*(info->proc))(info->clientData, ptr->ip, + ptr->return_value = (*(info->proc))(info->clientData, ptr->ip, 2, argv); #if USE_RUBY_ALLOC @@ -1185,7 +1185,7 @@ _timer_for_tcl(clientData) run_timer_flag = 1; if (timer_tick > 0) { - timer_token = Tcl_CreateTimerHandler(timer_tick, _timer_for_tcl, + timer_token = Tcl_CreateTimerHandler(timer_tick, _timer_for_tcl, (ClientData)0); } else { timer_token = (Tcl_TimerToken)NULL; @@ -1255,7 +1255,7 @@ set_eventloop_tick(self, tick) rb_secure(4); if (ttick < 0) { - rb_raise(rb_eArgError, + rb_raise(rb_eArgError, "timer-tick parameter must be 0 or positive number"); } @@ -1268,7 +1268,7 @@ set_eventloop_tick(self, tick) timer_tick = req_timer_tick = ttick; if (timer_tick > 0) { /* start timer callback */ - timer_token = Tcl_CreateTimerHandler(timer_tick, _timer_for_tcl, + timer_token = Tcl_CreateTimerHandler(timer_tick, _timer_for_tcl, (ClientData)0); } else { timer_token = (Tcl_TimerToken)NULL; @@ -1322,7 +1322,7 @@ set_no_event_wait(self, wait) rb_secure(4); if (t_wait <= 0) { - rb_raise(rb_eArgError, + rb_raise(rb_eArgError, "no_event_wait parameter must be positive number"); } @@ -1445,7 +1445,7 @@ set_max_block_time(self, time) default: { VALUE tmp = rb_funcall(time, ID_inspect, 0, 0); - rb_raise(rb_eArgError, "invalid value for time: '%s'", + rb_raise(rb_eArgError, "invalid value for time: '%s'", StringValuePtr(tmp)); } } @@ -1715,7 +1715,7 @@ static int check_eventloop_interp() { DUMP1("check eventloop_interp"); - if (eventloop_interp != (Tcl_Interp*)NULL + if (eventloop_interp != (Tcl_Interp*)NULL && Tcl_InterpDeleted(eventloop_interp)) { DUMP2("eventloop_interp(%p) was deleted", eventloop_interp); return 1; @@ -1752,7 +1752,7 @@ lib_eventloop_core(check_root, update_flag, check_var, interp) if (timer_tick > 0) { thr_crit_bup = rb_thread_critical; rb_thread_critical = Qtrue; - timer_token = Tcl_CreateTimerHandler(timer_tick, _timer_for_tcl, + timer_token = Tcl_CreateTimerHandler(timer_tick, _timer_for_tcl, (ClientData)0); rb_thread_critical = thr_crit_bup; } else { @@ -1784,8 +1784,8 @@ lib_eventloop_core(check_root, update_flag, check_var, interp) if (timer_tick == 0 && update_flag == 0) { timer_tick = NO_THREAD_INTERRUPT_TIME; - timer_token = Tcl_CreateTimerHandler(timer_tick, - _timer_for_tcl, + timer_token = Tcl_CreateTimerHandler(timer_tick, + _timer_for_tcl, (ClientData)0); } @@ -1793,7 +1793,7 @@ lib_eventloop_core(check_root, update_flag, check_var, interp) if (*check_var || !found_event) { return found_event; } - if (interp != (Tcl_Interp*)NULL + if (interp != (Tcl_Interp*)NULL && Tcl_InterpDeleted(interp)) { /* IP for check_var is deleted */ return 0; @@ -1801,13 +1801,13 @@ lib_eventloop_core(check_root, update_flag, check_var, interp) } /* found_event = Tcl_DoOneEvent(event_flag); */ - found_event = RTEST(rb_protect(call_DoOneEvent, - INT2FIX(event_flag), &status)); + found_event = RTEST(rb_protect(call_DoOneEvent, + INT2FIX(event_flag), &status)); if (status) { switch (status) { case TAG_RAISE: if (NIL_P(rb_errinfo())) { - rbtk_pending_exception + rbtk_pending_exception = rb_exc_new2(rb_eException, "unknown exception"); } else { rbtk_pending_exception = rb_errinfo(); @@ -1834,7 +1834,7 @@ lib_eventloop_core(check_root, update_flag, check_var, interp) } if (depth != rbtk_eventloop_depth) { - DUMP2("DoOneEvent(1) abnormal exit!! %d", + DUMP2("DoOneEvent(1) abnormal exit!! %d", rbtk_eventloop_depth); } @@ -1894,7 +1894,7 @@ lib_eventloop_core(check_root, update_flag, check_var, interp) if (*check_var || !found_event) { return found_event; } - if (interp != (Tcl_Interp*)NULL + if (interp != (Tcl_Interp*)NULL && Tcl_InterpDeleted(interp)) { /* IP for check_var is deleted */ return 0; @@ -1906,12 +1906,12 @@ lib_eventloop_core(check_root, update_flag, check_var, interp) int status; #ifdef RUBY_USE_NATIVE_THREAD if (update_flag) { - st = RTEST(rb_protect(call_DoOneEvent, - INT2FIX(event_flag), &status)); + st = RTEST(rb_protect(call_DoOneEvent, + INT2FIX(event_flag), &status)); } else { - st = RTEST(rb_protect(call_DoOneEvent, - INT2FIX(event_flag & window_event_mode), - &status)); + st = RTEST(rb_protect(call_DoOneEvent, + INT2FIX(event_flag & window_event_mode), + &status)); #if USE_TOGGLE_WINDOW_MODE_FOR_IDLE if (!st) { if (toggle_eventloop_window_mode_for_idle()) { @@ -1926,8 +1926,8 @@ lib_eventloop_core(check_root, update_flag, check_var, interp) } #else /* st = Tcl_DoOneEvent(event_flag); */ - st = RTEST(rb_protect(call_DoOneEvent, - INT2FIX(event_flag), &status)); + st = RTEST(rb_protect(call_DoOneEvent, + INT2FIX(event_flag), &status)); #endif #if CONTROL_BY_STATUS_OF_RB_THREAD_WAITING_FOR_VALUE @@ -1941,8 +1941,8 @@ lib_eventloop_core(check_root, update_flag, check_var, interp) switch (status) { case TAG_RAISE: if (NIL_P(rb_errinfo())) { - rbtk_pending_exception - = rb_exc_new2(rb_eException, + rbtk_pending_exception + = rb_exc_new2(rb_eException, "unknown exception"); } else { rbtk_pending_exception = rb_errinfo(); @@ -1969,14 +1969,14 @@ lib_eventloop_core(check_root, update_flag, check_var, interp) } if (depth != rbtk_eventloop_depth) { - DUMP2("DoOneEvent(2) abnormal exit!! %d", + DUMP2("DoOneEvent(2) abnormal exit!! %d", rbtk_eventloop_depth); return 0; } TRAP_CHECK(); - if (check_var != (int*)NULL + if (check_var != (int*)NULL && !NIL_P(rbtk_pending_exception)) { DUMP1("exception on wait"); return 0; @@ -2005,8 +2005,8 @@ lib_eventloop_core(check_root, update_flag, check_var, interp) switch (status) { case TAG_RAISE: if (NIL_P(rb_errinfo())) { - rbtk_pending_exception - = rb_exc_new2(rb_eException, + rbtk_pending_exception + = rb_exc_new2(rb_eException, "unknown exception"); } else { rbtk_pending_exception = rb_errinfo(); @@ -2025,7 +2025,7 @@ lib_eventloop_core(check_root, update_flag, check_var, interp) case TAG_FATAL: if (NIL_P(rb_errinfo())) { - rb_exc_raise(rb_exc_new2(rb_eFatal, + rb_exc_raise(rb_exc_new2(rb_eFatal, "FATAL")); } else { rb_exc_raise(rb_errinfo()); @@ -2101,9 +2101,9 @@ lib_eventloop_main_core(args) check_rootwidget_flag = params->check_root; - if (lib_eventloop_core(params->check_root, - params->update_flag, - params->check_var, + if (lib_eventloop_core(params->check_root, + params->update_flag, + params->check_var, params->interp)) { return Qtrue; } else { @@ -2126,7 +2126,7 @@ lib_eventloop_main(args) switch (status) { case TAG_RAISE: if (NIL_P(rb_errinfo())) { - rbtk_pending_exception + rbtk_pending_exception = rb_exc_new2(rb_eException, "unknown exception"); } else { rbtk_pending_exception = rb_errinfo(); @@ -2167,7 +2167,7 @@ lib_eventloop_ensure(args) } while((eventloop_thread = rb_ary_pop(eventloop_stack))) { - DUMP2("eventloop-ensure: new eventloop-thread -> %lx", + DUMP2("eventloop-ensure: new eventloop-thread -> %lx", eventloop_thread); if (eventloop_thread == current_evloop) { @@ -2180,7 +2180,7 @@ lib_eventloop_ensure(args) Tcl_DeleteTimerHandler(timer_token); timer_token = (Tcl_TimerToken)NULL; - break; + break; } #ifdef RUBY_VM @@ -2244,7 +2244,7 @@ lib_eventloop_launcher(check_root, update_flag, check_var, interp) rb_ary_push(eventloop_stack, parent_evloop); - DUMP3("tcltklib: eventloop-thread : %lx -> %lx\n", + DUMP3("tcltklib: eventloop-thread : %lx -> %lx\n", parent_evloop, eventloop_thread); args->check_root = check_root; @@ -2256,10 +2256,10 @@ lib_eventloop_launcher(check_root, update_flag, check_var, interp) rb_thread_critical = Qfalse; #if 0 - return rb_ensure(lib_eventloop_main, (VALUE)args, + return rb_ensure(lib_eventloop_main, (VALUE)args, lib_eventloop_ensure, (VALUE)args); #endif - return rb_ensure(lib_eventloop_main_core, (VALUE)args, + return rb_ensure(lib_eventloop_main_core, (VALUE)args, lib_eventloop_ensure, (VALUE)args); } @@ -2280,7 +2280,7 @@ lib_mainloop(argc, argv, self) check_rootwidget = Qfalse; } - return lib_eventloop_launcher(RTEST(check_rootwidget), 0, + return lib_eventloop_launcher(RTEST(check_rootwidget), 0, (int*)NULL, (Tcl_Interp*)NULL); } @@ -2314,7 +2314,7 @@ static VALUE watchdog_evloop_launcher(check_rootwidget) VALUE check_rootwidget; { - return lib_eventloop_launcher(RTEST(check_rootwidget), 0, + return lib_eventloop_launcher(RTEST(check_rootwidget), 0, (int*)NULL, (Tcl_Interp*)NULL); } @@ -2350,9 +2350,9 @@ lib_watchdog_core(check_rootwidget) if (NIL_P(eventloop_thread) || (loop_counter == prev_val && chance >= EVLOOP_WAKEUP_CHANCE)) { /* start new eventloop thread */ - DUMP2("eventloop thread %lx is sleeping or dead", + DUMP2("eventloop thread %lx is sleeping or dead", eventloop_thread); - evloop = rb_thread_create(watchdog_evloop_launcher, + evloop = rb_thread_create(watchdog_evloop_launcher, (void*)&check_rootwidget); DUMP2("create new eventloop thread %lx", evloop); loop_counter = -1; @@ -2397,7 +2397,7 @@ lib_mainloop_watchdog(argc, argv, self) VALUE check_rootwidget; #ifdef RUBY_VM - rb_raise(rb_eNotImpError, + rb_raise(rb_eNotImpError, "eventloop_watchdog is not implemented on Ruby VM."); #endif @@ -2409,7 +2409,7 @@ lib_mainloop_watchdog(argc, argv, self) check_rootwidget = Qfalse; } - return rb_ensure(lib_watchdog_core, check_rootwidget, + return rb_ensure(lib_watchdog_core, check_rootwidget, lib_watchdog_ensure, Qnil); } @@ -2440,7 +2440,7 @@ struct thread_call_proc_arg { int *done; }; -void +void _thread_call_proc_arg_mark(struct thread_call_proc_arg *q) { rb_gc_mark(q->proc); @@ -2469,7 +2469,7 @@ _thread_call_proc(arg) { struct thread_call_proc_arg *q = (struct thread_call_proc_arg*)arg; - return rb_ensure(_thread_call_proc_core, (VALUE)q, + return rb_ensure(_thread_call_proc_core, (VALUE)q, _thread_call_proc_ensure, (VALUE)q); } @@ -2511,7 +2511,7 @@ lib_thread_callback(argc, argv, self) rb_thread_schedule(); /* start sub-eventloop */ - foundEvent = RTEST(lib_eventloop_launcher(/* not check root-widget */0, 0, + foundEvent = RTEST(lib_eventloop_launcher(/* not check root-widget */0, 0, q->done, (Tcl_Interp*)NULL)); #ifdef RUBY_VM @@ -2928,7 +2928,7 @@ static int #if TCL_MAJOR_VERSION >= 8 ip_ruby_eval(clientData, interp, argc, argv) ClientData clientData; - Tcl_Interp *interp; + Tcl_Interp *interp; int argc; Tcl_Obj *CONST argv[]; #else /* TCL_MAJOR_VERSION < 8 */ @@ -2944,7 +2944,7 @@ ip_ruby_eval(clientData, interp, argc, argv) int code; if (interp == (Tcl_Interp*)NULL) { - rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError, + rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError, "IP is deleted"); return TCL_ERROR; } @@ -2952,15 +2952,15 @@ ip_ruby_eval(clientData, interp, argc, argv) /* ruby command has 1 arg. */ if (argc != 2) { #if 0 - rb_raise(rb_eArgError, + rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc - 1); #else char buf[sizeof(int)*8 + 1]; Tcl_ResetResult(interp); sprintf(buf, "%d", argc-1); - Tcl_AppendResult(interp, "wrong number of arguments (", + Tcl_AppendResult(interp, "wrong number of arguments (", buf, " for 1)", (char *)NULL); - rbtk_pending_exception = rb_exc_new2(rb_eArgError, + rbtk_pending_exception = rb_exc_new2(rb_eArgError, Tcl_GetStringResult(interp)); return TCL_ERROR; #endif @@ -3056,7 +3056,7 @@ ip_ruby_cmd_receiver_const_get(name) /* has '::' at head ? */ if (*head == ':') head += 2; - tail = head; + tail = head; /* search */ while(*tail) { @@ -3119,7 +3119,7 @@ static int #if TCL_MAJOR_VERSION >= 8 ip_ruby_cmd(clientData, interp, argc, argv) ClientData clientData; - Tcl_Interp *interp; + Tcl_Interp *interp; int argc; Tcl_Obj *CONST argv[]; #else /* TCL_MAJOR_VERSION < 8 */ @@ -3142,7 +3142,7 @@ ip_ruby_cmd(clientData, interp, argc, argv) int code; if (interp == (Tcl_Interp*)NULL) { - rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError, + rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError, "IP is deleted"); return TCL_ERROR; } @@ -3153,7 +3153,7 @@ ip_ruby_cmd(clientData, interp, argc, argv) #else Tcl_ResetResult(interp); Tcl_AppendResult(interp, "too few arguments", (char *)NULL); - rbtk_pending_exception = rb_exc_new2(rb_eArgError, + rbtk_pending_exception = rb_exc_new2(rb_eArgError, Tcl_GetStringResult(interp)); return TCL_ERROR; #endif @@ -3175,13 +3175,13 @@ ip_ruby_cmd(clientData, interp, argc, argv) receiver = ip_ruby_cmd_receiver_get(str); if (NIL_P(receiver)) { #if 0 - rb_raise(rb_eArgError, + rb_raise(rb_eArgError, "unknown class/module/global-variable '%s'", str); #else Tcl_ResetResult(interp); - Tcl_AppendResult(interp, "unknown class/module/global-variable '", + Tcl_AppendResult(interp, "unknown class/module/global-variable '", str, "'", (char *)NULL); - rbtk_pending_exception = rb_exc_new2(rb_eArgError, + rbtk_pending_exception = rb_exc_new2(rb_eArgError, Tcl_GetStringResult(interp)); if (old_gc == Qfalse) rb_gc_enable(); return TCL_ERROR; @@ -3242,12 +3242,12 @@ ip_ruby_cmd(clientData, interp, argc, argv) static int #if TCL_MAJOR_VERSION >= 8 #ifdef HAVE_PROTOTYPES -ip_InterpExitObjCmd(ClientData clientData, Tcl_Interp *interp, +ip_InterpExitObjCmd(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj *CONST argv[]) #else ip_InterpExitObjCmd(clientData, interp, argc, argv) ClientData clientData; - Tcl_Interp *interp; + Tcl_Interp *interp; int argc; Tcl_Obj *CONST argv[]; #endif @@ -3265,7 +3265,7 @@ ip_InterpExitCommand(clientData, interp, argc, argv) #endif { DUMP1("start ip_InterpExitCommand"); - if (interp != (Tcl_Interp*)NULL + if (interp != (Tcl_Interp*)NULL && !Tcl_InterpDeleted(interp) #if TCL_NAMESPACE_DEBUG && !ip_null_namespace(interp) @@ -3292,7 +3292,7 @@ ip_RubyExitObjCmd(ClientData clientData, Tcl_Interp *interp, #else ip_RubyExitObjCmd(clientData, interp, argc, argv) ClientData clientData; - Tcl_Interp *interp; + Tcl_Interp *interp; int argc; Tcl_Obj *CONST argv[]; #endif @@ -3325,8 +3325,8 @@ ip_RubyExitCommand(clientData, interp, argc, argv) if (argc < 1 || argc > 2) { /* arguemnt error */ - Tcl_AppendResult(interp, - "wrong number of arguments: should be \"", + Tcl_AppendResult(interp, + "wrong number of arguments: should be \"", cmd, " ?returnCode?\"", (char *)NULL); return TCL_ERROR; } @@ -3348,10 +3348,10 @@ ip_RubyExitCommand(clientData, interp, argc, argv) switch(argc) { case 1: /* rb_exit(0); */ /* not return if succeed */ - Tcl_AppendResult(interp, + Tcl_AppendResult(interp, "fail to call \"", cmd, "\"", (char *)NULL); - rbtk_pending_exception = rb_exc_new2(rb_eSystemExit, + rbtk_pending_exception = rb_exc_new2(rb_eSystemExit, Tcl_GetStringResult(interp)); rb_iv_set(rbtk_pending_exception, "status", INT2FIX(0)); @@ -3367,8 +3367,8 @@ ip_RubyExitCommand(clientData, interp, argc, argv) #else /* TCL_MAJOR_VERSION < 8 */ state = (int)strtol(argv[1], &endptr, 0); if (*endptr) { - Tcl_AppendResult(interp, - "expected integer but got \"", + Tcl_AppendResult(interp, + "expected integer but got \"", argv[1], "\"", (char *)NULL); return TCL_ERROR; } @@ -3376,10 +3376,10 @@ ip_RubyExitCommand(clientData, interp, argc, argv) #endif /* rb_exit(state); */ /* not return if succeed */ - Tcl_AppendResult(interp, "fail to call \"", cmd, " ", + Tcl_AppendResult(interp, "fail to call \"", cmd, " ", param, "\"", (char *)NULL); - rbtk_pending_exception = rb_exc_new2(rb_eSystemExit, + rbtk_pending_exception = rb_exc_new2(rb_eSystemExit, Tcl_GetStringResult(interp)); rb_iv_set(rbtk_pending_exception, "status", INT2FIX(state)); @@ -3387,8 +3387,8 @@ ip_RubyExitCommand(clientData, interp, argc, argv) default: /* arguemnt error */ - Tcl_AppendResult(interp, - "wrong number of arguments: should be \"", + Tcl_AppendResult(interp, + "wrong number of arguments: should be \"", cmd, " ?returnCode?\"", (char *)NULL); return TCL_ERROR; } @@ -3408,7 +3408,7 @@ static int ip_rbUpdateObjCmd _((ClientData, Tcl_Interp *, int, static int ip_rbUpdateObjCmd(clientData, interp, objc, objv) ClientData clientData; - Tcl_Interp *interp; + Tcl_Interp *interp; int objc; Tcl_Obj *CONST objv[]; #else /* TCL_MAJOR_VERSION < 8 */ @@ -3429,7 +3429,7 @@ ip_rbUpdateCommand(clientData, interp, objc, objv) DUMP1("Ruby's 'update' is called"); if (interp == (Tcl_Interp*)NULL) { - rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError, + rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError, "IP is deleted"); return TCL_ERROR; } @@ -3476,8 +3476,8 @@ ip_rbUpdateCommand(clientData, interp, objc, objv) # if TCL_MAJOR_VERSION >= 8 int dummy; Tcl_AppendResult(interp, "wrong number of arguments: should be \"", - Tcl_GetStringFromObj(objv[0], &dummy), - " [ idletasks ]\"", + Tcl_GetStringFromObj(objv[0], &dummy), + " [ idletasks ]\"", (char *) NULL); # else /* TCL_MAJOR_VERSION < 8 */ Tcl_AppendResult(interp, "wrong number of arguments: should be \"", @@ -3542,7 +3542,7 @@ struct th_update_param { }; static void rb_threadUpdateProc _((ClientData)); -static void +static void rb_threadUpdateProc(clientData) ClientData clientData; /* Pointer to integer to set to 1. */ { @@ -3561,7 +3561,7 @@ static int ip_rb_threadUpdateObjCmd _((ClientData, Tcl_Interp *, int, static int ip_rb_threadUpdateObjCmd(clientData, interp, objc, objv) ClientData clientData; - Tcl_Interp *interp; + Tcl_Interp *interp; int objc; Tcl_Obj *CONST objv[]; #else /* TCL_MAJOR_VERSION < 8 */ @@ -3585,7 +3585,7 @@ ip_rb_threadUpdateCommand(clientData, interp, objc, objv) DUMP1("Ruby's 'thread_update' is called"); if (interp == (Tcl_Interp*)NULL) { - rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError, + rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError, "IP is deleted"); return TCL_ERROR; } @@ -3597,7 +3597,7 @@ ip_rb_threadUpdateCommand(clientData, interp, objc, objv) #endif #endif - if (rb_thread_alone() + if (rb_thread_alone() || NIL_P(eventloop_thread) || eventloop_thread == current_thread) { #if TCL_MAJOR_VERSION >= 8 DUMP1("call ip_rbUpdateObjCmd"); @@ -3645,8 +3645,8 @@ ip_rb_threadUpdateCommand(clientData, interp, objc, objv) # if TCL_MAJOR_VERSION >= 8 int dummy; Tcl_AppendResult(interp, "wrong number of arguments: should be \"", - Tcl_GetStringFromObj(objv[0], &dummy), - " [ idletasks ]\"", + Tcl_GetStringFromObj(objv[0], &dummy), + " [ idletasks ]\"", (char *) NULL); # else /* TCL_MAJOR_VERSION < 8 */ Tcl_AppendResult(interp, "wrong number of arguments: should be \"", @@ -3720,7 +3720,7 @@ static int ip_rb_threadTkWaitCommand _((ClientData, Tcl_Interp *, int, #endif #if TCL_MAJOR_VERSION >= 8 -static char *VwaitVarProc _((ClientData, Tcl_Interp *, +static char *VwaitVarProc _((ClientData, Tcl_Interp *, CONST84 char *,CONST84 char *, int)); static char * VwaitVarProc(clientData, interp, name1, name2, flags) @@ -3750,7 +3750,7 @@ VwaitVarProc(clientData, interp, name1, name2, flags) static int ip_rbVwaitObjCmd(clientData, interp, objc, objv) ClientData clientData; /* Not used */ - Tcl_Interp *interp; + Tcl_Interp *interp; int objc; Tcl_Obj *CONST objv[]; #else /* TCL_MAJOR_VERSION < 8 */ @@ -3769,13 +3769,13 @@ ip_rbVwaitCommand(clientData, interp, objc, objv) DUMP1("Ruby's 'vwait' is called"); if (interp == (Tcl_Interp*)NULL) { - rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError, + rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError, "IP is deleted"); return TCL_ERROR; } #if 0 - if (!rb_thread_alone() + if (!rb_thread_alone() && eventloop_thread != Qnil && eventloop_thread != rb_thread_current()) { #if TCL_MAJOR_VERSION >= 8 @@ -3833,7 +3833,7 @@ ip_rbVwaitCommand(clientData, interp, objc, objv) nameString = objv[1]; #endif - /* + /* if (Tcl_TraceVar(interp, nameString, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, VwaitVarProc, (ClientData) &done) != TCL_OK) { @@ -3856,7 +3856,7 @@ ip_rbVwaitCommand(clientData, interp, objc, objv) done = 0; - foundEvent = RTEST(lib_eventloop_launcher(/* not check root-widget */0, + foundEvent = RTEST(lib_eventloop_launcher(/* not check root-widget */0, 0, &done, interp)); thr_crit_bup = rb_thread_critical; @@ -3934,7 +3934,7 @@ ip_rbVwaitCommand(clientData, interp, objc, objv) /* based on tkCmd.c */ /**************************/ #if TCL_MAJOR_VERSION >= 8 -static char *WaitVariableProc _((ClientData, Tcl_Interp *, +static char *WaitVariableProc _((ClientData, Tcl_Interp *, CONST84 char *,CONST84 char *, int)); static char * WaitVariableProc(clientData, interp, name1, name2, flags) @@ -3944,7 +3944,7 @@ WaitVariableProc(clientData, interp, name1, name2, flags) CONST84 char *name2; /* Second part of variable name. */ int flags; /* Information about what happened. */ #else /* TCL_MAJOR_VERSION < 8 */ -static char *WaitVariableProc _((ClientData, Tcl_Interp *, +static char *WaitVariableProc _((ClientData, Tcl_Interp *, char *, char *, int)); static char * WaitVariableProc(clientData, interp, name1, name2, flags) @@ -3994,7 +3994,7 @@ WaitWindowProc(clientData, eventPtr) static int ip_rbTkWaitObjCmd(clientData, interp, objc, objv) ClientData clientData; - Tcl_Interp *interp; + Tcl_Interp *interp; int objc; Tcl_Obj *CONST objv[]; #else /* TCL_MAJOR_VERSION < 8 */ @@ -4018,13 +4018,13 @@ ip_rbTkWaitCommand(clientData, interp, objc, objv) DUMP1("Ruby's 'tkwait' is called"); if (interp == (Tcl_Interp*)NULL) { - rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError, + rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError, "IP is deleted"); return TCL_ERROR; } #if 0 - if (!rb_thread_alone() + if (!rb_thread_alone() && eventloop_thread != Qnil && eventloop_thread != rb_thread_current()) { #if TCL_MAJOR_VERSION >= 8 @@ -4049,12 +4049,12 @@ ip_rbTkWaitCommand(clientData, interp, objc, objv) #if TCL_MAJOR_VERSION >= 8 Tcl_AppendResult(interp, "wrong number of arguments: should be \"", - Tcl_GetStringFromObj(objv[0], &dummy), - " variable|visibility|window name\"", + Tcl_GetStringFromObj(objv[0], &dummy), + " variable|visibility|window name\"", (char *) NULL); #else /* TCL_MAJOR_VERSION < 8 */ Tcl_AppendResult(interp, "wrong number of arguments: should be \"", - objv[0], " variable|visibility|window name\"", + objv[0], " variable|visibility|window name\"", (char *) NULL); #endif @@ -4070,14 +4070,14 @@ ip_rbTkWaitCommand(clientData, interp, objc, objv) rb_thread_critical = Qtrue; /* - if (Tcl_GetIndexFromObj(interp, objv[1], - (CONST84 char **)optionStrings, + if (Tcl_GetIndexFromObj(interp, objv[1], + (CONST84 char **)optionStrings, "option", 0, &index) != TCL_OK) { return TCL_ERROR; } */ - ret = Tcl_GetIndexFromObj(interp, objv[1], - (CONST84 char **)optionStrings, + ret = Tcl_GetIndexFromObj(interp, objv[1], + (CONST84 char **)optionStrings, "option", 0, &index); rb_thread_critical = thr_crit_bup; @@ -4101,7 +4101,7 @@ ip_rbTkWaitCommand(clientData, interp, objc, objv) index = TKWAIT_WINDOW; } else { Tcl_AppendResult(interp, "bad option \"", objv[1], - "\": must be variable, visibility, or window", + "\": must be variable, visibility, or window", (char *) NULL); Tcl_Release(interp); return TCL_ERROR; @@ -4204,8 +4204,8 @@ ip_rbTkWaitCommand(clientData, interp, objc, objv) } if (window == NULL) { - Tcl_AppendResult(interp, ": tkwait: ", - "no main-window (not Tk application?)", + Tcl_AppendResult(interp, ": tkwait: ", + "no main-window (not Tk application?)", (char*)NULL); rb_thread_critical = thr_crit_bup; #if TCL_MAJOR_VERSION >= 8 @@ -4310,8 +4310,8 @@ ip_rbTkWaitCommand(clientData, interp, objc, objv) #endif if (window == NULL) { - Tcl_AppendResult(interp, ": tkwait: ", - "no main-window (not Tk application?)", + Tcl_AppendResult(interp, ": tkwait: ", + "no main-window (not Tk application?)", (char*)NULL); rb_thread_critical = thr_crit_bup; Tcl_Release(interp); @@ -4379,7 +4379,7 @@ struct th_vwait_param { }; #if TCL_MAJOR_VERSION >= 8 -static char *rb_threadVwaitProc _((ClientData, Tcl_Interp *, +static char *rb_threadVwaitProc _((ClientData, Tcl_Interp *, CONST84 char *,CONST84 char *, int)); static char * rb_threadVwaitProc(clientData, interp, name1, name2, flags) @@ -4389,7 +4389,7 @@ rb_threadVwaitProc(clientData, interp, name1, name2, flags) CONST84 char *name2; /* Second part of variable name. */ int flags; /* Information about what happened. */ #else /* TCL_MAJOR_VERSION < 8 */ -static char *rb_threadVwaitProc _((ClientData, Tcl_Interp *, +static char *rb_threadVwaitProc _((ClientData, Tcl_Interp *, char *, char *, int)); static char * rb_threadVwaitProc(clientData, interp, name1, name2, flags) @@ -4450,7 +4450,7 @@ rb_threadWaitWindowProc(clientData, eventPtr) static int ip_rb_threadVwaitObjCmd(clientData, interp, objc, objv) ClientData clientData; - Tcl_Interp *interp; + Tcl_Interp *interp; int objc; Tcl_Obj *CONST objv[]; #else /* TCL_MAJOR_VERSION < 8 */ @@ -4471,7 +4471,7 @@ ip_rb_threadVwaitCommand(clientData, interp, objc, objv) DUMP1("Ruby's 'thread_vwait' is called"); if (interp == (Tcl_Interp*)NULL) { - rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError, + rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError, "IP is deleted"); return TCL_ERROR; } @@ -4607,7 +4607,7 @@ ip_rb_threadVwaitCommand(clientData, interp, objc, objv) static int ip_rb_threadTkWaitObjCmd(clientData, interp, objc, objv) ClientData clientData; - Tcl_Interp *interp; + Tcl_Interp *interp; int objc; Tcl_Obj *CONST objv[]; #else /* TCL_MAJOR_VERSION < 8 */ @@ -4634,7 +4634,7 @@ ip_rb_threadTkWaitCommand(clientData, interp, objc, objv) DUMP1("Ruby's 'thread_tkwait' is called"); if (interp == (Tcl_Interp*)NULL) { - rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError, + rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError, "IP is deleted"); return TCL_ERROR; } @@ -4665,12 +4665,12 @@ ip_rb_threadTkWaitCommand(clientData, interp, objc, objv) #if TCL_MAJOR_VERSION >= 8 Tcl_AppendResult(interp, "wrong number of arguments: should be \"", - Tcl_GetStringFromObj(objv[0], &dummy), - " variable|visibility|window name\"", + Tcl_GetStringFromObj(objv[0], &dummy), + " variable|visibility|window name\"", (char *) NULL); #else /* TCL_MAJOR_VERSION < 8 */ Tcl_AppendResult(interp, "wrong number of arguments: should be \"", - objv[0], " variable|visibility|window name\"", + objv[0], " variable|visibility|window name\"", (char *) NULL); #endif @@ -4686,14 +4686,14 @@ ip_rb_threadTkWaitCommand(clientData, interp, objc, objv) thr_crit_bup = rb_thread_critical; rb_thread_critical = Qtrue; /* - if (Tcl_GetIndexFromObj(interp, objv[1], - (CONST84 char **)optionStrings, + if (Tcl_GetIndexFromObj(interp, objv[1], + (CONST84 char **)optionStrings, "option", 0, &index) != TCL_OK) { return TCL_ERROR; } */ - ret = Tcl_GetIndexFromObj(interp, objv[1], - (CONST84 char **)optionStrings, + ret = Tcl_GetIndexFromObj(interp, objv[1], + (CONST84 char **)optionStrings, "option", 0, &index); rb_thread_critical = thr_crit_bup; @@ -4718,7 +4718,7 @@ ip_rb_threadTkWaitCommand(clientData, interp, objc, objv) index = TKWAIT_WINDOW; } else { Tcl_AppendResult(interp, "bad option \"", objv[1], - "\": must be variable, visibility, or window", + "\": must be variable, visibility, or window", (char *) NULL); Tcl_Release(tkwin); Tcl_Release(interp); @@ -4752,7 +4752,7 @@ ip_rb_threadTkWaitCommand(clientData, interp, objc, objv) case TKWAIT_VARIABLE: thr_crit_bup = rb_thread_critical; rb_thread_critical = Qtrue; - /* + /* if (Tcl_TraceVar(interp, nameString, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, rb_threadVwaitProc, (ClientData) param) != TCL_OK) { @@ -4840,8 +4840,8 @@ ip_rb_threadTkWaitCommand(clientData, interp, objc, objv) #endif if (window == NULL) { - Tcl_AppendResult(interp, ": thread_tkwait: ", - "no main-window (not Tk application?)", + Tcl_AppendResult(interp, ": thread_tkwait: ", + "no main-window (not Tk application?)", (char*)NULL); rb_thread_critical = thr_crit_bup; @@ -4892,7 +4892,7 @@ ip_rb_threadTkWaitCommand(clientData, interp, objc, objv) if (param->done != TKWAIT_MODE_DESTROY) { Tk_DeleteEventHandler(window, VisibilityChangeMask|StructureNotifyMask, - rb_threadWaitVisibilityProc, + rb_threadWaitVisibilityProc, (ClientData) param); } @@ -4965,8 +4965,8 @@ ip_rb_threadTkWaitCommand(clientData, interp, objc, objv) #endif if (window == NULL) { - Tcl_AppendResult(interp, ": thread_tkwait: ", - "no main-window (not Tk application?)", + Tcl_AppendResult(interp, ": thread_tkwait: ", + "no main-window (not Tk application?)", (char*)NULL); rb_thread_critical = thr_crit_bup; @@ -5147,7 +5147,7 @@ delete_slaves(ip) if (!Tcl_InterpDeleted(ip) && Tcl_Eval(ip, "interp slaves") == TCL_OK) { slave_list = ip->result; - if (Tcl_SplitList((Tcl_Interp*)NULL, + if (Tcl_SplitList((Tcl_Interp*)NULL, slave_list, &argc, &argv) == TCL_OK) { for(i = 0; i < argc; i++) { slave_name = argv[i]; @@ -5192,7 +5192,7 @@ ip_null_proc(ClientData clientData, Tcl_Interp *interp, #else ip_null_proc(clientData, interp, argc, argv) ClientData clientData; - Tcl_Interp *interp; + Tcl_Interp *interp; int argc; Tcl_Obj *CONST argv[]; #endif @@ -5220,10 +5220,10 @@ ip_finalize(ip) int thr_crit_bup; VALUE rb_debug_bup, rb_verbose_bup; - /* When ruby is exiting, printing debug messages in some callback - operations from Tcl-IP sometimes cause SEGV. I don't know the + /* When ruby is exiting, printing debug messages in some callback + operations from Tcl-IP sometimes cause SEGV. I don't know the reason. But I got SEGV when calling "rb_io_write(rb_stdout, ...)". - So, in some part of this function, debug mode and verbose mode + So, in some part of this function, debug mode and verbose mode are disabled. If you know the reason, please fix it. -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) */ @@ -5259,33 +5259,33 @@ ip_finalize(ip) /* shut off some connections from Tcl-proc to Ruby */ if (at_exit) { - /* NOTE: Only when at exit. - Because, ruby removes objects, which depends on the deleted - interpreter, on some callback operations. + /* NOTE: Only when at exit. + Because, ruby removes objects, which depends on the deleted + interpreter, on some callback operations. It is important for GC. */ #if TCL_MAJOR_VERSION >= 8 - Tcl_CreateObjCommand(ip, "ruby", ip_null_proc, + Tcl_CreateObjCommand(ip, "ruby", ip_null_proc, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); - Tcl_CreateObjCommand(ip, "ruby_eval", ip_null_proc, + Tcl_CreateObjCommand(ip, "ruby_eval", ip_null_proc, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); - Tcl_CreateObjCommand(ip, "ruby_cmd", ip_null_proc, + Tcl_CreateObjCommand(ip, "ruby_cmd", ip_null_proc, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); #else /* TCL_MAJOR_VERSION < 8 */ - Tcl_CreateCommand(ip, "ruby", ip_null_proc, + Tcl_CreateCommand(ip, "ruby", ip_null_proc, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); - Tcl_CreateCommand(ip, "ruby_eval", ip_null_proc, + Tcl_CreateCommand(ip, "ruby_eval", ip_null_proc, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); - Tcl_CreateCommand(ip, "ruby_cmd", ip_null_proc, + Tcl_CreateCommand(ip, "ruby_cmd", ip_null_proc, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); #endif - /* + /* rb_thread_critical = thr_crit_bup; return; */ } /* delete root widget */ -#ifdef RUBY_VM +#ifdef RUBY_VM /* cause SEGV on Ruby 1.9 */ #else DUMP1("check `destroy'"); @@ -5298,13 +5298,13 @@ ip_finalize(ip) DUMP1("destroy root widget"); if (tk_stubs_init_p() && Tk_MainWindow(ip) != (Tk_Window)NULL) { /* - * On Ruby VM, this code piece may be not called, because - * Tk_MainWindow() returns NULL on a native thread except + * On Ruby VM, this code piece may be not called, because + * Tk_MainWindow() returns NULL on a native thread except * the thread which initialize Tk environment. * Of course, that is a problem. But maybe not so serious. * All widgets are destroyed when the Tcl interp is deleted. - * At then, Ruby may raise exceptions on the delete hook - * callbacks which registered for the deleted widgets, and + * At then, Ruby may raise exceptions on the delete hook + * callbacks which registered for the deleted widgets, and * may fail to clear objects which depends on the widgets. * Although it is the problem, it is possibly avoidable by * rescuing exceptions and the finalize hook of the interp. @@ -5365,13 +5365,13 @@ ip_free(ptr) thr_crit_bup = rb_thread_critical; rb_thread_critical = Qtrue; - if ( ptr->ip != (Tcl_Interp*)NULL + if ( ptr->ip != (Tcl_Interp*)NULL && !Tcl_InterpDeleted(ptr->ip) - && Tcl_GetMaster(ptr->ip) != (Tcl_Interp*)NULL + && Tcl_GetMaster(ptr->ip) != (Tcl_Interp*)NULL && !Tcl_InterpDeleted(Tcl_GetMaster(ptr->ip)) ) { - DUMP2("parent IP(%lx) is not deleted", + DUMP2("parent IP(%lx) is not deleted", (unsigned long)Tcl_GetMaster(ptr->ip)); - DUMP2("slave IP(%lx) should not be deleted", + DUMP2("slave IP(%lx) should not be deleted", (unsigned long)ptr->ip); xfree(ptr); /* ckfree((char*)ptr); */ @@ -5390,8 +5390,8 @@ ip_free(ptr) if (!Tcl_InterpDeleted(ptr->ip)) { ip_finalize(ptr->ip); - Tcl_DeleteInterp(ptr->ip); - Tcl_Release(ptr->ip); + Tcl_DeleteInterp(ptr->ip); + Tcl_Release(ptr->ip); } ptr->ip = (Tcl_Interp*)NULL; @@ -5422,66 +5422,66 @@ ip_replace_wait_commands(interp, mainWin) /* replace 'vwait' command */ #if TCL_MAJOR_VERSION >= 8 DUMP1("Tcl_CreateObjCommand(\"vwait\")"); - Tcl_CreateObjCommand(interp, "vwait", ip_rbVwaitObjCmd, + Tcl_CreateObjCommand(interp, "vwait", ip_rbVwaitObjCmd, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); #else /* TCL_MAJOR_VERSION < 8 */ DUMP1("Tcl_CreateCommand(\"vwait\")"); - Tcl_CreateCommand(interp, "vwait", ip_rbVwaitCommand, + Tcl_CreateCommand(interp, "vwait", ip_rbVwaitCommand, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); #endif /* replace 'tkwait' command */ #if TCL_MAJOR_VERSION >= 8 DUMP1("Tcl_CreateObjCommand(\"tkwait\")"); - Tcl_CreateObjCommand(interp, "tkwait", ip_rbTkWaitObjCmd, + Tcl_CreateObjCommand(interp, "tkwait", ip_rbTkWaitObjCmd, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); #else /* TCL_MAJOR_VERSION < 8 */ DUMP1("Tcl_CreateCommand(\"tkwait\")"); - Tcl_CreateCommand(interp, "tkwait", ip_rbTkWaitCommand, + Tcl_CreateCommand(interp, "tkwait", ip_rbTkWaitCommand, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); #endif /* add 'thread_vwait' command */ #if TCL_MAJOR_VERSION >= 8 DUMP1("Tcl_CreateObjCommand(\"thread_vwait\")"); - Tcl_CreateObjCommand(interp, "thread_vwait", ip_rb_threadVwaitObjCmd, + Tcl_CreateObjCommand(interp, "thread_vwait", ip_rb_threadVwaitObjCmd, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); #else /* TCL_MAJOR_VERSION < 8 */ DUMP1("Tcl_CreateCommand(\"thread_vwait\")"); - Tcl_CreateCommand(interp, "thread_vwait", ip_rb_threadVwaitCommand, + Tcl_CreateCommand(interp, "thread_vwait", ip_rb_threadVwaitCommand, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); #endif /* add 'thread_tkwait' command */ #if TCL_MAJOR_VERSION >= 8 DUMP1("Tcl_CreateObjCommand(\"thread_tkwait\")"); - Tcl_CreateObjCommand(interp, "thread_tkwait", ip_rb_threadTkWaitObjCmd, + Tcl_CreateObjCommand(interp, "thread_tkwait", ip_rb_threadTkWaitObjCmd, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); #else /* TCL_MAJOR_VERSION < 8 */ DUMP1("Tcl_CreateCommand(\"thread_tkwait\")"); - Tcl_CreateCommand(interp, "thread_tkwait", ip_rb_threadTkWaitCommand, + Tcl_CreateCommand(interp, "thread_tkwait", ip_rb_threadTkWaitCommand, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); #endif /* replace 'update' command */ #if TCL_MAJOR_VERSION >= 8 DUMP1("Tcl_CreateObjCommand(\"update\")"); - Tcl_CreateObjCommand(interp, "update", ip_rbUpdateObjCmd, + Tcl_CreateObjCommand(interp, "update", ip_rbUpdateObjCmd, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); #else /* TCL_MAJOR_VERSION < 8 */ DUMP1("Tcl_CreateCommand(\"update\")"); - Tcl_CreateCommand(interp, "update", ip_rbUpdateCommand, + Tcl_CreateCommand(interp, "update", ip_rbUpdateCommand, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); #endif /* add 'thread_update' command */ #if TCL_MAJOR_VERSION >= 8 DUMP1("Tcl_CreateObjCommand(\"thread_update\")"); - Tcl_CreateObjCommand(interp, "thread_update", ip_rb_threadUpdateObjCmd, + Tcl_CreateObjCommand(interp, "thread_update", ip_rb_threadUpdateObjCmd, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); #else /* TCL_MAJOR_VERSION < 8 */ DUMP1("Tcl_CreateCommand(\"thread_update\")"); - Tcl_CreateCommand(interp, "thread_update", ip_rb_threadUpdateCommand, + Tcl_CreateCommand(interp, "thread_update", ip_rb_threadUpdateCommand, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); #endif } @@ -5491,7 +5491,7 @@ ip_replace_wait_commands(interp, mainWin) static int ip_rb_replaceSlaveTkCmdsObjCmd(clientData, interp, objc, objv) ClientData clientData; - Tcl_Interp *interp; + Tcl_Interp *interp; int objc; Tcl_Obj *CONST objv[]; #else /* TCL_MAJOR_VERSION < 8 */ @@ -5530,7 +5530,7 @@ ip_rb_replaceSlaveTkCmdsCommand(clientData, interp, objc, objv) slave = Tcl_GetSlave(interp, slave_name); if (slave == NULL) { - Tcl_AppendResult(interp, "cannot find slave \"", + Tcl_AppendResult(interp, "cannot find slave \"", slave_name, "\"", (char *)NULL); return TCL_ERROR; } @@ -5539,11 +5539,11 @@ ip_rb_replaceSlaveTkCmdsCommand(clientData, interp, objc, objv) /* replace 'exit' command --> 'interp_exit' command */ #if TCL_MAJOR_VERSION >= 8 DUMP1("Tcl_CreateObjCommand(\"exit\") --> \"interp_exit\""); - Tcl_CreateObjCommand(slave, "exit", ip_InterpExitObjCmd, + Tcl_CreateObjCommand(slave, "exit", ip_InterpExitObjCmd, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); #else /* TCL_MAJOR_VERSION < 8 */ DUMP1("Tcl_CreateCommand(\"exit\") --> \"interp_exit\""); - Tcl_CreateCommand(slave, "exit", ip_InterpExitCommand, + Tcl_CreateCommand(slave, "exit", ip_InterpExitCommand, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); #endif @@ -5560,7 +5560,7 @@ static int ip_rbNamespaceObjCmd _((ClientData, Tcl_Interp *, int, static int ip_rbNamespaceObjCmd(clientData, interp, objc, objv) ClientData clientData; - Tcl_Interp *interp; + Tcl_Interp *interp; int objc; Tcl_Obj *CONST objv[]; { @@ -5569,7 +5569,7 @@ ip_rbNamespaceObjCmd(clientData, interp, objc, objv) if (!Tcl_GetCommandInfo(interp, "__orig_namespace_command__", &(info))) { Tcl_ResetResult(interp); - Tcl_AppendResult(interp, + Tcl_AppendResult(interp, "invalid command name \"namespace\"", (char*)NULL); return TCL_ERROR; } @@ -5596,7 +5596,7 @@ ip_rbNamespaceObjCmd(clientData, interp, objc, objv) } argv[objc] = (char *)NULL; - ret = (*(info.proc))(info.clientData, interp, + ret = (*(info.proc))(info.clientData, interp, objc, (CONST84 char **)argv); #if 0 /* use Tcl_EventuallyFree */ @@ -5620,7 +5620,7 @@ ip_rbNamespaceObjCmd(clientData, interp, objc, objv) static void ip_wrap_namespace_command(interp) - Tcl_Interp *interp; + Tcl_Interp *interp; { #if TCL_MAJOR_VERSION >= 8 Tcl_CmdInfo orig_info; @@ -5630,16 +5630,16 @@ ip_wrap_namespace_command(interp) } if (orig_info.isNativeObjectProc) { - Tcl_CreateObjCommand(interp, "__orig_namespace_command__", - orig_info.objProc, orig_info.objClientData, + Tcl_CreateObjCommand(interp, "__orig_namespace_command__", + orig_info.objProc, orig_info.objClientData, orig_info.deleteProc); } else { - Tcl_CreateCommand(interp, "__orig_namespace_command__", - orig_info.proc, orig_info.clientData, + Tcl_CreateCommand(interp, "__orig_namespace_command__", + orig_info.proc, orig_info.clientData, orig_info.deleteProc); } - Tcl_CreateObjCommand(interp, "namespace", ip_rbNamespaceObjCmd, + Tcl_CreateObjCommand(interp, "namespace", ip_rbNamespaceObjCmd, (ClientData) 0, (Tcl_CmdDeleteProc *)NULL); #endif } @@ -5684,8 +5684,8 @@ ip_init(argc, argv, self) /* security check */ if (rb_safe_level() >= 4) { - rb_raise(rb_eSecurityError, - "Cannot create a TclTkIp object at level %d", + rb_raise(rb_eSecurityError, + "Cannot create a TclTkIp object at level %d", rb_safe_level()); } @@ -5728,7 +5728,7 @@ ip_init(argc, argv, self) #if TCL_MAJOR_VERSION >= 8 #if TCL_NAMESPACE_DEBUG DUMP1("get current namespace"); - if ((ptr->default_ns = Tcl_GetCurrentNamespace(ptr->ip)) + if ((ptr->default_ns = Tcl_GetCurrentNamespace(ptr->ip)) == (Tcl_Namespace*)NULL) { rb_raise(rb_eRuntimeError, "a new Tk interpreter has a NULL namespace"); } @@ -5739,7 +5739,7 @@ ip_init(argc, argv, self) DUMP2("IP ref_count = %d", ptr->ref_count); current_interp = ptr->ip; - ptr->has_orig_exit + ptr->has_orig_exit = Tcl_GetCommandInfo(ptr->ip, "exit", &(ptr->orig_exit_info)); /* from Tcl_AppInit() */ @@ -5768,7 +5768,7 @@ ip_init(argc, argv, self) Tcl_SetVar(ptr->ip, "argv0", "ruby", TCL_GLOBAL_ONLY); } else { /* Tcl_SetVar(ptr->ip, "argv0", StringValuePtr(argv0), 0); */ - Tcl_SetVar(ptr->ip, "argv0", StringValuePtr(argv0), + Tcl_SetVar(ptr->ip, "argv0", StringValuePtr(argv0), TCL_GLOBAL_ONLY); } } @@ -5788,10 +5788,10 @@ ip_init(argc, argv, self) case NO_Tk_Init: rb_raise(rb_eLoadError, "tcltklib: can't find Tk_Init()"); case FAIL_Tk_Init: - rb_raise(rb_eRuntimeError, "tcltklib: fail to Tk_Init(). %s", + rb_raise(rb_eRuntimeError, "tcltklib: fail to Tk_Init(). %s", Tcl_GetStringResult(ptr->ip)); case FAIL_Tk_InitStubs: - rb_raise(rb_eRuntimeError, "tcltklib: fail to Tk_InitStubs(). %s", + rb_raise(rb_eRuntimeError, "tcltklib: fail to Tk_InitStubs(). %s", Tcl_GetStringResult(ptr->ip)); default: rb_raise(rb_eRuntimeError, "tcltklib: unknown error(%d) on ruby_tk_stubs_init", st); @@ -5840,23 +5840,23 @@ ip_init(argc, argv, self) /* add 'interp_exit', 'ruby_exit' and replace 'exit' command */ #if TCL_MAJOR_VERSION >= 8 DUMP1("Tcl_CreateObjCommand(\"interp_exit\")"); - Tcl_CreateObjCommand(ptr->ip, "interp_exit", ip_InterpExitObjCmd, + Tcl_CreateObjCommand(ptr->ip, "interp_exit", ip_InterpExitObjCmd, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); DUMP1("Tcl_CreateObjCommand(\"ruby_exit\")"); - Tcl_CreateObjCommand(ptr->ip, "ruby_exit", ip_RubyExitObjCmd, + Tcl_CreateObjCommand(ptr->ip, "ruby_exit", ip_RubyExitObjCmd, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); DUMP1("Tcl_CreateObjCommand(\"exit\") --> \"ruby_exit\""); - Tcl_CreateObjCommand(ptr->ip, "exit", ip_RubyExitObjCmd, + Tcl_CreateObjCommand(ptr->ip, "exit", ip_RubyExitObjCmd, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); #else /* TCL_MAJOR_VERSION < 8 */ DUMP1("Tcl_CreateCommand(\"interp_exit\")"); - Tcl_CreateCommand(ptr->ip, "interp_exit", ip_InterpExitCommand, + Tcl_CreateCommand(ptr->ip, "interp_exit", ip_InterpExitCommand, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); DUMP1("Tcl_CreateCommand(\"ruby_exit\")"); - Tcl_CreateCommand(ptr->ip, "ruby_exit", ip_RubyExitCommand, + Tcl_CreateCommand(ptr->ip, "ruby_exit", ip_RubyExitCommand, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); DUMP1("Tcl_CreateCommand(\"exit\") --> \"ruby_exit\""); - Tcl_CreateCommand(ptr->ip, "exit", ip_RubyExitCommand, + Tcl_CreateCommand(ptr->ip, "exit", ip_RubyExitCommand, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); #endif @@ -5868,12 +5868,12 @@ ip_init(argc, argv, self) /* define command to replace commands which depend on slave's MainWindow */ #if TCL_MAJOR_VERSION >= 8 - Tcl_CreateObjCommand(ptr->ip, "__replace_slave_tk_commands__", - ip_rb_replaceSlaveTkCmdsObjCmd, + Tcl_CreateObjCommand(ptr->ip, "__replace_slave_tk_commands__", + ip_rb_replaceSlaveTkCmdsObjCmd, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); #else /* TCL_MAJOR_VERSION < 8 */ - Tcl_CreateCommand(ptr->ip, "__replace_slave_tk_commands__", - ip_rb_replaceSlaveTkCmdsCommand, + Tcl_CreateCommand(ptr->ip, "__replace_slave_tk_commands__", + ip_rb_replaceSlaveTkCmdsCommand, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); #endif @@ -5904,7 +5904,7 @@ ip_create_slave_core(interp, argc, argv) /* ip is deleted? */ if (deleted_ip(master)) { - return rb_exc_new2(rb_eRuntimeError, + return rb_exc_new2(rb_eRuntimeError, "deleted master cannot create a new slave"); } @@ -5949,7 +5949,7 @@ ip_create_slave_core(interp, argc, argv) slave->ip = Tcl_CreateSlave(master->ip, StringValuePtr(name), safe); if (slave->ip == NULL) { rb_thread_critical = thr_crit_bup; - return rb_exc_new2(rb_eRuntimeError, + return rb_exc_new2(rb_eRuntimeError, "fail to create the new slave interpreter"); } #if TCL_MAJOR_VERSION >= 8 @@ -5959,18 +5959,18 @@ ip_create_slave_core(interp, argc, argv) #endif rbtk_preserve_ip(slave); - slave->has_orig_exit + slave->has_orig_exit = Tcl_GetCommandInfo(slave->ip, "exit", &(slave->orig_exit_info)); /* replace 'exit' command --> 'interp_exit' command */ mainWin = (tk_stubs_init_p())? Tk_MainWindow(slave->ip): (Tk_Window)NULL; #if TCL_MAJOR_VERSION >= 8 DUMP1("Tcl_CreateObjCommand(\"exit\") --> \"interp_exit\""); - Tcl_CreateObjCommand(slave->ip, "exit", ip_InterpExitObjCmd, + Tcl_CreateObjCommand(slave->ip, "exit", ip_InterpExitObjCmd, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); #else /* TCL_MAJOR_VERSION < 8 */ DUMP1("Tcl_CreateCommand(\"exit\") --> \"interp_exit\""); - Tcl_CreateCommand(slave->ip, "exit", ip_InterpExitCommand, + Tcl_CreateCommand(slave->ip, "exit", ip_InterpExitCommand, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); #endif @@ -5982,12 +5982,12 @@ ip_create_slave_core(interp, argc, argv) /* define command to replace cmds which depend on slave-slave's MainWin */ #if TCL_MAJOR_VERSION >= 8 - Tcl_CreateObjCommand(slave->ip, "__replace_slave_tk_commands__", - ip_rb_replaceSlaveTkCmdsObjCmd, + Tcl_CreateObjCommand(slave->ip, "__replace_slave_tk_commands__", + ip_rb_replaceSlaveTkCmdsObjCmd, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); #else /* TCL_MAJOR_VERSION < 8 */ - Tcl_CreateCommand(slave->ip, "__replace_slave_tk_commands__", - ip_rb_replaceSlaveTkCmdsCommand, + Tcl_CreateCommand(slave->ip, "__replace_slave_tk_commands__", + ip_rb_replaceSlaveTkCmdsCommand, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); #endif @@ -6012,7 +6012,7 @@ ip_create_slave(argc, argv, self) /* ip is deleted? */ if (deleted_ip(master)) { - rb_raise(rb_eRuntimeError, + rb_raise(rb_eRuntimeError, "deleted master cannot create a new slave interpreter"); } @@ -6121,7 +6121,7 @@ ip_create_console(self) VALUE self; { struct tcltkip *ptr = get_ip(self); - + /* ip is deleted? */ if (deleted_ip(ptr)) { rb_raise(rb_eRuntimeError, "interpreter is deleted"); @@ -6139,16 +6139,16 @@ ip_make_safe_core(interp, argc, argv) { struct tcltkip *ptr = get_ip(interp); Tk_Window mainWin; - + /* ip is deleted? */ if (deleted_ip(ptr)) { return rb_exc_new2(rb_eRuntimeError, "interpreter is deleted"); } if (Tcl_MakeSafe(ptr->ip) == TCL_ERROR) { - /* return rb_exc_new2(rb_eRuntimeError, + /* return rb_exc_new2(rb_eRuntimeError, Tcl_GetStringResult(ptr->ip)); */ - return create_ip_exc(interp, rb_eRuntimeError, + return create_ip_exc(interp, rb_eRuntimeError, Tcl_GetStringResult(ptr->ip)); } @@ -6158,11 +6158,11 @@ ip_make_safe_core(interp, argc, argv) mainWin = (tk_stubs_init_p())? Tk_MainWindow(ptr->ip): (Tk_Window)NULL; #if TCL_MAJOR_VERSION >= 8 DUMP1("Tcl_CreateObjCommand(\"exit\") --> \"interp_exit\""); - Tcl_CreateObjCommand(ptr->ip, "exit", ip_InterpExitObjCmd, + Tcl_CreateObjCommand(ptr->ip, "exit", ip_InterpExitObjCmd, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); #else /* TCL_MAJOR_VERSION < 8 */ DUMP1("Tcl_CreateCommand(\"exit\") --> \"interp_exit\""); - Tcl_CreateCommand(ptr->ip, "exit", ip_InterpExitCommand, + Tcl_CreateCommand(ptr->ip, "exit", ip_InterpExitCommand, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); #endif @@ -6174,7 +6174,7 @@ ip_make_safe(self) VALUE self; { struct tcltkip *ptr = get_ip(self); - + /* ip is deleted? */ if (deleted_ip(ptr)) { rb_raise(rb_eRuntimeError, "interpreter is deleted"); @@ -6189,7 +6189,7 @@ ip_is_safe_p(self) VALUE self; { struct tcltkip *ptr = get_ip(self); - + /* ip is deleted? */ if (deleted_ip(ptr)) { rb_raise(rb_eRuntimeError, "interpreter is deleted"); @@ -6208,7 +6208,7 @@ ip_allow_ruby_exit_p(self) VALUE self; { struct tcltkip *ptr = get_ip(self); - + /* ip is deleted? */ if (deleted_ip(ptr)) { rb_raise(rb_eRuntimeError, "interpreter is deleted"); @@ -6237,14 +6237,14 @@ ip_allow_ruby_exit_set(self, val) } if (Tcl_IsSafe(ptr->ip)) { - rb_raise(rb_eSecurityError, + rb_raise(rb_eSecurityError, "insecure operation on a safe interpreter"); } /* - * Because of cross-threading, the following line may fail to find + * Because of cross-threading, the following line may fail to find * the MainWindow, even if the Tcl/Tk interpreter has one or more. - * But it has no problem. Current implementation of both type of + * But it has no problem. Current implementation of both type of * the "exit" command don't need maiinWin token. */ mainWin = (tk_stubs_init_p())? Tk_MainWindow(ptr->ip): (Tk_Window)NULL; @@ -6253,11 +6253,11 @@ ip_allow_ruby_exit_set(self, val) ptr->allow_ruby_exit = 1; #if TCL_MAJOR_VERSION >= 8 DUMP1("Tcl_CreateObjCommand(\"exit\") --> \"ruby_exit\""); - Tcl_CreateObjCommand(ptr->ip, "exit", ip_RubyExitObjCmd, + Tcl_CreateObjCommand(ptr->ip, "exit", ip_RubyExitObjCmd, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); #else /* TCL_MAJOR_VERSION < 8 */ DUMP1("Tcl_CreateCommand(\"exit\") --> \"ruby_exit\""); - Tcl_CreateCommand(ptr->ip, "exit", ip_RubyExitCommand, + Tcl_CreateCommand(ptr->ip, "exit", ip_RubyExitCommand, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); #endif return Qtrue; @@ -6266,11 +6266,11 @@ ip_allow_ruby_exit_set(self, val) ptr->allow_ruby_exit = 0; #if TCL_MAJOR_VERSION >= 8 DUMP1("Tcl_CreateObjCommand(\"exit\") --> \"interp_exit\""); - Tcl_CreateObjCommand(ptr->ip, "exit", ip_InterpExitObjCmd, + Tcl_CreateObjCommand(ptr->ip, "exit", ip_InterpExitObjCmd, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); #else /* TCL_MAJOR_VERSION < 8 */ DUMP1("Tcl_CreateCommand(\"exit\") --> \"interp_exit\""); - Tcl_CreateCommand(ptr->ip, "exit", ip_InterpExitCommand, + Tcl_CreateCommand(ptr->ip, "exit", ip_InterpExitCommand, (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL); #endif return Qfalse; @@ -6517,7 +6517,7 @@ call_queue_handler(evPtr, flags) if (RTEST(rb_funcall(thread, ID_alive_p, 0)) && ! RTEST(rb_funcall(thread, ID_stop_p, 0))) { #else - if (RTEST(rb_thread_alive_p(thread)) + if (RTEST(rb_thread_alive_p(thread)) && ! RTEST(rb_funcall(thread, ID_stop_p, 0))) { #endif DUMP1("caller is not yet ready to receive the result -> pending"); @@ -6541,7 +6541,7 @@ call_queue_handler(evPtr, flags) if (rb_safe_level() != q->safe_level) { /* q_dat = Data_Wrap_Struct(rb_cData,0,-1,q); */ q_dat = Data_Wrap_Struct(rb_cData,call_queue_mark,-1,q); - ret = rb_funcall(rb_proc_new(callq_safelevel_handler, q_dat), + ret = rb_funcall(rb_proc_new(callq_safelevel_handler, q_dat), ID_call, 0); rb_gc_force_recycle(q_dat); q_dat = (VALUE)NULL; @@ -6622,11 +6622,11 @@ tk_funcall(func, argc, argv, obj) #ifdef RUBY_USE_NATIVE_THREAD if (ptr) { /* on Tcl interpreter */ - is_tk_evloop_thread = (ptr->tk_thread_id == (Tcl_ThreadId) 0 + is_tk_evloop_thread = (ptr->tk_thread_id == (Tcl_ThreadId) 0 || ptr->tk_thread_id == Tcl_GetCurrentThread()); } else { /* on Tcl/Tk library */ - is_tk_evloop_thread = (tk_eventloop_thread_id == (Tcl_ThreadId) 0 + is_tk_evloop_thread = (tk_eventloop_thread_id == (Tcl_ThreadId) 0 || tk_eventloop_thread_id == Tcl_GetCurrentThread()); } #else @@ -6697,15 +6697,15 @@ tk_funcall(func, argc, argv, obj) DUMP1("add handler"); #ifdef RUBY_USE_NATIVE_THREAD if (ptr && ptr->tk_thread_id) { - /* Tcl_ThreadQueueEvent(ptr->tk_thread_id, + /* Tcl_ThreadQueueEvent(ptr->tk_thread_id, &(callq->ev), TCL_QUEUE_HEAD); */ - Tcl_ThreadQueueEvent(ptr->tk_thread_id, + Tcl_ThreadQueueEvent(ptr->tk_thread_id, (Tcl_Event*)callq, TCL_QUEUE_HEAD); Tcl_ThreadAlert(ptr->tk_thread_id); } else if (tk_eventloop_thread_id) { - /* Tcl_ThreadQueueEvent(tk_eventloop_thread_id, + /* Tcl_ThreadQueueEvent(tk_eventloop_thread_id, &(callq->ev), TCL_QUEUE_HEAD); */ - Tcl_ThreadQueueEvent(tk_eventloop_thread_id, + Tcl_ThreadQueueEvent(tk_eventloop_thread_id, (Tcl_Event*)callq, TCL_QUEUE_HEAD); Tcl_ThreadAlert(tk_eventloop_thread_id); } else { @@ -6779,7 +6779,7 @@ tk_funcall(func, argc, argv, obj) if (rb_obj_is_kind_of(ret, rb_eException)) { DUMP1("raise exception"); /* rb_exc_raise(ret); */ - rb_exc_raise(rb_exc_new3(rb_obj_class(ret), + rb_exc_raise(rb_exc_new3(rb_obj_class(ret), rb_funcall(ret, ID_to_s, 0, 0))); } @@ -6856,7 +6856,7 @@ ip_eval_real(self, cmd_str, cmd_len) switch(status) { case TAG_RAISE: if (NIL_P(rb_errinfo())) { - rbtk_pending_exception = rb_exc_new2(rb_eException, + rbtk_pending_exception = rb_exc_new2(rb_eException, "unknown exception"); } else { rbtk_pending_exception = rb_errinfo(); @@ -6889,18 +6889,18 @@ ip_eval_real(self, cmd_str, cmd_len) switch (ptr->return_value) { case TCL_RETURN: - exc = create_ip_exc(self, eTkCallbackReturn, + exc = create_ip_exc(self, eTkCallbackReturn, "ip_eval_real receives TCL_RETURN"); case TCL_BREAK: - exc = create_ip_exc(self, eTkCallbackBreak, + exc = create_ip_exc(self, eTkCallbackBreak, "ip_eval_real receives TCL_BREAK"); case TCL_CONTINUE: - exc = create_ip_exc(self, eTkCallbackContinue, + exc = create_ip_exc(self, eTkCallbackContinue, "ip_eval_real receives TCL_CONTINUE"); default: - exc = create_ip_exc(self, rb_eRuntimeError, "%s", + exc = create_ip_exc(self, rb_eRuntimeError, "%s", Tcl_GetStringResult(ptr->ip)); - } + } rbtk_release_ip(ptr); rb_thread_critical = thr_crit_bup; @@ -6949,17 +6949,17 @@ ip_eval_real(self, cmd_str, cmd_len) switch (ptr->return_value) { case TCL_RETURN: - exc = create_ip_exc(self, eTkCallbackReturn, + exc = create_ip_exc(self, eTkCallbackReturn, "ip_eval_real receives TCL_RETURN"); case TCL_BREAK: - exc = create_ip_exc(self, eTkCallbackBreak, + exc = create_ip_exc(self, eTkCallbackBreak, "ip_eval_real receives TCL_BREAK"); case TCL_CONTINUE: - exc = create_ip_exc(self, eTkCallbackContinue, + exc = create_ip_exc(self, eTkCallbackContinue, "ip_eval_real receives TCL_CONTINUE"); default: exc = create_ip_exc(self, rb_eRuntimeError, "%s", ptr->ip->result); - } + } rbtk_release_ip(ptr); return exc; @@ -7013,7 +7013,7 @@ eval_queue_handler(evPtr, flags) if (RTEST(rb_funcall(thread, ID_alive_p, 0)) && ! RTEST(rb_funcall(thread, ID_stop_p, 0))) { #else - if (RTEST(rb_thread_alive_p(thread)) + if (RTEST(rb_thread_alive_p(thread)) && ! RTEST(rb_funcall(thread, ID_stop_p, 0))) { #endif DUMP1("caller is not yet ready to receive the result -> pending"); @@ -7044,7 +7044,7 @@ eval_queue_handler(evPtr, flags) #endif /* q_dat = Data_Wrap_Struct(rb_cData,0,-1,q); */ q_dat = Data_Wrap_Struct(rb_cData,eval_queue_mark,-1,q); - ret = rb_funcall(rb_proc_new(evq_safelevel_handler, q_dat), + ret = rb_funcall(rb_proc_new(evq_safelevel_handler, q_dat), ID_call, 0); rb_gc_force_recycle(q_dat); q_dat = (VALUE)NULL; @@ -7130,7 +7130,7 @@ ip_eval(self, str) if ( #ifdef RUBY_USE_NATIVE_THREAD (ptr->tk_thread_id == 0 || ptr->tk_thread_id == Tcl_GetCurrentThread()) - && + && #endif (NIL_P(eventloop_thread) || current == eventloop_thread) ) { @@ -7198,7 +7198,7 @@ ip_eval(self, str) Tcl_ThreadAlert(ptr->tk_thread_id); } else if (tk_eventloop_thread_id) { Tcl_ThreadQueueEvent(tk_eventloop_thread_id, (Tcl_Event*)evq, position); - /* Tcl_ThreadQueueEvent(tk_eventloop_thread_id, + /* Tcl_ThreadQueueEvent(tk_eventloop_thread_id, &(evq->ev), position); */ Tcl_ThreadAlert(tk_eventloop_thread_id); } else { @@ -7265,7 +7265,7 @@ ip_eval(self, str) if (rb_obj_is_kind_of(ret, rb_eException)) { DUMP1("raise exception"); /* rb_exc_raise(ret); */ - rb_exc_raise(rb_exc_new3(rb_obj_class(ret), + rb_exc_raise(rb_exc_new3(rb_obj_class(ret), rb_funcall(ret, ID_to_s, 0, 0))); } @@ -7280,7 +7280,7 @@ ip_cancel_eval_core(interp, msg, flag) int flag; { #if TCL_MAJOR_VERSION < 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 6) - rb_raise(rb_eNotImpError, + rb_raise(rb_eNotImpError, "cancel_eval is supported Tcl/Tk8.6 or later."); #else Tcl_Obj *msg_obj; @@ -7506,7 +7506,7 @@ lib_toUTF8_core(ip_obj, src, encodename) if (!RSTRING_LEN(enc)) { encoding = (Tcl_Encoding)NULL; } else { - encoding = Tcl_GetEncoding((Tcl_Interp*)NULL, + encoding = Tcl_GetEncoding((Tcl_Interp*)NULL, RSTRING_PTR(enc)); if (encoding == (Tcl_Encoding)NULL) { rb_warning("Tk-interp has unknown encoding information (@encoding:'%s')", RSTRING_PTR(enc)); @@ -7525,7 +7525,7 @@ lib_toUTF8_core(ip_obj, src, encodename) return str; } /* encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc)); */ - encoding = Tcl_GetEncoding((Tcl_Interp*)NULL, + encoding = Tcl_GetEncoding((Tcl_Interp*)NULL, RSTRING_PTR(enc)); if (encoding == (Tcl_Encoding)NULL) { rb_warning("string has unknown encoding information (@encoding:'%s')", RSTRING_PTR(enc)); @@ -7548,10 +7548,10 @@ lib_toUTF8_core(ip_obj, src, encodename) encoding = Tcl_GetEncoding((Tcl_Interp*)NULL, RSTRING_PTR(encodename)); if (encoding == (Tcl_Encoding)NULL) { /* - rb_warning("unknown encoding name '%s'", + rb_warning("unknown encoding name '%s'", RSTRING_PTR(encodename)); */ - rb_raise(rb_eArgError, "unknown encoding name '%s'", + rb_raise(rb_eArgError, "unknown encoding name '%s'", RSTRING_PTR(encodename)); } } @@ -7697,7 +7697,7 @@ lib_fromUTF8_core(ip_obj, src, encodename) if (!RSTRING_LEN(enc)) { encoding = (Tcl_Encoding)NULL; } else { - encoding = Tcl_GetEncoding((Tcl_Interp*)NULL, + encoding = Tcl_GetEncoding((Tcl_Interp*)NULL, RSTRING_PTR(enc)); if (encoding == (Tcl_Encoding)NULL) { rb_warning("Tk-interp has unknown encoding information (@encoding:'%s')", RSTRING_PTR(enc)); @@ -7735,12 +7735,12 @@ lib_fromUTF8_core(ip_obj, src, encodename) /* encoding = Tcl_GetEncoding(interp, RSTRING_PTR(encodename)); */ encoding = Tcl_GetEncoding((Tcl_Interp*)NULL, RSTRING_PTR(encodename)); if (encoding == (Tcl_Encoding)NULL) { - /* - rb_warning("unknown encoding name '%s'", + /* + rb_warning("unknown encoding name '%s'", RSTRING_PTR(encodename)); encodename = Qnil; */ - rb_raise(rb_eArgError, "unknown encoding name '%s'", + rb_raise(rb_eArgError, "unknown encoding name '%s'", RSTRING_PTR(encodename)); } } @@ -7948,9 +7948,9 @@ lib_set_system_encoding(self, enc_name) } enc_name = rb_funcall(enc_name, ID_to_s, 0, 0); - if (Tcl_SetSystemEncoding((Tcl_Interp *)NULL, + if (Tcl_SetSystemEncoding((Tcl_Interp *)NULL, StringValuePtr(enc_name)) != TCL_OK) { - rb_raise(rb_eArgError, "unknown encoding name '%s'", + rb_raise(rb_eArgError, "unknown encoding name '%s'", RSTRING_PTR(enc_name)); } @@ -8010,16 +8010,16 @@ invoke_tcl_proc(arg) /* Invoke the C procedure */ #if TCL_MAJOR_VERSION >= 8 if (inf->cmdinfo.isNativeObjectProc) { - inf->ptr->return_value - = (*(inf->cmdinfo.objProc))(inf->cmdinfo.objClientData, + inf->ptr->return_value + = (*(inf->cmdinfo.objProc))(inf->cmdinfo.objClientData, inf->ptr->ip, inf->objc, inf->objv); } else #endif { #if TCL_MAJOR_VERSION >= 8 - inf->ptr->return_value - = (*(inf->cmdinfo.proc))(inf->cmdinfo.clientData, inf->ptr->ip, + inf->ptr->return_value + = (*(inf->cmdinfo.proc))(inf->cmdinfo.clientData, inf->ptr->ip, argc, (CONST84 char **)argv); #if 0 /* use Tcl_EventuallyFree */ @@ -8034,8 +8034,8 @@ invoke_tcl_proc(arg) #endif #else /* TCL_MAJOR_VERSION < 8 */ - inf->ptr->return_value - = (*(inf->cmdinfo.proc))(inf->cmdinfo.clientData, inf->ptr->ip, + inf->ptr->return_value + = (*(inf->cmdinfo.proc))(inf->cmdinfo.clientData, inf->ptr->ip, inf->argc, inf->argv); #endif } @@ -8103,11 +8103,11 @@ ip_invoke_core(interp, argc, argv) if (!Tcl_GetCommandInfo(ptr->ip, cmd, &info)) { DUMP1("error Tcl_GetCommandInfo"); DUMP1("try auto_load (call 'unknown' command)"); - if (!Tcl_GetCommandInfo(ptr->ip, + if (!Tcl_GetCommandInfo(ptr->ip, #if TCL_MAJOR_VERSION >= 8 - "::unknown", + "::unknown", #else - "unknown", + "unknown", #endif &info)) { DUMP1("fail to get 'unknown' command"); @@ -8116,7 +8116,7 @@ ip_invoke_core(interp, argc, argv) /* Tcl_Release(ptr->ip); */ rbtk_release_ip(ptr); /*rb_ip_raise(obj,rb_eNameError,"invalid command name `%s'",cmd);*/ - return create_ip_exc(interp, rb_eNameError, + return create_ip_exc(interp, rb_eNameError, "invalid command name `%s'", cmd); } else { if (event_loop_abort_on_exc < 0) { @@ -8184,13 +8184,13 @@ ip_invoke_core(interp, argc, argv) switch(status) { case TAG_RAISE: if (NIL_P(rb_errinfo())) { - rbtk_pending_exception = rb_exc_new2(rb_eException, + rbtk_pending_exception = rb_exc_new2(rb_eException, "unknown exception"); } else { rbtk_pending_exception = rb_errinfo(); } break; - + case TAG_FATAL: if (NIL_P(rb_errinfo())) { rbtk_pending_exception = rb_exc_new2(rb_eFatal, "FATAL"); @@ -8224,7 +8224,7 @@ ip_invoke_core(interp, argc, argv) /* Invoke the C procedure */ #if TCL_MAJOR_VERSION >= 8 if (info.isNativeObjectProc) { - ptr->return_value = (*info.objProc)(info.objClientData, ptr->ip, + ptr->return_value = (*info.objProc)(info.objClientData, ptr->ip, objc, objv); #if 0 /* get the string value from the result object */ @@ -8237,7 +8237,7 @@ ip_invoke_core(interp, argc, argv) #endif { #if TCL_MAJOR_VERSION >= 8 - ptr->return_value = (*info.proc)(info.clientData, ptr->ip, + ptr->return_value = (*info.proc)(info.clientData, ptr->ip, argc, (CONST84 char **)argv); #if 0 /* use Tcl_EventuallyFree */ @@ -8252,7 +8252,7 @@ ip_invoke_core(interp, argc, argv) #endif #else /* TCL_MAJOR_VERSION < 8 */ - ptr->return_value = (*info.proc)(info.clientData, ptr->ip, + ptr->return_value = (*info.proc)(info.clientData, ptr->ip, argc, argv); #endif } @@ -8300,18 +8300,18 @@ ip_invoke_core(interp, argc, argv) if (event_loop_abort_on_exc > 0 && !Tcl_InterpDeleted(ptr->ip)) { switch (ptr->return_value) { case TCL_RETURN: - return create_ip_exc(interp, eTkCallbackReturn, + return create_ip_exc(interp, eTkCallbackReturn, "ip_invoke_core receives TCL_RETURN"); case TCL_BREAK: - return create_ip_exc(interp, eTkCallbackBreak, + return create_ip_exc(interp, eTkCallbackBreak, "ip_invoke_core receives TCL_BREAK"); case TCL_CONTINUE: - return create_ip_exc(interp, eTkCallbackContinue, + return create_ip_exc(interp, eTkCallbackContinue, "ip_invoke_core receives TCL_CONTINUE"); default: - return create_ip_exc(interp, rb_eRuntimeError, "%s", + return create_ip_exc(interp, rb_eRuntimeError, "%s", Tcl_GetStringResult(ptr->ip)); - } + } } else { if (event_loop_abort_on_exc < 0) { @@ -8503,7 +8503,7 @@ invoke_queue_handler(evPtr, flags) if (RTEST(rb_funcall(thread, ID_alive_p, 0)) && ! RTEST(rb_funcall(thread, ID_stop_p, 0))) { #else - if (RTEST(rb_thread_alive_p(thread)) + if (RTEST(rb_thread_alive_p(thread)) && ! RTEST(rb_funcall(thread, ID_stop_p, 0))) { #endif DUMP1("caller is not yet ready to receive the result -> pending"); @@ -8527,7 +8527,7 @@ invoke_queue_handler(evPtr, flags) if (rb_safe_level() != q->safe_level) { /* q_dat = Data_Wrap_Struct(rb_cData,0,0,q); */ q_dat = Data_Wrap_Struct(rb_cData,invoke_queue_mark,-1,q); - ret = rb_funcall(rb_proc_new(ivq_safelevel_handler, q_dat), + ret = rb_funcall(rb_proc_new(ivq_safelevel_handler, q_dat), ID_call, 0); rb_gc_force_recycle(q_dat); q_dat = (VALUE)NULL; @@ -8620,7 +8620,7 @@ ip_invoke_with_position(argc, argv, obj, position) if ( #ifdef RUBY_USE_NATIVE_THREAD (ptr->tk_thread_id == 0 || ptr->tk_thread_id == Tcl_GetCurrentThread()) - && + && #endif (NIL_P(eventloop_thread) || current == eventloop_thread) ) { @@ -8680,9 +8680,9 @@ ip_invoke_with_position(argc, argv, obj, position) Tcl_ThreadQueueEvent(ptr->tk_thread_id, (Tcl_Event*)ivq, position); Tcl_ThreadAlert(ptr->tk_thread_id); } else if (tk_eventloop_thread_id) { - /* Tcl_ThreadQueueEvent(tk_eventloop_thread_id, + /* Tcl_ThreadQueueEvent(tk_eventloop_thread_id, &(ivq->ev), position); */ - Tcl_ThreadQueueEvent(tk_eventloop_thread_id, + Tcl_ThreadQueueEvent(tk_eventloop_thread_id, (Tcl_Event*)ivq, position); Tcl_ThreadAlert(tk_eventloop_thread_id); } else { @@ -8746,7 +8746,7 @@ ip_invoke_with_position(argc, argv, obj, position) if (rb_obj_is_kind_of(ret, rb_eException)) { DUMP1("raise exception"); /* rb_exc_raise(ret); */ - rb_exc_raise(rb_exc_new3(rb_obj_class(ret), + rb_exc_raise(rb_exc_new3(rb_obj_class(ret), rb_funcall(ret, ID_to_s, 0, 0))); } @@ -8809,7 +8809,7 @@ ip_get_variable2_core(interp, argc, argv) index = argv[1]; flag = argv[2]; - /* + /* StringValue(varname); if (!NIL_P(index)) StringValue(index); */ @@ -8836,9 +8836,9 @@ ip_get_variable2_core(interp, argc, argv) if (ret == (Tcl_Obj*)NULL) { volatile VALUE exc; - /* exc = rb_exc_new2(rb_eRuntimeError, + /* exc = rb_exc_new2(rb_eRuntimeError, Tcl_GetStringResult(ptr->ip)); */ - exc = create_ip_exc(interp, rb_eRuntimeError, + exc = create_ip_exc(interp, rb_eRuntimeError, Tcl_GetStringResult(ptr->ip)); /* Tcl_Release(ptr->ip); */ rbtk_release_ip(ptr); @@ -8867,7 +8867,7 @@ ip_get_variable2_core(interp, argc, argv) } else { /* Tcl_Preserve(ptr->ip); */ rbtk_preserve_ip(ptr); - ret = Tcl_GetVar2(ptr->ip, RSTRING_PTR(varname), + ret = Tcl_GetVar2(ptr->ip, RSTRING_PTR(varname), NIL_P(index) ? NULL : RSTRING_PTR(index), FIX2INT(flag)); } @@ -8975,9 +8975,9 @@ ip_set_variable2_core(interp, argc, argv) if (ret == (Tcl_Obj*)NULL) { volatile VALUE exc; - /* exc = rb_exc_new2(rb_eRuntimeError, + /* exc = rb_exc_new2(rb_eRuntimeError, Tcl_GetStringResult(ptr->ip)); */ - exc = create_ip_exc(interp, rb_eRuntimeError, + exc = create_ip_exc(interp, rb_eRuntimeError, Tcl_GetStringResult(ptr->ip)); /* Tcl_Release(ptr->ip); */ rbtk_release_ip(ptr); @@ -9007,8 +9007,8 @@ ip_set_variable2_core(interp, argc, argv) } else { /* Tcl_Preserve(ptr->ip); */ rbtk_preserve_ip(ptr); - ret = Tcl_SetVar2(ptr->ip, RSTRING_PTR(varname), - NIL_P(index) ? NULL : RSTRING_PTR(index), + ret = Tcl_SetVar2(ptr->ip, RSTRING_PTR(varname), + NIL_P(index) ? NULL : RSTRING_PTR(index), RSTRING_PTR(value), FIX2INT(flag)); } @@ -9079,7 +9079,7 @@ ip_unset_variable2_core(interp, argc, argv) index = argv[1]; flag = argv[2]; - /* + /* StringValue(varname); if (!NIL_P(index)) StringValue(index); */ @@ -9089,15 +9089,15 @@ ip_unset_variable2_core(interp, argc, argv) return Qtrue; } - ptr->return_value = Tcl_UnsetVar2(ptr->ip, RSTRING_PTR(varname), + ptr->return_value = Tcl_UnsetVar2(ptr->ip, RSTRING_PTR(varname), NIL_P(index) ? NULL : RSTRING_PTR(index), FIX2INT(flag)); if (ptr->return_value == TCL_ERROR) { if (FIX2INT(flag) & TCL_LEAVE_ERR_MSG) { - /* return rb_exc_new2(rb_eRuntimeError, + /* return rb_exc_new2(rb_eRuntimeError, Tcl_GetStringResult(ptr->ip)); */ - return create_ip_exc(interp, rb_eRuntimeError, + return create_ip_exc(interp, rb_eRuntimeError, Tcl_GetStringResult(ptr->ip)); } return Qfalse; @@ -9145,7 +9145,7 @@ ip_get_global_var(self, varname) VALUE self; VALUE varname; { - return ip_get_variable(self, varname, + return ip_get_variable(self, varname, INT2FIX(TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG)); } @@ -9155,7 +9155,7 @@ ip_get_global_var2(self, varname, index) VALUE varname; VALUE index; { - return ip_get_variable2(self, varname, index, + return ip_get_variable2(self, varname, index, INT2FIX(TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG)); } @@ -9165,7 +9165,7 @@ ip_set_global_var(self, varname, value) VALUE varname; VALUE value; { - return ip_set_variable(self, varname, value, + return ip_set_variable(self, varname, value, INT2FIX(TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG)); } @@ -9176,7 +9176,7 @@ ip_set_global_var2(self, varname, index, value) VALUE index; VALUE value; { - return ip_set_variable2(self, varname, index, value, + return ip_set_variable2(self, varname, index, value, INT2FIX(TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG)); } @@ -9185,7 +9185,7 @@ ip_unset_global_var(self, varname) VALUE self; VALUE varname; { - return ip_unset_variable(self, varname, + return ip_unset_variable(self, varname, INT2FIX(TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG)); } @@ -9195,7 +9195,7 @@ ip_unset_global_var2(self, varname, index) VALUE varname; VALUE index; { - return ip_unset_variable2(self, varname, index, + return ip_unset_variable2(self, varname, index, INT2FIX(TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG)); } @@ -9302,7 +9302,7 @@ lib_split_tklist_core(ip_obj, list_str) int argc; char **argv; - if (Tcl_SplitList(interp, RSTRING_PTR(list_str), + if (Tcl_SplitList(interp, RSTRING_PTR(list_str), &argc, &argv) == TCL_ERROR) { if (interp == (Tcl_Interp*)NULL) { rb_raise(rb_eRuntimeError, "can't get elements from list"); @@ -9387,7 +9387,7 @@ lib_merge_tklist(argc, argv, obj) if (OBJ_TAINTED(argv[num])) taint_flag = 1; dst = StringValuePtr(argv[num]); #if TCL_MAJOR_VERSION >= 8 - len += Tcl_ScanCountedElement(dst, RSTRING_LEN(argv[num]), + len += Tcl_ScanCountedElement(dst, RSTRING_LEN(argv[num]), &flagPtr[num]) + 1; #else /* TCL_MAJOR_VERSION < 8 */ len += Tcl_ScanElement(dst, &flagPtr[num]) + 1; @@ -9403,8 +9403,8 @@ lib_merge_tklist(argc, argv, obj) dst = result; for(num = 0; num < argc; num++) { #if TCL_MAJOR_VERSION >= 8 - len = Tcl_ConvertCountedElement(RSTRING_PTR(argv[num]), - RSTRING_LEN(argv[num]), + len = Tcl_ConvertCountedElement(RSTRING_PTR(argv[num]), + RSTRING_LEN(argv[num]), dst, flagPtr[num]); #else /* TCL_MAJOR_VERSION < 8 */ len = Tcl_ConvertElement(RSTRING_PTR(argv[num]), dst, flagPtr[num]); @@ -9468,10 +9468,10 @@ lib_conv_listelement(self, src) StringValue(src); #if TCL_MAJOR_VERSION >= 8 - len = Tcl_ScanCountedElement(RSTRING_PTR(src), RSTRING_LEN(src), + len = Tcl_ScanCountedElement(RSTRING_PTR(src), RSTRING_LEN(src), &scan_flag); dst = rb_str_new(0, len + 1); - len = Tcl_ConvertCountedElement(RSTRING_PTR(src), RSTRING_LEN(src), + len = Tcl_ConvertCountedElement(RSTRING_PTR(src), RSTRING_LEN(src), RSTRING_PTR(dst), scan_flag); #else /* TCL_MAJOR_VERSION < 8 */ len = Tcl_ScanElement(RSTRING_PTR(src), &scan_flag); @@ -9493,9 +9493,9 @@ lib_getversion(self) { set_tcltk_version(); - return rb_ary_new3(4, INT2NUM(tcltk_version.major), - INT2NUM(tcltk_version.minor), - INT2NUM(tcltk_version.type), + return rb_ary_new3(4, INT2NUM(tcltk_version.major), + INT2NUM(tcltk_version.minor), + INT2NUM(tcltk_version.type), INT2NUM(tcltk_version.patchlevel)); } @@ -9523,7 +9523,7 @@ tcltklib_compile_info() { volatile VALUE ret; int size; - char form[] + char form[] = "tcltklib %s :: Ruby%s (%s) %s pthread :: Tcl%s(%s)/Tk%s(%s) %s"; char *info; @@ -9531,31 +9531,31 @@ tcltklib_compile_info() + strlen(TCLTKLIB_RELEASE_DATE) + strlen(RUBY_VERSION) + strlen(RUBY_RELEASE_DATE) - + strlen("without") + + strlen("without") + strlen(TCL_PATCH_LEVEL) + strlen("without stub") + strlen(TK_PATCH_LEVEL) - + strlen("without stub") + + strlen("without stub") + strlen("unknown tcl_threads"); info = ALLOC_N(char, size); /* info = ckalloc(sizeof(char) * size); */ /* SEGV */ sprintf(info, form, - TCLTKLIB_RELEASE_DATE, - RUBY_VERSION, RUBY_RELEASE_DATE, + TCLTKLIB_RELEASE_DATE, + RUBY_VERSION, RUBY_RELEASE_DATE, #ifdef HAVE_NATIVETHREAD "with", #else "without", #endif - TCL_PATCH_LEVEL, + TCL_PATCH_LEVEL, #ifdef USE_TCL_STUBS "with stub", #else "without stub", #endif - TK_PATCH_LEVEL, + TK_PATCH_LEVEL, #ifdef USE_TK_STUBS "with stub", #else @@ -9598,7 +9598,7 @@ create_dummy_encoding_for_tk_core(interp, name, error_mode) #if TCL_MAJOR_VERSION > 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 1) if (Tcl_GetEncoding((Tcl_Interp*)NULL, RSTRING_PTR(name)) == (Tcl_Encoding)NULL) { if (RTEST(error_mode)) { - rb_raise(rb_eArgError, "invalid Tk encoding name '%s'", + rb_raise(rb_eArgError, "invalid Tk encoding name '%s'", RSTRING_PTR(name)); } else { return Qnil; @@ -9657,7 +9657,7 @@ update_encoding_table(table, interp, error_mode) enc_list = Tcl_GetObjResult(ptr->ip); Tcl_IncrRefCount(enc_list); - if (Tcl_ListObjGetElements(ptr->ip, enc_list, + if (Tcl_ListObjGetElements(ptr->ip, enc_list, &objc, &objv) != TCL_OK) { Tcl_DecrRefCount(enc_list); /* rb_raise(rb_eRuntimeError, "failt to get Tcl's encoding names");*/ @@ -9804,7 +9804,7 @@ encoding_table_get_obj_core(table, enc, error_mode) { volatile VALUE obj = Qnil; - obj = rb_hash_lookup(table, + obj = rb_hash_lookup(table, encoding_table_get_name_core(table, enc, error_mode)); if (RTEST(rb_obj_is_kind_of(obj, cRubyEncoding))) { return obj; @@ -9878,7 +9878,7 @@ encoding_table_get_name_core(table, enc, error_mode) } /* update check */ - if (update_encoding_table(table, rb_ivar_get(table, ID_at_interp), + if (update_encoding_table(table, rb_ivar_get(table, ID_at_interp), error_mode)) { /* add new relations to the table */ /* RETRY: registered Ruby encoding? */ @@ -9962,7 +9962,7 @@ create_encoding_table_core(arg, interp) encobj = rb_enc_from_encoding(rb_enc_from_index(ENCODING_INDEX_BINARY)); rb_hash_aset(table, ENCODING_NAME_BINARY, encobj); rb_hash_aset(table, encobj, ENCODING_NAME_BINARY); - + /* Tcl stub check */ tcl_stubs_check(); @@ -10094,7 +10094,7 @@ static VALUE create_encoding_table(interp) VALUE interp; { - return rb_funcall(rb_proc_new(create_encoding_table_core, interp), + return rb_funcall(rb_proc_new(create_encoding_table_core, interp), ID_call, 0); } @@ -10120,7 +10120,7 @@ ip_get_encoding_table(interp) /*###############################################*/ /* - * The following is based on tkMenu.[ch] + * The following is based on tkMenu.[ch] * of Tcl/Tk (Tk8.0 -- Tk8.5b1) source code. */ #if TCL_MAJOR_VERSION >= 8 @@ -10183,10 +10183,10 @@ ip_make_menu_embeddable_core(interp, argc, argv) #if 0 /* was available on Tk8.0 -- Tk8.4 */ menuRefPtr = TkFindMenuReferences(ptr->ip, RSTRING_PTR(menu_path)); #else /* based on Tk8.0 -- Tk8.5b1 */ - if ((menuTablePtr + if ((menuTablePtr = (Tcl_HashTable *) Tcl_GetAssocData(ptr->ip, MENU_HASH_KEY, NULL)) != NULL) { - if ((hashEntryPtr + if ((hashEntryPtr = Tcl_FindHashEntry(menuTablePtr, RSTRING_PTR(menu_path))) != NULL) { menuRefPtr = (struct dummy_TkMenuRef *) Tcl_GetHashValue(hashEntryPtr); @@ -10199,12 +10199,12 @@ ip_make_menu_embeddable_core(interp, argc, argv) } if (menuRefPtr->menuPtr == (struct dummy_TkMenu *) NULL) { - rb_raise(rb_eRuntimeError, + rb_raise(rb_eRuntimeError, "invalid menu widget (maybe already destroyed)"); } if ((menuRefPtr->menuPtr)->menuType != MENUBAR) { - rb_raise(rb_eRuntimeError, + rb_raise(rb_eRuntimeError, "target menu widget must be a MENUBAR type"); } @@ -10223,7 +10223,7 @@ ip_make_menu_embeddable_core(interp, argc, argv) #if 0 /* was available on Tk8.0 -- Tk8.4 */ TkEventuallyRecomputeMenu(menuRefPtr->menuPtr); - TkEventuallyRedrawMenu(menuRefPtr->menuPtr, + TkEventuallyRedrawMenu(menuRefPtr->menuPtr, (struct dummy_TkMenuEntry *)NULL); #else /* based on Tk8.0 -- Tk8.5b1 */ memset((void *) &event, 0, sizeof(event)); @@ -10306,10 +10306,10 @@ Init_tcltklib() rb_define_const(lib, "COMPILE_INFO", tcltklib_compile_info()); - rb_define_const(lib, "RELEASE_DATE", + rb_define_const(lib, "RELEASE_DATE", rb_obj_freeze(rb_str_new2(tcltklib_release_date))); - rb_define_const(lib, "FINALIZE_PROC_NAME", + rb_define_const(lib, "FINALIZE_PROC_NAME", rb_str_new2(finalize_hook_name)); /* --------------------------------------------------------------- */ @@ -10327,7 +10327,7 @@ Init_tcltklib() #endif #endif #endif - rb_define_const(lib, "WINDOWING_SYSTEM", + rb_define_const(lib, "WINDOWING_SYSTEM", rb_obj_freeze(rb_str_new2(TK_WINDOWING_SYSTEM))); /* --------------------------------------------------------------- */ @@ -10361,7 +10361,7 @@ Init_tcltklib() /* --------------------------------------------------------------- */ rb_define_module_function(lib, "get_version", lib_getversion, -1); - rb_define_module_function(lib, "get_release_type_name", + rb_define_module_function(lib, "get_release_type_name", lib_get_reltype_name, -1); rb_define_const(release_type, "ALPHA", INT2FIX(TCL_ALPHA_RELEASE)); @@ -10413,53 +10413,53 @@ Init_tcltklib() /* --------------------------------------------------------------- */ rb_define_module_function(lib, "mainloop", lib_mainloop, -1); - rb_define_module_function(lib, "mainloop_thread?", + rb_define_module_function(lib, "mainloop_thread?", lib_evloop_thread_p, 0); - rb_define_module_function(lib, "mainloop_watchdog", + rb_define_module_function(lib, "mainloop_watchdog", lib_mainloop_watchdog, -1); - rb_define_module_function(lib, "do_thread_callback", + rb_define_module_function(lib, "do_thread_callback", lib_thread_callback, -1); rb_define_module_function(lib, "do_one_event", lib_do_one_event, -1); - rb_define_module_function(lib, "mainloop_abort_on_exception", + rb_define_module_function(lib, "mainloop_abort_on_exception", lib_evloop_abort_on_exc, 0); - rb_define_module_function(lib, "mainloop_abort_on_exception=", + rb_define_module_function(lib, "mainloop_abort_on_exception=", lib_evloop_abort_on_exc_set, 1); - rb_define_module_function(lib, "set_eventloop_window_mode", + rb_define_module_function(lib, "set_eventloop_window_mode", set_eventloop_window_mode, 1); - rb_define_module_function(lib, "get_eventloop_window_mode", + rb_define_module_function(lib, "get_eventloop_window_mode", get_eventloop_window_mode, 0); rb_define_module_function(lib, "set_eventloop_tick",set_eventloop_tick,1); rb_define_module_function(lib, "get_eventloop_tick",get_eventloop_tick,0); rb_define_module_function(lib, "set_no_event_wait", set_no_event_wait, 1); rb_define_module_function(lib, "get_no_event_wait", get_no_event_wait, 0); - rb_define_module_function(lib, "set_eventloop_weight", + rb_define_module_function(lib, "set_eventloop_weight", set_eventloop_weight, 2); rb_define_module_function(lib, "set_max_block_time", set_max_block_time,1); - rb_define_module_function(lib, "get_eventloop_weight", + rb_define_module_function(lib, "get_eventloop_weight", get_eventloop_weight, 0); - rb_define_module_function(lib, "num_of_mainwindows", + rb_define_module_function(lib, "num_of_mainwindows", lib_num_of_mainwindows, 0); /* --------------------------------------------------------------- */ rb_define_module_function(lib, "_split_tklist", lib_split_tklist, 1); rb_define_module_function(lib, "_merge_tklist", lib_merge_tklist, -1); - rb_define_module_function(lib, "_conv_listelement", + rb_define_module_function(lib, "_conv_listelement", lib_conv_listelement, 1); rb_define_module_function(lib, "_toUTF8", lib_toUTF8, -1); rb_define_module_function(lib, "_fromUTF8", lib_fromUTF8, -1); - rb_define_module_function(lib, "_subst_UTF_backslash", + rb_define_module_function(lib, "_subst_UTF_backslash", lib_UTF_backslash, 1); - rb_define_module_function(lib, "_subst_Tcl_backslash", + rb_define_module_function(lib, "_subst_Tcl_backslash", lib_Tcl_backslash, 1); - rb_define_module_function(lib, "encoding_system", + rb_define_module_function(lib, "encoding_system", lib_get_system_encoding, 0); - rb_define_module_function(lib, "encoding_system=", + rb_define_module_function(lib, "encoding_system=", lib_set_system_encoding, 1); - rb_define_module_function(lib, "encoding", + rb_define_module_function(lib, "encoding", lib_get_system_encoding, 0); - rb_define_module_function(lib, "encoding=", + rb_define_module_function(lib, "encoding=", lib_set_system_encoding, 1); /* --------------------------------------------------------------- */ @@ -10491,7 +10491,7 @@ Init_tcltklib() /* --------------------------------------------------------------- */ - rb_define_method(ip, "create_dummy_encoding_for_tk", + rb_define_method(ip, "create_dummy_encoding_for_tk", create_dummy_encoding_for_tk, 1); rb_define_method(ip, "encoding_table", ip_get_encoding_table, 0); @@ -10525,9 +10525,9 @@ Init_tcltklib() rb_define_method(ip, "mainloop", ip_mainloop, -1); rb_define_method(ip, "mainloop_watchdog", ip_mainloop_watchdog, -1); rb_define_method(ip, "do_one_event", ip_do_one_event, -1); - rb_define_method(ip, "mainloop_abort_on_exception", + rb_define_method(ip, "mainloop_abort_on_exception", ip_evloop_abort_on_exc, 0); - rb_define_method(ip, "mainloop_abort_on_exception=", + rb_define_method(ip, "mainloop_abort_on_exception=", ip_evloop_abort_on_exc_set, 1); rb_define_method(ip, "set_eventloop_tick", ip_set_eventloop_tick, 1); rb_define_method(ip, "get_eventloop_tick", ip_get_eventloop_tick, 0); @@ -10545,7 +10545,7 @@ Init_tcltklib() #ifndef DEFAULT_EVENTLOOP_DEPTH #define DEFAULT_EVENTLOOP_DEPTH 7 -#endif +#endif eventloop_stack = rb_ary_new2(DEFAULT_EVENTLOOP_DEPTH); RbTk_OBJ_UNTRUST(eventloop_stack); @@ -10556,7 +10556,7 @@ Init_tcltklib() /* --------------------------------------------------------------- */ #ifdef HAVE_NATIVETHREAD - /* if ruby->nativethread-supprt and tcltklib->doen't, + /* if ruby->nativethread-supprt and tcltklib->doen't, the following will cause link-error. */ ruby_native_thread_p(); #endif diff --git a/ext/tk/tkutil/tkutil.c b/ext/tk/tkutil/tkutil.c index ef41bb75a2..2f92b334bb 100644 --- a/ext/tk/tkutil/tkutil.c +++ b/ext/tk/tkutil/tkutil.c @@ -155,7 +155,7 @@ tk_do_callback(argc, argv, self) rb_scan_args(argc, argv, "1*", &id, &rest); return rb_apply(rb_hash_aref(CALLBACK_TABLE, id), ID_call, rest); #endif - return rb_funcall2(rb_hash_aref(CALLBACK_TABLE, argv[0]), + return rb_funcall2(rb_hash_aref(CALLBACK_TABLE, argv[0]), ID_call, argc - 1, argv + 1); } @@ -209,12 +209,12 @@ tk_uninstall_cmd(self, cmd_id) if (strncmp(cmd_id_head, RSTRING_PTR(cmd_id), head_len) != 0) { return Qnil; } - if (strncmp(cmd_id_prefix, + if (strncmp(cmd_id_prefix, RSTRING_PTR(cmd_id) + head_len, prefix_len) != 0) { return Qnil; } - return rb_hash_delete(CALLBACK_TABLE, + return rb_hash_delete(CALLBACK_TABLE, rb_str_new2(RSTRING_PTR(cmd_id) + head_len)); } @@ -697,7 +697,7 @@ push_kv_enc(key, val, args) #if 0 rb_ary_push(ary, key2keyname(key)); if (val != TK_None) { - rb_ary_push(ary, get_eval_string_core(val, Qtrue, + rb_ary_push(ary, get_eval_string_core(val, Qtrue, RARRAY_PTR(args)[1])); } #endif @@ -829,7 +829,7 @@ get_eval_string_core(obj, enc_flag, self) case T_SYMBOL: if (RTEST(enc_flag)) { if (rb_obj_respond_to(self, ID_toUTF8, Qtrue)) { - return rb_funcall(self, ID_toUTF8, 1, + return rb_funcall(self, ID_toUTF8, 1, rb_str_new2(rb_id2name(SYM2ID(obj)))); } else { return fromDefaultEnc_toUTF8(rb_str_new2(rb_id2name(SYM2ID(obj))), self); @@ -867,7 +867,7 @@ get_eval_string_core(obj, enc_flag, self) default: if (rb_obj_is_kind_of(obj, cTkObject)) { /* return rb_str_new3(rb_funcall(obj, ID_path, 0, 0)); */ - return get_eval_string_core(rb_funcall(obj, ID_path, 0, 0), + return get_eval_string_core(rb_funcall(obj, ID_path, 0, 0), enc_flag, self); } @@ -885,18 +885,18 @@ get_eval_string_core(obj, enc_flag, self) if (rb_obj_respond_to(obj, ID_to_eval, Qtrue)) { /* return rb_funcall(obj, ID_to_eval, 0, 0); */ - return get_eval_string_core(rb_funcall(obj, ID_to_eval, 0, 0), + return get_eval_string_core(rb_funcall(obj, ID_to_eval, 0, 0), enc_flag, self); } else if (rb_obj_respond_to(obj, ID_path, Qtrue)) { /* return rb_funcall(obj, ID_path, 0, 0); */ - return get_eval_string_core(rb_funcall(obj, ID_path, 0, 0), + return get_eval_string_core(rb_funcall(obj, ID_path, 0, 0), enc_flag, self); } else if (rb_obj_respond_to(obj, ID_to_s, Qtrue)) { return rb_funcall(obj, ID_to_s, 0, 0); } } - rb_warning("fail to convert '%s' to string for Tk", + rb_warning("fail to convert '%s' to string for Tk", RSTRING_PTR(rb_funcall(obj, rb_intern("inspect"), 0, 0))); return obj; @@ -1039,7 +1039,7 @@ static VALUE tkstr_invalid_numstr(value) VALUE value; { - rb_raise(rb_eArgError, + rb_raise(rb_eArgError, "invalid value for Number: '%s'", RSTRING_PTR(value)); return Qnil; /*dummy*/ } @@ -1048,8 +1048,8 @@ static VALUE tkstr_rescue_float(value) VALUE value; { - return rb_rescue2(tkstr_to_float, value, - tkstr_invalid_numstr, value, + return rb_rescue2(tkstr_to_float, value, + tkstr_invalid_numstr, value, rb_eArgError, 0); } @@ -1061,8 +1061,8 @@ tkstr_to_number(value) if (RSTRING_PTR(value) == (char*)NULL) return INT2FIX(0); - return rb_rescue2(tkstr_to_int, value, - tkstr_rescue_float, value, + return rb_rescue2(tkstr_to_int, value, + tkstr_rescue_float, value, rb_eArgError, 0); } @@ -1111,8 +1111,8 @@ tcl2rb_num_or_str(self, value) if (RSTRING_PTR(value) == (char*)NULL) return rb_tainted_str_new2(""); - return rb_rescue2(tkstr_to_number, value, - tkstr_to_str, value, + return rb_rescue2(tkstr_to_number, value, + tkstr_to_str, value, rb_eArgError, 0); } @@ -1199,7 +1199,7 @@ allocate_cbsubst_info(struct cbsubst_info **inf_ptr) static void cbsubst_init() { - rb_const_set(cCB_SUBST, ID_SUBST_INFO, + rb_const_set(cCB_SUBST, ID_SUBST_INFO, allocate_cbsubst_info((struct cbsubst_info **)NULL)); } @@ -1212,7 +1212,7 @@ cbsubst_initialize(argc, argv, self) struct cbsubst_info *inf; int idx, iv_idx; - Data_Get_Struct(rb_const_get(rb_obj_class(self), ID_SUBST_INFO), + Data_Get_Struct(rb_const_get(rb_obj_class(self), ID_SUBST_INFO), struct cbsubst_info, inf); idx = 0; @@ -1252,7 +1252,7 @@ each_attr_def(key, value, klass) key_id = SYM2ID(key); break; default: - rb_raise(rb_eArgError, + rb_raise(rb_eArgError, "includes invalid key(s). expected a String or a Symbol"); } @@ -1264,7 +1264,7 @@ each_attr_def(key, value, klass) value_id = SYM2ID(value); break; default: - rb_raise(rb_eArgError, + rb_raise(rb_eArgError, "includes invalid value(s). expected a String or a Symbol"); } @@ -1284,7 +1284,7 @@ cbsubst_def_attr_aliases(self, tbl) rb_raise(rb_eArgError, "expected a Hash"); } - Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO), + Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO), struct cbsubst_info, inf); rb_hash_foreach(tbl, each_attr_def, self); @@ -1306,7 +1306,7 @@ cbsubst_sym_to_subst(self, sym) if (TYPE(sym) != T_SYMBOL) return sym; - Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO), + Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO), struct cbsubst_info, inf); if (!NIL_P(ret = rb_hash_aref(inf->aliases, sym))) { @@ -1358,7 +1358,7 @@ cbsubst_get_subst_arg(argc, argv, self) ID id; volatile VALUE arg_sym, ret; - Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO), + Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO), struct cbsubst_info, inf); ptr = buf = ALLOC_N(char, inf->full_subst_length + 1); @@ -1428,7 +1428,7 @@ cbsubst_get_subst_key(self, str) list = rb_funcall(cTclTkLib, ID_split_tklist, 1, str); len = RARRAY_LEN(list); - Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO), + Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO), struct cbsubst_info, inf); ptr = buf = ALLOC_N(char, inf->full_subst_length + len + 1); @@ -1476,7 +1476,7 @@ cbsubst_get_all_subst_keys(self) int idx, len; volatile VALUE ret; - Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO), + Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO), struct cbsubst_info, inf); ptr = buf = ALLOC_N(char, inf->full_subst_length + 1); @@ -1587,7 +1587,7 @@ cbsubst_table_setup(argc, argv, self) chr = (unsigned char)(0x80 + idx); subst_inf->keylen[chr] = RSTRING_LEN(RARRAY_PTR(inf)[0]); #if HAVE_STRNDUP - subst_inf->key[chr] = strndup(RSTRING_PTR(RARRAY_PTR(inf)[0]), + subst_inf->key[chr] = strndup(RSTRING_PTR(RARRAY_PTR(inf)[0]), RSTRING_LEN(RARRAY_PTR(inf)[0])); #else subst_inf->key[chr] = malloc(RSTRING_LEN(RARRAY_PTR(inf)[0]) + 1); @@ -1620,10 +1620,10 @@ cbsubst_table_setup(argc, argv, self) for(idx = 0; idx < len; idx++) { inf = RARRAY_PTR(proc_inf)[idx]; if (TYPE(inf) != T_ARRAY) continue; - rb_hash_aset(subst_inf->proc, - ((TYPE(RARRAY_PTR(inf)[0]) == T_STRING)? - INT2FIX(*(RSTRING_PTR(RARRAY_PTR(inf)[0]))) : - RARRAY_PTR(inf)[0]), + rb_hash_aset(subst_inf->proc, + ((TYPE(RARRAY_PTR(inf)[0]) == T_STRING)? + INT2FIX(*(RSTRING_PTR(RARRAY_PTR(inf)[0]))) : + RARRAY_PTR(inf)[0]), RARRAY_PTR(inf)[1]); } @@ -1661,7 +1661,7 @@ cbsubst_scan_args(self, arg_key, val_ary) old_gc = rb_gc_disable(); - Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO), + Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO), struct cbsubst_info, inf); for(idx = 0; idx < vallen; idx++) { @@ -1680,7 +1680,7 @@ cbsubst_scan_args(self, arg_key, val_ary) if (NIL_P(proc)) { rb_ary_push(dst, RARRAY_PTR(val_ary)[idx]); } else { - rb_ary_push(dst, rb_funcall(proc, ID_call, 1, + rb_ary_push(dst, rb_funcall(proc, ID_call, 1, RARRAY_PTR(val_ary)[idx])); } } @@ -1736,7 +1736,7 @@ Init_tkutil() /* --------------------- */ - rb_define_const(mTK, "RELEASE_DATE", + rb_define_const(mTK, "RELEASE_DATE", rb_obj_freeze(rb_str_new2(tkutil_release_date))); /* --------------------- */ @@ -1766,19 +1766,19 @@ Init_tkutil() ID_SUBST_INFO = rb_intern("SUBST_INFO"); rb_define_singleton_method(cCB_SUBST, "ret_val", cbsubst_ret_val, 1); rb_define_singleton_method(cCB_SUBST, "scan_args", cbsubst_scan_args, 2); - rb_define_singleton_method(cCB_SUBST, "_sym2subst", + rb_define_singleton_method(cCB_SUBST, "_sym2subst", cbsubst_sym_to_subst, 1); - rb_define_singleton_method(cCB_SUBST, "subst_arg", + rb_define_singleton_method(cCB_SUBST, "subst_arg", cbsubst_get_subst_arg, -1); - rb_define_singleton_method(cCB_SUBST, "_get_subst_key", + rb_define_singleton_method(cCB_SUBST, "_get_subst_key", cbsubst_get_subst_key, 1); - rb_define_singleton_method(cCB_SUBST, "_get_all_subst_keys", + rb_define_singleton_method(cCB_SUBST, "_get_all_subst_keys", cbsubst_get_all_subst_keys, 0); - rb_define_singleton_method(cCB_SUBST, "_setup_subst_table", + rb_define_singleton_method(cCB_SUBST, "_setup_subst_table", cbsubst_table_setup, -1); - rb_define_singleton_method(cCB_SUBST, "_get_extra_args_tbl", + rb_define_singleton_method(cCB_SUBST, "_get_extra_args_tbl", cbsubst_get_extra_args_tbl, 0); - rb_define_singleton_method(cCB_SUBST, "_define_attribute_aliases", + rb_define_singleton_method(cCB_SUBST, "_define_attribute_aliases", cbsubst_def_attr_aliases, 1); rb_define_method(cCB_SUBST, "initialize", cbsubst_initialize, -1); @@ -1827,9 +1827,9 @@ Init_tkutil() rb_define_singleton_method(mTK, "uninstall_cmd", tk_uninstall_cmd, 1); rb_define_singleton_method(mTK, "_symbolkey2str", tk_symbolkey2str, 1); rb_define_singleton_method(mTK, "hash_kv", tk_hash_kv, -1); - rb_define_singleton_method(mTK, "_get_eval_string", + rb_define_singleton_method(mTK, "_get_eval_string", tk_get_eval_string, -1); - rb_define_singleton_method(mTK, "_get_eval_enc_str", + rb_define_singleton_method(mTK, "_get_eval_enc_str", tk_get_eval_enc_str, 1); rb_define_singleton_method(mTK, "_conv_args", tk_conv_args, -1); diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c index 3fff8ba171..ce288f3b95 100644 --- a/ext/win32ole/win32ole.c +++ b/ext/win32ole/win32ole.c @@ -85,7 +85,7 @@ #endif /* - * unfortunately IID_IMultiLanguage2 is not included in any libXXX.a + * unfortunately IID_IMultiLanguage2 is not included in any libXXX.a * in Cygwin(mingw32). */ #if defined(__CYGWIN__) || defined(__MINGW32__) @@ -575,7 +575,7 @@ static VALUE folevariant_vartype(VALUE self); static VALUE folevariant_set_value(VALUE self, VALUE val); static void init_enc2cp(); static void free_enc2cp(); - + static HRESULT (STDMETHODCALLTYPE mf_QueryInterface)( IMessageFilter __RPC_FAR * This, /* [in] */ REFIID riid, @@ -590,13 +590,13 @@ static HRESULT (STDMETHODCALLTYPE mf_QueryInterface)( return E_NOINTERFACE; } -static ULONG (STDMETHODCALLTYPE mf_AddRef)( +static ULONG (STDMETHODCALLTYPE mf_AddRef)( IMessageFilter __RPC_FAR * This) { return 1; } - -static ULONG (STDMETHODCALLTYPE mf_Release)( + +static ULONG (STDMETHODCALLTYPE mf_Release)( IMessageFilter __RPC_FAR * This) { return 1; @@ -670,7 +670,7 @@ static DWORD (STDMETHODCALLTYPE mf_MessagePending)( } return PENDINGMSG_WAITNOPROCESS; } - + typedef struct _Win32OLEIDispatch { IDispatch dispatch; @@ -678,7 +678,7 @@ typedef struct _Win32OLEIDispatch VALUE obj; } Win32OLEIDispatch; -static HRESULT ( STDMETHODCALLTYPE QueryInterface )( +static HRESULT ( STDMETHODCALLTYPE QueryInterface )( IDispatch __RPC_FAR * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject) @@ -693,15 +693,15 @@ static HRESULT ( STDMETHODCALLTYPE QueryInterface )( } return E_NOINTERFACE; } - -static ULONG ( STDMETHODCALLTYPE AddRef )( + +static ULONG ( STDMETHODCALLTYPE AddRef )( IDispatch __RPC_FAR * This) { Win32OLEIDispatch* p = (Win32OLEIDispatch*)This; return ++(p->refcount); } - -static ULONG ( STDMETHODCALLTYPE Release )( + +static ULONG ( STDMETHODCALLTYPE Release )( IDispatch __RPC_FAR * This) { Win32OLEIDispatch* p = (Win32OLEIDispatch*)This; @@ -713,15 +713,15 @@ static ULONG ( STDMETHODCALLTYPE Release )( } return u; } - -static HRESULT ( STDMETHODCALLTYPE GetTypeInfoCount )( + +static HRESULT ( STDMETHODCALLTYPE GetTypeInfoCount )( IDispatch __RPC_FAR * This, /* [out] */ UINT __RPC_FAR *pctinfo) { return E_NOTIMPL; } - -static HRESULT ( STDMETHODCALLTYPE GetTypeInfo )( + +static HRESULT ( STDMETHODCALLTYPE GetTypeInfo )( IDispatch __RPC_FAR * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, @@ -730,8 +730,8 @@ static HRESULT ( STDMETHODCALLTYPE GetTypeInfo )( return E_NOTIMPL; } - -static HRESULT ( STDMETHODCALLTYPE GetIDsOfNames )( + +static HRESULT ( STDMETHODCALLTYPE GetIDsOfNames )( IDispatch __RPC_FAR * This, /* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, @@ -747,8 +747,8 @@ static HRESULT ( STDMETHODCALLTYPE GetIDsOfNames )( free(psz); return S_OK; } - -static /* [local] */ HRESULT ( STDMETHODCALLTYPE Invoke )( + +static /* [local] */ HRESULT ( STDMETHODCALLTYPE Invoke )( IDispatch __RPC_FAR * This, /* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, @@ -842,7 +842,7 @@ vtdate2rbtime(double date) static UINT ole_encoding2cp(rb_encoding *enc) { /* - * Is there any better solution to convert + * Is there any better solution to convert * Ruby encoding to Windows codepage??? */ ENC_MACHING_CP(enc, "Big5", 950); @@ -851,7 +851,7 @@ static UINT ole_encoding2cp(rb_encoding *enc) ENC_MACHING_CP(enc, "CP852", 852); ENC_MACHING_CP(enc, "CP855", 855); ENC_MACHING_CP(enc, "CP949", 949); - ENC_MACHING_CP(enc, "EUC-JP", 20932); + ENC_MACHING_CP(enc, "EUC-JP", 20932); ENC_MACHING_CP(enc, "EUC-KR", 51949); ENC_MACHING_CP(enc, "EUC-TW", 51950); ENC_MACHING_CP(enc, "GB18030", 54936); @@ -1026,7 +1026,7 @@ ole_cp2encoding(UINT cp) case CP_UTF7: case CP_UTF8: break; - case 51932: + case 51932: load_conv_function51932(); break; default: @@ -1067,7 +1067,7 @@ ole_wc2mb(LPWSTR pw) } size = WideCharToMultiByte(cWIN32OLE_cp, 0, pw, -1, NULL, 0, NULL, NULL); if (size) { - pm = ALLOC_N(char, size + 1); + pm = ALLOC_N(char, size + 1); WideCharToMultiByte(cWIN32OLE_cp, 0, pw, -1, pm, size, NULL, NULL); pm[size] = '\0'; } @@ -1076,7 +1076,7 @@ ole_wc2mb(LPWSTR pw) *pm = '\0'; } return pm; -} +} static VALUE ole_hresult2msg(HRESULT hr) @@ -1188,10 +1188,10 @@ ole_uninitialize() } static void -ole_initialize() +ole_initialize() { HRESULT hr; - + if(g_ole_initialized == FALSE) { hr = OleInitialize(NULL); if(FAILED(hr)) { @@ -1442,7 +1442,7 @@ get_ptr_of_variant(VARIANT *pvar) } static VALUE -is_all_index_under(long *pid, long *pub, long dim) +is_all_index_under(long *pid, long *pub, long dim) { long i = 0; for (i = 0; i < dim; i++) { @@ -1504,7 +1504,7 @@ dimension(VALUE val) { return dim; } -static long +static long ary_len_of_dim(VALUE ary, long dim) { long ary_len = 0; long ary_len1 = 0; @@ -1873,7 +1873,7 @@ ole_val2olevariantdata(VALUE val, VARTYPE vt, struct olevariantdata *pvar) hr = VariantCopy(&(pvar->var), &(pvar->realvar)); } } else { - if (psa) + if (psa) SafeArrayDestroy(psa); } } else if (vt & VT_ARRAY) { @@ -1919,7 +1919,7 @@ ole_val2olevariantdata(VALUE val, VARTYPE vt, struct olevariantdata *pvar) ole_set_byref(&(pvar->realvar), &(pvar->var), vt); } else if (vt & VT_BYREF) { if ( (vt & ~VT_BYREF) != V_VT(&(pvar->realvar))) { - hr = VariantChangeTypeEx(&(pvar->realvar), &(pvar->realvar), + hr = VariantChangeTypeEx(&(pvar->realvar), &(pvar->realvar), cWIN32OLE_lcid, 0, (VARTYPE)(vt & ~VT_BYREF)); } if (SUCCEEDED(hr)) { @@ -1929,7 +1929,7 @@ ole_val2olevariantdata(VALUE val, VARTYPE vt, struct olevariantdata *pvar) if (vt == V_VT(&(pvar->realvar))) { hr = VariantCopy(&(pvar->var), &(pvar->realvar)); } else { - hr = VariantChangeTypeEx(&(pvar->var), &(pvar->realvar), + hr = VariantChangeTypeEx(&(pvar->var), &(pvar->realvar), cWIN32OLE_lcid, 0, vt); } } @@ -1949,7 +1949,7 @@ ole_val2variant2(VALUE val, VARIANT *var) } static VALUE -make_inspect(const char *class_name, VALUE detail) +make_inspect(const char *class_name, VALUE detail) { VALUE str; str = rb_str_new2("#<"); @@ -1961,7 +1961,7 @@ make_inspect(const char *class_name, VALUE detail) } static VALUE -default_inspect(VALUE self, const char *class_name) +default_inspect(VALUE self, const char *class_name) { VALUE detail = rb_funcall(self, rb_intern("to_s"), 0); return make_inspect(class_name, detail); @@ -2101,58 +2101,58 @@ ole_variant2val(VARIANT *pvar) case VT_NULL: break; case VT_I1: - if(V_ISBYREF(pvar)) + if(V_ISBYREF(pvar)) obj = INT2NUM((long)*V_I1REF(pvar)); - else + else obj = INT2NUM((long)V_I1(pvar)); break; case VT_UI1: - if(V_ISBYREF(pvar)) + if(V_ISBYREF(pvar)) obj = INT2NUM((long)*V_UI1REF(pvar)); - else + else obj = INT2NUM((long)V_UI1(pvar)); break; case VT_I2: if(V_ISBYREF(pvar)) obj = INT2NUM((long)*V_I2REF(pvar)); - else + else obj = INT2NUM((long)V_I2(pvar)); break; case VT_UI2: if(V_ISBYREF(pvar)) obj = INT2NUM((long)*V_UI2REF(pvar)); - else + else obj = INT2NUM((long)V_UI2(pvar)); break; case VT_I4: if(V_ISBYREF(pvar)) obj = INT2NUM((long)*V_I4REF(pvar)); - else + else obj = INT2NUM((long)V_I4(pvar)); break; case VT_UI4: if(V_ISBYREF(pvar)) obj = INT2NUM((long)*V_UI4REF(pvar)); - else + else obj = INT2NUM((long)V_UI4(pvar)); break; case VT_INT: if(V_ISBYREF(pvar)) obj = INT2NUM((long)*V_INTREF(pvar)); - else + else obj = INT2NUM((long)V_INT(pvar)); break; case VT_UINT: if(V_ISBYREF(pvar)) obj = INT2NUM((long)*V_UINTREF(pvar)); - else + else obj = INT2NUM((long)V_UINT(pvar)); break; @@ -2161,7 +2161,7 @@ ole_variant2val(VARIANT *pvar) if(V_ISBYREF(pvar)) #if (_MSC_VER >= 1300) obj = I8_2_NUM(*V_I8REF(pvar)); -#else +#else obj = Qnil; #endif else @@ -2272,7 +2272,7 @@ ole_variant2val(VARIANT *pvar) HRESULT hr; VARIANT variant; VariantInit(&variant); - hr = VariantChangeTypeEx(&variant, pvar, + hr = VariantChangeTypeEx(&variant, pvar, cWIN32OLE_lcid, 0, VT_BSTR); if (SUCCEEDED(hr) && V_VT(&variant) == VT_BSTR) { obj = ole_wc2vstr(V_BSTR(&variant), FALSE); @@ -2318,7 +2318,7 @@ reg_get_val(HKEY hkey, const char *subkey) DWORD dwtype = 0; LONG size = 0; VALUE val = Qnil; - LONG err = RegQueryValueEx(hkey, subkey, NULL, &dwtype, NULL, &size); + LONG err = RegQueryValueEx(hkey, subkey, NULL, &dwtype, NULL, &size); if (err == ERROR_SUCCESS) { pbuf = ALLOC_N(char, size + 1); @@ -2432,7 +2432,7 @@ typelib_file_from_typelib(VALUE ole) break; err = reg_open_vkey(hversion, lang, &hlang); if (err == ERROR_SUCCESS) { - if ((file = reg_get_typelib_file_path(hlang)) != Qnil) + if ((file = reg_get_typelib_file_path(hlang)) != Qnil) found = TRUE; RegCloseKey(hlang); } @@ -2588,17 +2588,17 @@ ole_create_dcom(int argc, VALUE *argv, VALUE self) hr = CLSIDFromString(pbuf, &clsid); SysFreeString(pbuf); if (FAILED(hr)) - ole_raise(hr, eWIN32OLERuntimeError, + ole_raise(hr, eWIN32OLERuntimeError, "unknown OLE server: `%s'", StringValuePtr(ole)); - memset(&serverinfo, 0, sizeof(COSERVERINFO)); + memset(&serverinfo, 0, sizeof(COSERVERINFO)); serverinfo.pwszName = ole_vstr2wc(host); memset(&multi_qi, 0, sizeof(MULTI_QI)); multi_qi.pIID = &IID_IDispatch; hr = gCoCreateInstanceEx(&clsid, NULL, clsctx, &serverinfo, 1, &multi_qi); SysFreeString(serverinfo.pwszName); if (FAILED(hr)) - ole_raise(hr, eWIN32OLERuntimeError, + ole_raise(hr, eWIN32OLERuntimeError, "failed to create DCOM server `%s' in `%s'", StringValuePtr(ole), StringValuePtr(host)); @@ -2617,12 +2617,12 @@ ole_bind_obj(VALUE moniker, int argc, VALUE *argv, VALUE self) HRESULT hr; OLECHAR *pbuf; ULONG eaten = 0; - + ole_initialize(); hr = CreateBindCtx(0, &pBindCtx); if(FAILED(hr)) { - ole_raise(hr, eWIN32OLERuntimeError, + ole_raise(hr, eWIN32OLERuntimeError, "failed to create bind context"); } @@ -2635,7 +2635,7 @@ ole_bind_obj(VALUE moniker, int argc, VALUE *argv, VALUE self) "failed to parse display name of moniker `%s'", StringValuePtr(moniker)); } - hr = pMoniker->lpVtbl->BindToObject(pMoniker, pBindCtx, NULL, + hr = pMoniker->lpVtbl->BindToObject(pMoniker, pBindCtx, NULL, &IID_IDispatch, &p); pDispatch = p; OLE_RELEASE(pMoniker); @@ -2652,10 +2652,10 @@ ole_bind_obj(VALUE moniker, int argc, VALUE *argv, VALUE self) /* * call-seq: * WIN32OLE.connect( ole ) --> aWIN32OLE - * + * * Returns running OLE Automation object or WIN32OLE object from moniker. * 1st argument should be OLE program id or class id or moniker. - * + * * WIN32OLE.connect('Excel.Application') # => WIN32OLE object which represents running Excel. */ static VALUE @@ -2677,7 +2677,7 @@ fole_s_connect(int argc, VALUE *argv, VALUE self) rb_scan_args(argc, argv, "1*", &svr_name, &others); SafeStringValue(svr_name); if (rb_safe_level() > 0 && OBJ_TAINTED(svr_name)) { - rb_raise(rb_eSecurityError, "Insecure Object Connection - %s", + rb_raise(rb_eSecurityError, "Insecure Object Connection - %s", StringValuePtr(svr_name)); } @@ -2694,15 +2694,15 @@ fole_s_connect(int argc, VALUE *argv, VALUE self) hr = GetActiveObject(&clsid, 0, &pUnknown); if (FAILED(hr)) { - ole_raise(hr, eWIN32OLERuntimeError, + ole_raise(hr, eWIN32OLERuntimeError, "OLE server `%s' not running", StringValuePtr(svr_name)); } hr = pUnknown->lpVtbl->QueryInterface(pUnknown, &IID_IDispatch, &p); pDispatch = p; if(FAILED(hr)) { OLE_RELEASE(pUnknown); - ole_raise(hr, eWIN32OLERuntimeError, - "failed to create WIN32OLE server `%s'", + ole_raise(hr, eWIN32OLERuntimeError, + "failed to create WIN32OLE server `%s'", StringValuePtr(svr_name)); } @@ -2711,16 +2711,16 @@ fole_s_connect(int argc, VALUE *argv, VALUE self) return create_win32ole_object(self, pDispatch, argc, argv); } -/* +/* * call-seq: * WIN32OLE.const_load( ole, mod = WIN32OLE) - * + * * Defines the constants of OLE Automation server as mod's constants. * The first argument is WIN32OLE object or type library name. * If 2nd argument is omitted, the default is WIN32OLE. * The first letter of Ruby's constant variable name is upper case, * so constant variable name of WIN32OLE object is capitalized. - * For example, the 'xlTop' constant of Excel is changed to 'XlTop' + * For example, the 'xlTop' constant of Excel is changed to 'XlTop' * in WIN32OLE. * If the first letter of constant variabl is not [A-Z], then * the constant is defined as CONSTANTS hash element. @@ -2731,7 +2731,7 @@ fole_s_connect(int argc, VALUE *argv, VALUE self) * WIN32OLE.const_load(excel, EXCEL_CONST) * puts EXCEL_CONST::XlTop # => -4160 * puts EXCEL_CONST::CONSTANTS['_xlDialogChartSourceData'] # => 541 - * + * * WIN32OLE.const_load(excel) * puts WIN32OLE::XlTop # => -4160 * @@ -2753,7 +2753,7 @@ fole_s_const_load(int argc, VALUE *argv, VALUE self) OLECHAR *pBuf; VALUE file; LCID lcid = cWIN32OLE_lcid; - + rb_secure(4); rb_scan_args(argc, argv, "11", &ole, &klass); if (TYPE(klass) != T_CLASS && @@ -2809,20 +2809,20 @@ fole_s_const_load(int argc, VALUE *argv, VALUE self) static VALUE ole_types_from_typelib(ITypeLib *pTypeLib, VALUE classes) { - + long count; int i; HRESULT hr; BSTR bstr; ITypeInfo *pTypeInfo; VALUE type; - + rb_secure(4); count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib); for (i = 0; i < count; i++) { hr = pTypeLib->lpVtbl->GetDocumentation(pTypeLib, i, &bstr, NULL, NULL, NULL); - if (FAILED(hr)) + if (FAILED(hr)) continue; hr = pTypeLib->lpVtbl->GetTypeInfo(pTypeLib, i, &pTypeInfo); @@ -2852,8 +2852,8 @@ reference_count(struct oledata * pole) /* * call-seq: * WIN32OLE.ole_reference_count(aWIN32OLE) --> number - * - * Returns reference counter of Dispatch interface of WIN32OLE object. + * + * Returns reference counter of Dispatch interface of WIN32OLE object. * You should not use this method because this method * exists only for debugging WIN32OLE. */ @@ -2868,8 +2868,8 @@ fole_s_reference_count(VALUE self, VALUE obj) /* * call-seq: * WIN32OLE.ole_free(aWIN32OLE) --> number - * - * Invokes Release method of Dispatch interface of WIN32OLE object. + * + * Invokes Release method of Dispatch interface of WIN32OLE object. * You should not use this method because this method * exists only for debugging WIN32OLE. * The return value is reference counter of OLE object. @@ -2901,10 +2901,10 @@ ole_show_help(VALUE helpfile, VALUE helpcontext) pfnHtmlHelp = (FNHTMLHELP*)GetProcAddress(ghhctrl, "HtmlHelpA"); if (!pfnHtmlHelp) return hwnd; - hwnd = pfnHtmlHelp(GetDesktopWindow(), StringValuePtr(helpfile), + hwnd = pfnHtmlHelp(GetDesktopWindow(), StringValuePtr(helpfile), 0x0f, NUM2INT(helpcontext)); if (hwnd == 0) - hwnd = pfnHtmlHelp(GetDesktopWindow(), StringValuePtr(helpfile), + hwnd = pfnHtmlHelp(GetDesktopWindow(), StringValuePtr(helpfile), 0, NUM2INT(helpcontext)); return hwnd; } @@ -2912,7 +2912,7 @@ ole_show_help(VALUE helpfile, VALUE helpcontext) /* * call-seq: * WIN32OLE.ole_show_help(obj [,helpcontext]) - * + * * Displays helpfile. The 1st argument specifies WIN32OLE_TYPE * object or WIN32OLE_METHOD object or helpfile. * @@ -2952,10 +2952,10 @@ fole_s_show_help(int argc, VALUE *argv, VALUE self) return Qnil; } -/* +/* * call-seq: * WIN32OLE.codepage - * + * * Returns current codepage. * WIN32OLE.codepage # => WIN32OLE::CP_ACP */ @@ -2965,7 +2965,7 @@ fole_s_get_code_page(VALUE self) return INT2FIX(cWIN32OLE_cp); } -static BOOL CALLBACK +static BOOL CALLBACK installed_code_page_proc(LPTSTR str) { if (strtoul(str, NULL, 10) == g_cp_to_check) { g_cp_installed = TRUE; @@ -2974,7 +2974,7 @@ installed_code_page_proc(LPTSTR str) { return TRUE; } -static BOOL +static BOOL code_page_installed(UINT cp) { g_cp_installed = FALSE; @@ -2983,12 +2983,12 @@ code_page_installed(UINT cp) return g_cp_installed; } -/* +/* * call-seq: * WIN32OLE.codepage = CP - * - * Sets current codepage. - * The WIN32OLE.codepage is initialized according to + * + * Sets current codepage. + * The WIN32OLE.codepage is initialized according to * Encoding.default_internal. * If Encoding.default_internal is nil then WIN32OLE.codepage * is initialized according to Encoding.default_external. @@ -3016,7 +3016,7 @@ fole_s_set_code_page(VALUE self, VALUE vcp) * * lcid = WIN32OLE.locale */ -static VALUE +static VALUE fole_s_get_locale(VALUE self) { return INT2FIX(cWIN32OLE_lcid); @@ -3051,7 +3051,7 @@ lcid_installed(LCID lcid) * obj = WIN32OLE_VARIANT.new("$100,000", WIN32OLE::VARIANT::VT_CY) * */ -static VALUE +static VALUE fole_s_set_locale(VALUE self, VALUE vlcid) { LCID lcid = FIX2INT(vlcid); @@ -3070,12 +3070,12 @@ fole_s_set_locale(VALUE self, VALUE vlcid) return Qnil; } -/* +/* * call-seq: * WIN32OLE.create_guid - * + * * Creates GUID. - * WIN32OLE.create_guid # => {1CB530F1-F6B1-404D-BCE6-1959BF91F4A8} + * WIN32OLE.create_guid # => {1CB530F1-F6B1-404D-BCE6-1959BF91F4A8} */ static VALUE fole_s_create_guid(VALUE self) @@ -3116,7 +3116,7 @@ static void ole_pure_uninitialize() } /* :nodoc */ -static VALUE +static VALUE fole_s_ole_initialize(VALUE self) { ole_pure_initialize(); @@ -3124,7 +3124,7 @@ fole_s_ole_initialize(VALUE self) } /* :nodoc */ -static VALUE +static VALUE fole_s_ole_uninitialize(VALUE self) { ole_pure_uninitialize(); @@ -3137,11 +3137,11 @@ fole_s_ole_uninitialize(VALUE self) * WIN32OLE objects represent OLE Automation object in Ruby. * * By using WIN32OLE, you can access OLE server like VBScript. - * + * * Here is sample script. * * require 'win32ole' - * + * * excel = WIN32OLE.new('Excel.Application') * excel.visible = true * workbook = excel.Workbooks.Add(); @@ -3150,17 +3150,17 @@ fole_s_ole_uninitialize(VALUE self) * worksheet.Range("A2:B2").value = [5.2, 10]; * worksheet.Range("C2").value = 8; * worksheet.Range("D2").value = 20; - * + * * range = worksheet.Range("A1:D2"); * range.select * chart = workbook.Charts.Add; - * + * * workbook.saved = true; - * + * * excel.ActiveWorkbook.Close(0); * excel.Quit(); * - * Unfortunately, Win32OLE doesn't support the argument passed by + * Unfortunately, Win32OLE doesn't support the argument passed by * reference directly. * Instead, Win32OLE provides WIN32OLE::ARGV. * If you want to get the result value of argument passed by reference, @@ -3168,18 +3168,18 @@ fole_s_ole_uninitialize(VALUE self) * * oleobj.method(arg1, arg2, refargv3) * puts WIN32OLE::ARGV[2] # the value of refargv3 after called oleobj.method - * + * */ /* * call-seq: * WIN32OLE.new(server, [host]) -> WIN32OLE object - * + * * Returns a new WIN32OLE object(OLE Automation object). * The first argument server specifies OLE Automation server. * The first argument should be CLSID or PROGID. - * If second argument host specified, then returns OLE Automation - * object on host. + * If second argument host specified, then returns OLE Automation + * object on host. * * WIN32OLE.new('Excel.Application') # => Excel OLE Automation WIN32OLE object. * WIN32OLE.new('{00024500-0000-0000-C000-000000000046}') # => Excel OLE Automation WIN32OLE object. @@ -3221,7 +3221,7 @@ fole_initialize(int argc, VALUE *argv, VALUE self) } SysFreeString(pBuf); if(FAILED(hr)) { - ole_raise(hr, eWIN32OLERuntimeError, + ole_raise(hr, eWIN32OLERuntimeError, "unknown OLE server: `%s'", StringValuePtr(svr_name)); } @@ -3347,7 +3347,7 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket) &wcmdname, 1, lcid, &DispID); SysFreeString(wcmdname); if(FAILED(hr)) { - ole_raise(hr, eWIN32OLERuntimeError, + ole_raise(hr, eWIN32OLERuntimeError, "unknown property or method: `%s'", StringValuePtr(cmd)); } @@ -3360,8 +3360,8 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket) /* if last arg is hash object */ if(TYPE(param) == T_HASH) { - /*------------------------------------------ - hash object ==> named dispatch parameters + /*------------------------------------------ + hash object ==> named dispatch parameters --------------------------------------------*/ cNamedArgs = NUM2INT(rb_funcall(param, rb_intern("length"), 0)); op.dp.cArgs = cNamedArgs + argc - 2; @@ -3385,7 +3385,7 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket) for(i = 0; i < op.dp.cArgs; i++ ) { VariantClear(&op.dp.rgvarg[i]); } - ole_raise(hr, eWIN32OLERuntimeError, + ole_raise(hr, eWIN32OLERuntimeError, "failed to get named argument info: `%s'", StringValuePtr(cmd)); } @@ -3400,7 +3400,7 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket) } } /*-------------------------------------- - non hash args ==> dispatch parameters + non hash args ==> dispatch parameters ----------------------------------------*/ if(op.dp.cArgs > cNamedArgs) { realargs = ALLOCA_N(VARIANTARG, op.dp.cArgs-cNamedArgs+1); @@ -3428,9 +3428,9 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket) op.dp.rgdispidNamedArgs = ALLOCA_N( DISPID, 1 ); op.dp.rgdispidNamedArgs[0] = DISPID_PROPERTYPUT; } - - hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, DispID, - &IID_NULL, lcid, wFlags, &op.dp, + + hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, DispID, + &IID_NULL, lcid, wFlags, &op.dp, &result, &excepinfo, &argErr); if (FAILED(hr)) { @@ -3446,7 +3446,7 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket) } memset(&excepinfo, 0, sizeof(EXCEPINFO)); VariantInit(&result); - hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, DispID, + hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, DispID, &IID_NULL, lcid, wFlags, &op.dp, &result, &excepinfo, &argErr); @@ -3460,7 +3460,7 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket) ole_freeexceptinfo(&excepinfo); } memset(&excepinfo, 0, sizeof(EXCEPINFO)); - hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, DispID, + hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, DispID, &IID_NULL, lcid, wFlags, &op.dp, NULL, &excepinfo, &argErr); @@ -3485,7 +3485,7 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket) } memset(&excepinfo, 0, sizeof(EXCEPINFO)); VariantInit(&result); - hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, DispID, + hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, DispID, &IID_NULL, lcid, wFlags, &op.dp, &result, &excepinfo, &argErr); @@ -3529,7 +3529,7 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket) * call-seq: * WIN32OLE#invoke(method, [arg1,...]) => return value of method. * - * Runs OLE method. + * Runs OLE method. * The first argument specifies the method name of OLE Automation object. * The others specify argument of the method. * If you can not execute method directly, then use this method instead. @@ -3562,7 +3562,7 @@ ole_invoke2(VALUE self, VALUE dispid, VALUE args, VALUE types, USHORT dispkind) Check_Type(args, T_ARRAY); Check_Type(types, T_ARRAY); - + memset(&excepinfo, 0, sizeof(EXCEPINFO)); memset(&dispParams, 0, sizeof(DISPPARAMS)); VariantInit(&result); @@ -3737,9 +3737,9 @@ ole_invoke2(VALUE self, VALUE dispid, VALUE args, VALUE types, USHORT dispkind) /* * call-seq: * WIN32OLE#_invoke(dispid, args, types) - * + * * Runs the early binding method. - * The 1st argument specifies dispatch ID, + * The 1st argument specifies dispatch ID, * the 2nd argument specifies the array of arguments, * the 3rd argument specifies the array of the type of arguments. * @@ -3755,9 +3755,9 @@ fole_invoke2(VALUE self, VALUE dispid, VALUE args, VALUE types) /* * call-seq: * WIN32OLE#_getproperty(dispid, args, types) - * + * * Runs the early binding method to get property. - * The 1st argument specifies dispatch ID, + * The 1st argument specifies dispatch ID, * the 2nd argument specifies the array of arguments, * the 3rd argument specifies the array of the type of arguments. * @@ -3773,9 +3773,9 @@ fole_getproperty2(VALUE self, VALUE dispid, VALUE args, VALUE types) /* * call-seq: * WIN32OLE#_setproperty(dispid, args, types) - * + * * Runs the early binding method to set property. - * The 1st argument specifies dispatch ID, + * The 1st argument specifies dispatch ID, * the 2nd argument specifies the array of arguments, * the 3rd argument specifies the array of the type of arguments. * @@ -3790,13 +3790,13 @@ fole_setproperty2(VALUE self, VALUE dispid, VALUE args, VALUE types) /* * call-seq: - * WIN32OLE[a1, a2, ...]=val - * + * WIN32OLE[a1, a2, ...]=val + * * Sets the value to WIN32OLE object specified by a1, a2, ... - * + * * dict = WIN32OLE.new('Scripting.Dictionary') * dict.add('ruby', 'RUBY') - * dict['ruby'] = 'Ruby' + * dict['ruby'] = 'Ruby' * puts dict['ruby'] # => 'Ruby' * * Remark: You can not use this method to set the property value. @@ -3815,7 +3815,7 @@ fole_setproperty_with_bracket(int argc, VALUE *argv, VALUE self) /* * call-seq: * WIN32OLE.setproperty('property', [arg1, arg2,...] val) - * + * * Sets property of OLE object. * When you want to set property with argument, you can use this method. * @@ -3833,14 +3833,14 @@ fole_setproperty(int argc, VALUE *argv, VALUE self) /* * call-seq: - * WIN32OLE[a1,a2,...] - * + * WIN32OLE[a1,a2,...] + * * Returns the value of Collection specified by a1, a2,.... * * dict = WIN32OLE.new('Scripting.Dictionary') * dict.add('ruby', 'Ruby') * puts dict['ruby'] # => 'Ruby' (same as `puts dict.item('ruby')') - * + * * Remark: You can not use this method to get the property. * excel = WIN32OLE.new('Excel.Application') * # puts excel['Visible'] This is error !!! @@ -3888,13 +3888,13 @@ ole_propertyput(VALUE self, VALUE property, VALUE value) pBuf[0] = NULL; if(FAILED(hr)) { - ole_raise(hr, eWIN32OLERuntimeError, + ole_raise(hr, eWIN32OLERuntimeError, "unknown property or method: `%s'", StringValuePtr(property)); } /* set property value */ ole_val2variant(value, &propertyValue[0]); - hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, dispID, &IID_NULL, + hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, dispID, &IID_NULL, lcid, wFlags, &dispParams, NULL, &excepinfo, &argErr); @@ -3957,7 +3957,7 @@ ole_ienum_free(VALUE pEnumV) /* * call-seq: * WIN32OLE#each {|i|...} - * + * * Iterates over each item of OLE collection which has IEnumVARIANT interface. * * excel = WIN32OLE.new('Excel.Application') @@ -3991,7 +3991,7 @@ fole_each(VALUE self) dispParams.cNamedArgs = 0; dispParams.cArgs = 0; memset(&excepinfo, 0, sizeof(excepinfo)); - + OLEData_Get_Struct(self, pole); hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, DISPID_NEWENUM, &IID_NULL, lcid, @@ -4028,7 +4028,7 @@ fole_each(VALUE self) /* * call-seq: * WIN32OLE#method_missing(id [,arg1, arg2, ...]) - * + * * Calls WIN32OLE#invoke method. */ static VALUE @@ -4141,7 +4141,7 @@ ole_methods_sub(ITypeInfo *pOwnerTypeInfo, ITypeInfo *pTypeInfo, VALUE methods, hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, i, &pFuncDesc); if (FAILED(hr)) continue; - + hr = pTypeInfo->lpVtbl->GetDocumentation(pTypeInfo, pFuncDesc->memid, &bstr, NULL, NULL, NULL); if (FAILED(hr)) { @@ -4150,7 +4150,7 @@ ole_methods_sub(ITypeInfo *pOwnerTypeInfo, ITypeInfo *pTypeInfo, VALUE methods, } if(pFuncDesc->invkind & mask) { method = folemethod_s_allocate(cWIN32OLE_METHOD); - olemethod_set_member(method, pTypeInfo, pOwnerTypeInfo, + olemethod_set_member(method, pTypeInfo, pOwnerTypeInfo, i, WC2VSTR(bstr)); rb_ary_push(methods, method); } @@ -4254,13 +4254,13 @@ ole_methods(VALUE self, int mask) /* * call-seq: * WIN32OLE#ole_methods - * - * Returns the array of WIN32OLE_METHOD object. + * + * Returns the array of WIN32OLE_METHOD object. * The element is OLE method of WIN32OLE object. * * excel = WIN32OLE.new('Excel.Application') * methods = excel.ole_methods - * + * */ static VALUE fole_methods(VALUE self) @@ -4271,7 +4271,7 @@ fole_methods(VALUE self) /* * call-seq: * WIN32OLE#ole_get_methods - * + * * Returns the array of WIN32OLE_METHOD object . * The element of the array is property (gettable) of WIN32OLE object. * @@ -4287,7 +4287,7 @@ fole_get_methods(VALUE self) /* * call-seq: * WIN32OLE#ole_put_methods - * + * * Returns the array of WIN32OLE_METHOD object . * The element of the array is property (settable) of WIN32OLE object. * @@ -4303,7 +4303,7 @@ fole_put_methods(VALUE self) /* * call-seq: * WIN32OLE#ole_func_methods - * + * * Returns the array of WIN32OLE_METHOD object . * The element of the array is property (settable) of WIN32OLE object. * @@ -4344,7 +4344,7 @@ ole_type_from_itypeinfo(ITypeInfo *pTypeInfo) /* * call-seq: * WIN32OLE#ole_type - * + * * Returns WIN32OLE_TYPE object. * * excel = WIN32OLE.new('Excel.Application') @@ -4392,7 +4392,7 @@ ole_typelib_from_itypeinfo(ITypeInfo *pTypeInfo) /* * call-seq: - * WIN32OLE#ole_typelib -> The WIN32OLE_TYPELIB object + * WIN32OLE#ole_typelib -> The WIN32OLE_TYPELIB object * * Returns the WIN32OLE_TYPELIB object. The object represents the * type library which contains the WIN32OLE object. @@ -4427,12 +4427,12 @@ fole_typelib(VALUE self) /* * call-seq: * WIN32OLE#ole_query_interface(iid) -> WIN32OLE object - * + * * Returns WIN32OLE object for a specific dispatch or dual * interface specified by iid. * * ie = WIN32OLE.new('InternetExplorer.Application') - * ie_web_app = ie.ole_query_interface('{0002DF05-0000-0000-C000-000000000046}') # => WIN32OLE object for dispinterface IWebBrowserApp + * ie_web_app = ie.ole_query_interface('{0002DF05-0000-0000-C000-000000000046}') # => WIN32OLE object for dispinterface IWebBrowserApp */ static VALUE fole_query_interface(VALUE self, VALUE str_iid) @@ -4443,12 +4443,12 @@ fole_query_interface(VALUE self, VALUE str_iid) struct oledata *pole; IDispatch *pDispatch; void *p; - + pBuf = ole_vstr2wc(str_iid); hr = CLSIDFromString(pBuf, &iid); SysFreeString(pBuf); if(FAILED(hr)) { - ole_raise(hr, eWIN32OLERuntimeError, + ole_raise(hr, eWIN32OLERuntimeError, "invalid iid: `%s'", StringValuePtr(str_iid)); } @@ -4461,8 +4461,8 @@ fole_query_interface(VALUE self, VALUE str_iid) hr = pole->pDispatch->lpVtbl->QueryInterface(pole->pDispatch, &iid, &p); if(FAILED(hr)) { - ole_raise(hr, eWIN32OLERuntimeError, - "failed to get interface `%s'", + ole_raise(hr, eWIN32OLERuntimeError, + "failed to get interface `%s'", StringValuePtr(str_iid)); } @@ -4473,7 +4473,7 @@ fole_query_interface(VALUE self, VALUE str_iid) /* * call-seq: * WIN32OLE#ole_respond_to?(method) -> true or false - * + * * Returns true when OLE object has OLE method, otherwise returns false. * * ie = WIN32OLE.new('InternetExplorer.Application') @@ -4512,9 +4512,9 @@ ole_docinfo_from_type(ITypeInfo *pTypeInfo, BSTR *name, BSTR *helpstr, DWORD *he if (FAILED(hr)) { return hr; } - + hr = pTypeLib->lpVtbl->GetDocumentation(pTypeLib, i, - name, helpstr, + name, helpstr, helpcontext, helpfile); if (FAILED(hr)) { OLE_RELEASE(pTypeLib); @@ -4532,7 +4532,7 @@ ole_usertype2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails) ITypeInfo *pRefTypeInfo; VALUE type = Qnil; - hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo, + hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo, V_UNION1(pTypeDesc, hreftype), &pRefTypeInfo); if(FAILED(hr)) @@ -4551,7 +4551,7 @@ ole_usertype2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails) static VALUE ole_ptrtype2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails) -{ +{ TYPEDESC *p = pTypeDesc; VALUE type = rb_str_new2(""); @@ -4645,7 +4645,7 @@ ole_typedesc2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails) break; case VT_USERDEFINED: typestr = rb_str_new2("USERDEFINED"); - if (typedetails != Qnil) + if (typedetails != Qnil) rb_ary_push(typedetails, typestr); str = ole_usertype2val(pTypeInfo, pTypeDesc, typedetails); if (str != Qnil) { @@ -4680,8 +4680,8 @@ ole_typedesc2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails) /* * call-seq: * WIN32OLE#ole_method_help(method) - * - * Returns WIN32OLE_METHOD object corresponding with method + * + * Returns WIN32OLE_METHOD object corresponding with method * specified by 1st argument. * * excel = WIN32OLE.new('Excel.Application') @@ -4714,11 +4714,11 @@ fole_method_help(VALUE self, VALUE cmdname) * call-seq: * WIN32OLE#ole_activex_initialize() -> Qnil * - * Initialize WIN32OLE object(ActiveX Control) by calling + * Initialize WIN32OLE object(ActiveX Control) by calling * IPersistMemory::InitNew. * - * Before calling OLE method, some kind of the ActiveX controls - * created with MFC should be initialized by calling + * Before calling OLE method, some kind of the ActiveX controls + * created with MFC should be initialized by calling * IPersistXXX::InitNew. * * If and only if you received the exception "HRESULT error code: @@ -4728,10 +4728,10 @@ fole_method_help(VALUE self, VALUE cmdname) * obj = WIN32OLE.new("ProgID_or_GUID_of_ActiveX_Control") * obj.ole_activex_initialize * obj.method(...) - * - */ + * + */ static VALUE -fole_activex_initialize(VALUE self) +fole_activex_initialize(VALUE self) { struct oledata *pole; IPersistMemory *pPersistMemory; @@ -4761,7 +4761,7 @@ fole_activex_initialize(VALUE self) /* * call-seq: * WIN32OLE_TYPE.ole_classes(typelib) - * + * * Returns array of WIN32OLE_TYPE objects defined by the typelib type library. * This method will be OBSOLETE. Use WIN32OLE_TYPELIB.new(typelib).ole_classes instead. */ @@ -4782,7 +4782,7 @@ foletype_s_ole_classes(VALUE self, VALUE typelib) /* * call-seq: * WIN32OLE_TYPE.typelibs - * + * * Returns array of type libraries. * This method will be OBSOLETE. Use WIN32OLE_TYPELIB.typelibs.collect{|t| t.name} instead. * @@ -4801,7 +4801,7 @@ foletype_s_typelibs(VALUE self) /* * call-seq: * WIN32OLE_TYPE.progids - * + * * Returns array of ProgID. */ static VALUE @@ -4825,7 +4825,7 @@ foletype_s_progids(VALUE self) err = reg_open_vkey(hclsids, clsid, &hclsid); if (err != ERROR_SUCCESS) continue; - if ((v = reg_get_val2(hclsid, "ProgID")) != Qnil) + if ((v = reg_get_val2(hclsid, "ProgID")) != Qnil) rb_ary_push(progids, v); if ((v = reg_get_val2(hclsid, "VersionIndependentProgID")) != Qnil) rb_ary_push(progids, v); @@ -4860,7 +4860,7 @@ oletype_set_member(VALUE self, ITypeInfo *pTypeInfo, VALUE name) static VALUE oleclass_from_typelib(VALUE self, ITypeLib *pTypeLib, VALUE oleclass) { - + long count; int i; HRESULT hr; @@ -4869,7 +4869,7 @@ oleclass_from_typelib(VALUE self, ITypeLib *pTypeLib, VALUE oleclass) ITypeInfo *pTypeInfo; VALUE found = Qfalse; - + count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib); for (i = 0; i < count && found == Qfalse; i++) { hr = pTypeLib->lpVtbl->GetTypeInfo(pTypeLib, i, &pTypeInfo); @@ -4877,7 +4877,7 @@ oleclass_from_typelib(VALUE self, ITypeLib *pTypeLib, VALUE oleclass) continue; hr = pTypeLib->lpVtbl->GetDocumentation(pTypeLib, i, &bstr, NULL, NULL, NULL); - if (FAILED(hr)) + if (FAILED(hr)) continue; typelib = WC2VSTR(bstr); if (rb_str_cmp(oleclass, typelib) == 0) { @@ -4918,7 +4918,7 @@ oletypelib_get_libattr(ITypeLib *pTypeLib, TLIBATTR **ppTLibAttr) HRESULT hr; hr = pTypeLib->lpVtbl->GetLibAttr(pTypeLib, ppTLibAttr); if (FAILED(hr)) { - ole_raise(hr, eWIN32OLERuntimeError, + ole_raise(hr, eWIN32OLERuntimeError, "failed to get library attribute(TLIBATTR) from ITypeLib"); } } @@ -5039,7 +5039,7 @@ oletypelib_search_registry2(VALUE self, VALUE args) if (ver == Qnil) break; err = reg_open_vkey(hguid, ver, &hversion); - if (err != ERROR_SUCCESS) + if (err != ERROR_SUCCESS) continue; tlib = reg_get_val(hversion, NULL); if (tlib == Qnil) { @@ -5095,7 +5095,7 @@ oletypelib_search_registry(VALUE self, VALUE typelib) if (ver == Qnil) break; err = reg_open_vkey(hguid, ver, &hversion); - if (err != ERROR_SUCCESS) + if (err != ERROR_SUCCESS) continue; tlib = reg_get_val(hversion, NULL); if (tlib == Qnil) { @@ -5134,7 +5134,7 @@ foletypelib_s_allocate(VALUE klass) * * Returns a new WIN32OLE_TYPELIB object. * - * The first argument typelib specifies OLE type library name or GUID or + * The first argument typelib specifies OLE type library name or GUID or * OLE library file. * The second argument is major version or version of the type library. * The third argument is minor version. @@ -5142,7 +5142,7 @@ foletypelib_s_allocate(VALUE klass) * If the first argument is type library name, then the second and third argument * are ignored. * - * tlib1 = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') + * tlib1 = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') * tlib2 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}') * tlib3 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}', 1.3) * tlib4 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}', 1, 3) @@ -5241,7 +5241,7 @@ foletypelib_name(VALUE self) pTypeLib = oletypelib_get_typelib(self); hr = pTypeLib->lpVtbl->GetDocumentation(pTypeLib, -1, NULL, &bstr, NULL, NULL); - + if (FAILED(hr)) { ole_raise(hr, eWIN32OLERuntimeError, "failed to get name from ITypeLib"); } @@ -5251,7 +5251,7 @@ foletypelib_name(VALUE self) /* * call-seq: - * WIN32OLE_TYPELIB#version -> The type library version. + * WIN32OLE_TYPELIB#version -> The type library version. * * Returns the type library version. * @@ -5276,7 +5276,7 @@ foletypelib_version(VALUE self) /* * call-seq: - * WIN32OLE_TYPELIB#major_version -> The type library major version. + * WIN32OLE_TYPELIB#major_version -> The type library major version. * * Returns the type library major version. * @@ -5299,7 +5299,7 @@ foletypelib_major_version(VALUE self) /* * call-seq: - * WIN32OLE_TYPELIB#minor_version -> The type library minor version. + * WIN32OLE_TYPELIB#minor_version -> The type library minor version. * * Returns the type library minor version. * @@ -5352,7 +5352,7 @@ oletypelib_path(VALUE guid, VALUE version) return path; } -static HRESULT +static HRESULT oletypelib_from_guid(VALUE guid, VALUE version, ITypeLib **ppTypeLib) { VALUE path; @@ -5370,7 +5370,7 @@ oletypelib_from_guid(VALUE guid, VALUE version, ITypeLib **ppTypeLib) /* * call-seq: - * WIN32OLE_TYPELIB#path -> The type library file path. + * WIN32OLE_TYPELIB#path -> The type library file path. * * Returns the type library file path. * @@ -5381,7 +5381,7 @@ static VALUE foletypelib_path(VALUE self) { TLIBATTR *pTLibAttr; - HRESULT hr = S_OK; + HRESULT hr = S_OK; BSTR bstr; LCID lcid = cWIN32OLE_lcid; VALUE path; @@ -5389,7 +5389,7 @@ foletypelib_path(VALUE self) pTypeLib = oletypelib_get_typelib(self); oletypelib_get_libattr(pTypeLib, &pTLibAttr); - hr = QueryPathOfRegTypeLib(&pTLibAttr->guid, + hr = QueryPathOfRegTypeLib(&pTLibAttr->guid, pTLibAttr->wMajorVerNum, pTLibAttr->wMinorVerNum, lcid, @@ -5406,7 +5406,7 @@ foletypelib_path(VALUE self) /* * call-seq: - * WIN32OLE_TYPELIB#visible? + * WIN32OLE_TYPELIB#visible? * * Returns true if the type library information is not hidden. * If wLibFlags of TLIBATTR is 0 or LIBFLAG_FRESTRICTED or LIBFLAG_FHIDDEN, @@ -5438,7 +5438,7 @@ foletypelib_visible(VALUE self) /* * call-seq: - * WIN32OLE_TYPELIB#library_name + * WIN32OLE_TYPELIB#library_name * * Returns library name. * If the method fails to access library name, WIN32OLERuntimeError is raised. @@ -5472,7 +5472,7 @@ foletypelib_library_name(VALUE self) * Returns the type library file path. * * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') - * classes = tlib.ole_types.collect{|k| k.name} # -> ['AddIn', 'AddIns' ...] + * classes = tlib.ole_types.collect{|k| k.name} # -> ['AddIn', 'AddIns' ...] */ static VALUE foletypelib_ole_types(VALUE self) @@ -5513,8 +5513,8 @@ foletypelib_inspect(VALUE self) * The first argument typelib specifies OLE type library name. * The second argument specifies OLE class name. * - * WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') - * # => WIN32OLE_TYPE object of Application class of Excel. + * WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') + * # => WIN32OLE_TYPE object of Application class of Excel. */ static VALUE foletype_initialize(VALUE self, VALUE typelib, VALUE oleclass) @@ -5549,7 +5549,7 @@ foletype_initialize(VALUE self, VALUE typelib, VALUE oleclass) * WIN32OLE_TYPE#name #=> OLE type name * * Returns OLE type name. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') + * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') * puts tobj.name # => Application */ static VALUE @@ -5607,9 +5607,9 @@ ole_ole_type(ITypeInfo *pTypeInfo) /* * call-seq: * WIN32OLE_TYPE#ole_type #=> OLE type string. - * + * * returns type of OLE class. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') + * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') * puts tobj.ole_type # => Class */ static VALUE @@ -5629,7 +5629,7 @@ ole_type_guid(ITypeInfo *pTypeInfo) OLECHAR bstr[80]; VALUE guid = Qnil; hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr); - if (FAILED(hr)) + if (FAILED(hr)) return guid; len = StringFromGUID2(&pTypeAttr->guid, bstr, sizeof(bstr)/sizeof(OLECHAR)); if (len > 3) { @@ -5642,9 +5642,9 @@ ole_type_guid(ITypeInfo *pTypeInfo) /* * call-seq: * WIN32OLE_TYPE#guid #=> GUID - * + * * Returns GUID. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') + * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') * puts tobj.guid # => {00024500-0000-0000-C000-000000000046} */ static VALUE @@ -5663,7 +5663,7 @@ ole_type_progid(ITypeInfo *pTypeInfo) OLECHAR *pbuf; VALUE progid = Qnil; hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr); - if (FAILED(hr)) + if (FAILED(hr)) return progid; hr = ProgIDFromCLSID(&pTypeAttr->guid, &pbuf); if (SUCCEEDED(hr)) { @@ -5677,7 +5677,7 @@ ole_type_progid(ITypeInfo *pTypeInfo) /* * call-seq: * WIN32OLE_TYPE#progid #=> ProgID - * + * * Returns ProgID if it exists. If not found, then returns nil. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') * puts tobj.progid # => Excel.Application.9 @@ -5698,7 +5698,7 @@ ole_type_visible(ITypeInfo *pTypeInfo) TYPEATTR *pTypeAttr; VALUE visible; hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr); - if (FAILED(hr)) + if (FAILED(hr)) return Qtrue; if (pTypeAttr->wTypeFlags & (TYPEFLAG_FHIDDEN | TYPEFLAG_FRESTRICTED)) { visible = Qfalse; @@ -5712,7 +5712,7 @@ ole_type_visible(ITypeInfo *pTypeInfo) /* * call-seq: * WIN32OLE_TYPE#visible #=> true or false - * + * * Returns true if the OLE class is public. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') * puts tobj.visible # => true @@ -5742,7 +5742,7 @@ ole_type_major_version(ITypeInfo *pTypeInfo) /* * call-seq: * WIN32OLE_TYPE#major_version - * + * * Returns major version. * tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents') * puts tobj.major_version # => 8 @@ -5772,7 +5772,7 @@ ole_type_minor_version(ITypeInfo *pTypeInfo) /* * call-seq: * WIN32OLE_TYPE#minor_version #=> OLE minor version - * + * * Returns minor version. * tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents') * puts tobj.minor_version # => 2 @@ -5802,13 +5802,13 @@ ole_type_typekind(ITypeInfo *pTypeInfo) /* * call-seq: * WIN32OLE_TYPE#typekind #=> number of type. - * + * * Returns number which represents type. * tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents') * puts tobj.typekind # => 4 * */ -static VALUE +static VALUE foletype_typekind(VALUE self) { struct oletypedata *ptype; @@ -5831,12 +5831,12 @@ ole_type_helpstring(ITypeInfo *pTypeInfo) /* * call-seq: * WIN32OLE_TYPE#helpstring #=> help string. - * + * * Returns help string. * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'IWebBrowser') * puts tobj.helpstring # => Web Browser interface */ -static VALUE +static VALUE foletype_helpstring(VALUE self) { struct oletypedata *ptype; @@ -5865,7 +5865,7 @@ ole_type_src_type(ITypeInfo *pTypeInfo) /* * call-seq: * WIN32OLE_TYPE#src_type #=> OLE source class - * + * * Returns source class when the OLE class is 'Alias'. * tobj = WIN32OLE_TYPE.new('Microsoft Office 9.0 Object Library', 'MsoRGBType') * puts tobj.src_type # => I4 @@ -5894,7 +5894,7 @@ ole_type_helpfile(ITypeInfo *pTypeInfo) /* * call-seq: * WIN32OLE_TYPE#helpfile - * + * * Returns helpfile path. If helpfile is not found, then returns nil. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet') * puts tobj.helpfile # => C:\...\VBAXL9.CHM @@ -5913,7 +5913,7 @@ ole_type_helpcontext(ITypeInfo *pTypeInfo) { HRESULT hr; DWORD helpcontext; - hr = ole_docinfo_from_type(pTypeInfo, NULL, NULL, + hr = ole_docinfo_from_type(pTypeInfo, NULL, NULL, &helpcontext, NULL); if(FAILED(hr)) return Qnil; @@ -5923,7 +5923,7 @@ ole_type_helpcontext(ITypeInfo *pTypeInfo) /* * call-seq: * WIN32OLE_TYPE#helpcontext - * + * * Returns helpcontext. If helpcontext is not found, then returns nil. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet') * puts tobj.helpfile # => 131185 @@ -5939,8 +5939,8 @@ foletype_helpcontext(VALUE self) /* * call-seq: * WIN32OLE_TYPE#ole_typelib - * - * Returns the WIN32OLE_TYPELIB object which is including the WIN32OLE_TYPE + * + * Returns the WIN32OLE_TYPELIB object which is including the WIN32OLE_TYPE * object. If it is not found, then returns nil. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet') * puts tobj.ole_typelib # => 'Microsoft Excel 9.0 Object Library' @@ -5978,7 +5978,7 @@ ole_type_impl_ole_types(ITypeInfo *pTypeInfo, int implflags) if (FAILED(hr)) continue; hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo, href, &pRefTypeInfo); - if (FAILED(hr)) + if (FAILED(hr)) continue; if ((flags & implflags) == implflags) { @@ -5997,9 +5997,9 @@ ole_type_impl_ole_types(ITypeInfo *pTypeInfo, int implflags) /* * call-seq: * WIN32OLE_TYPE#implemented_ole_types - * - * Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE - * object. + * + * Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE + * object. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet') * p tobj.implemented_ole_types # => [_Worksheet, DocEvents] */ @@ -6014,10 +6014,10 @@ foletype_impl_ole_types(VALUE self) /* * call-seq: * WIN32OLE_TYPE#source_ole_types - * - * Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE - * object and having IMPLTYPEFLAG_FSOURCE. - * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', "InternetExplorer") + * + * Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE + * object and having IMPLTYPEFLAG_FSOURCE. + * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', "InternetExplorer") * p tobj.source_ole_types * # => [#, #] */ @@ -6032,10 +6032,10 @@ foletype_source_ole_types(VALUE self) /* * call-seq: * WIN32OLE_TYPE#default_event_sources - * - * Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE - * object and having IMPLTYPEFLAG_FSOURCE and IMPLTYPEFLAG_FDEFAULT. - * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', "InternetExplorer") + * + * Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE + * object and having IMPLTYPEFLAG_FSOURCE and IMPLTYPEFLAG_FDEFAULT. + * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', "InternetExplorer") * p tobj.default_event_sources # => [#] */ static VALUE @@ -6049,10 +6049,10 @@ foletype_default_event_sources(VALUE self) /* * call-seq: * WIN32OLE_TYPE#default_ole_types - * - * Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE + * + * Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE * object and having IMPLTYPEFLAG_FDEFAULT. - * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', "InternetExplorer") + * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', "InternetExplorer") * p tobj.default_ole_types * # => [#, #] */ @@ -6096,7 +6096,7 @@ ole_variables(ITypeInfo *pTypeInfo) if (FAILED(hr)) { ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr"); } - + for(i = 0; i < pTypeAttr->cVars; i++) { hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, i, &pVarDesc); if(FAILED(hr)) @@ -6126,15 +6126,15 @@ ole_variables(ITypeInfo *pTypeInfo) /* * call-seq: * WIN32OLE_TYPE#variables - * - * Returns array of WIN32OLE_VARIABLE objects which represent variables + * + * Returns array of WIN32OLE_VARIABLE objects which represent variables * defined in OLE class. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') * vars = tobj.variables * vars.each do |v| * puts "#{v.name} = #{v.value}" * end - * + * * The result of above sample script is follows: * xlChart = -4109 * xlDialogSheet = -4116 @@ -6154,13 +6154,13 @@ foletype_variables(VALUE self) /* * call-seq: * WIN32OLE_TYPE#ole_methods # the array of WIN32OLE_METHOD objects. - * - * Returns array of WIN32OLE_METHOD objects which represent OLE method defined in + * + * Returns array of WIN32OLE_METHOD objects which represent OLE method defined in * OLE type library. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet') * methods = tobj.ole_methods.collect{|m| * m.name - * } + * } * # => ['Activate', 'Copy', 'Delete',....] */ static VALUE @@ -6180,7 +6180,7 @@ foletype_methods(VALUE self) /* * call-seq: * WIN32OLE_VARIABLE#name - * + * * Returns the name of variable. * * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') @@ -6220,7 +6220,7 @@ ole_variable_ole_type(ITypeInfo *pTypeInfo, UINT var_index) /* * call-seq: * WIN32OLE_VARIABLE#ole_type - * + * * Returns OLE type string. * * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') @@ -6262,7 +6262,7 @@ ole_variable_ole_type_detail(ITypeInfo *pTypeInfo, UINT var_index) /* * call-seq: * WIN32OLE_VARIABLE#ole_type_detail - * + * * Returns detail information of type. The information is array of type. * * tobj = WIN32OLE_TYPE.new('DirectX 7 for Visual Basic Type Library', 'D3DCLIPSTATUS') @@ -6297,8 +6297,8 @@ ole_variable_value(ITypeInfo *pTypeInfo, UINT var_index) /* * call-seq: * WIN32OLE_VARIABLE#value - * - * Returns value if value is exists. If the value does not exist, + * + * Returns value if value is exists. If the value does not exist, * this method returns nil. * * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') @@ -6314,7 +6314,7 @@ ole_variable_value(ITypeInfo *pTypeInfo, UINT var_index) * xlExcel4MacroSheet = 3 * xlWorksheet = -4167 * - */ + */ static VALUE folevariable_value(VALUE self) { @@ -6344,7 +6344,7 @@ ole_variable_visible(ITypeInfo *pTypeInfo, UINT var_index) /* * call-seq: * WIN32OLE_VARIABLE#visible? - * + * * Returns true if the variable is public. * * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') @@ -6359,7 +6359,7 @@ ole_variable_visible(ITypeInfo *pTypeInfo, UINT var_index) * xlExcel4IntlMacroSheet true * xlExcel4MacroSheet true * xlWorksheet true - * + * */ static VALUE folevariable_visible(VALUE self) @@ -6401,7 +6401,7 @@ ole_variable_kind(ITypeInfo *pTypeInfo, UINT var_index) /* * call-seq: * WIN32OLE_VARIABLE#variable_kind - * + * * Returns variable kind string. * * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') @@ -6435,14 +6435,14 @@ ole_variable_varkind(ITypeInfo *pTypeInfo, UINT var_index) if (FAILED(hr)) return kind; pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc); - kind = INT2FIX(pVarDesc->varkind); + kind = INT2FIX(pVarDesc->varkind); return kind; } /* * call-seq: * WIN32OLE_VARIABLE#varkind - * + * * Returns the number which represents variable kind. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') * variables = tobj.variables @@ -6469,7 +6469,7 @@ folevariable_varkind(VALUE self) * call-seq: * WIN32OLE_VARIABLE#inspect -> String * - * Returns the OLE variable name and the value with class name. + * Returns the OLE variable name and the value with class name. * */ static VALUE @@ -6506,7 +6506,7 @@ folemethod_s_allocate(VALUE klass) { struct olemethoddata *pmethod; VALUE obj; - obj = Data_Make_Struct(klass, + obj = Data_Make_Struct(klass, struct olemethoddata, 0, olemethod_free, pmethod); pmethod->pTypeInfo = NULL; @@ -6518,7 +6518,7 @@ folemethod_s_allocate(VALUE klass) /* * call-seq: * WIN32OLE_METHOD.new(ole_type, method) -> WIN32OLE_METHOD object - * + * * Returns a new WIN32OLE_METHOD object which represents the information * about OLE method. * The first argument ole_type specifies WIN32OLE_TYPE object. @@ -6557,7 +6557,7 @@ folemethod_initialize(VALUE self, VALUE oletype, VALUE method) * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') * method = WIN32OLE_METHOD.new(tobj, 'SaveAs') * puts method.name # => SaveAs - * + * */ static VALUE folemethod_name(VALUE self) @@ -6573,9 +6573,9 @@ ole_method_return_type(ITypeInfo *pTypeInfo, UINT method_index) VALUE type; hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc); - if (FAILED(hr)) + if (FAILED(hr)) ole_raise(hr, eWIN32OLERuntimeError, "failed to GetFuncDesc"); - + type = ole_typedesc2val(pTypeInfo, &(pFuncDesc->elemdescFunc.tdesc), Qnil); pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc); return type; @@ -6584,7 +6584,7 @@ ole_method_return_type(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: * WIN32OLE_METHOD#return_type - * + * * Returns string of return value type of method. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') * method = WIN32OLE_METHOD.new(tobj, 'Add') @@ -6607,9 +6607,9 @@ ole_method_return_vtype(ITypeInfo *pTypeInfo, UINT method_index) VALUE vvt; hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc); - if (FAILED(hr)) + if (FAILED(hr)) ole_raise(hr, eWIN32OLERuntimeError, "failed to GetFuncDesc"); - + vvt = INT2FIX(pFuncDesc->elemdescFunc.tdesc.vt); pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc); return vvt; @@ -6618,7 +6618,7 @@ ole_method_return_vtype(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: * WIN32OLE_METHOD#return_vtype - * + * * Returns number of return value type of method. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') * method = WIN32OLE_METHOD.new(tobj, 'Add') @@ -6641,9 +6641,9 @@ ole_method_return_type_detail(ITypeInfo *pTypeInfo, UINT method_index) VALUE type = rb_ary_new(); hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc); - if (FAILED(hr)) + if (FAILED(hr)) return type; - + ole_typedesc2val(pTypeInfo, &(pFuncDesc->elemdescFunc.tdesc), type); pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc); return type; @@ -6652,7 +6652,7 @@ ole_method_return_type_detail(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: * WIN32OLE_METHOD#return_type_detail - * + * * Returns detail information of return value type of method. * The information is array. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') @@ -6674,7 +6674,7 @@ ole_method_invkind(ITypeInfo *pTypeInfo, UINT method_index) HRESULT hr; VALUE invkind; hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc); - if(FAILED(hr)) + if(FAILED(hr)) ole_raise(hr, eWIN32OLERuntimeError, "failed to GetFuncDesc"); invkind = INT2FIX(pFuncDesc->invkind); pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc); @@ -6704,8 +6704,8 @@ ole_method_invoke_kind(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: * WIN32OLE_MTHOD#invkind - * - * Returns the method invoke kind. + * + * Returns the method invoke kind. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') * method = WIN32OLE_METHOD.new(tobj, 'Add') * puts method.invkind # => 1 @@ -6722,9 +6722,9 @@ folemethod_invkind(VALUE self) /* * call-seq: * WIN32OLE_METHOD#invoke_kind - * - * Returns the method kind string. The string is "UNKNOWN" or "PROPERTY" - * or "PROPERTY" or "PROPERTYGET" or "PROPERTYPUT" or "PROPERTYPPUTREF" + * + * Returns the method kind string. The string is "UNKNOWN" or "PROPERTY" + * or "PROPERTY" or "PROPERTYGET" or "PROPERTYPUT" or "PROPERTYPPUTREF" * or "FUNC". * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') * method = WIN32OLE_METHOD.new(tobj, 'Add') @@ -6761,7 +6761,7 @@ ole_method_visible(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: * WIN32OLE_METHOD#visible? - * + * * Returns true if the method is public. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') * method = WIN32OLE_METHOD.new(tobj, 'Add') @@ -6788,9 +6788,9 @@ ole_method_event(ITypeInfo *pTypeInfo, UINT method_index, VALUE method_name) BSTR bstr; VALUE name; VALUE event = Qfalse; - + hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr); - if (FAILED(hr)) + if (FAILED(hr)) return event; if(pTypeAttr->typekind != TKIND_COCLASS) { pTypeInfo->lpVtbl->ReleaseTypeAttr(pTypeInfo, pTypeAttr); @@ -6810,14 +6810,14 @@ ole_method_event(ITypeInfo *pTypeInfo, UINT method_index, VALUE method_name) href, &pRefTypeInfo); if (FAILED(hr)) continue; - hr = pRefTypeInfo->lpVtbl->GetFuncDesc(pRefTypeInfo, method_index, + hr = pRefTypeInfo->lpVtbl->GetFuncDesc(pRefTypeInfo, method_index, &pFuncDesc); if (FAILED(hr)) { OLE_RELEASE(pRefTypeInfo); continue; } - hr = pRefTypeInfo->lpVtbl->GetDocumentation(pRefTypeInfo, + hr = pRefTypeInfo->lpVtbl->GetDocumentation(pRefTypeInfo, pFuncDesc->memid, &bstr, NULL, NULL, NULL); if (FAILED(hr)) { @@ -6842,7 +6842,7 @@ ole_method_event(ITypeInfo *pTypeInfo, UINT method_index, VALUE method_name) /* * call-seq: * WIN32OLE_METHOD#event? - * + * * Returns true if the method is event. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') * method = WIN32OLE_METHOD.new(tobj, 'SheetActivate') @@ -6856,7 +6856,7 @@ folemethod_event(VALUE self) Data_Get_Struct(self, struct olemethoddata, pmethod); if (!pmethod->pOwnerTypeInfo) return Qfalse; - return ole_method_event(pmethod->pOwnerTypeInfo, + return ole_method_event(pmethod->pOwnerTypeInfo, pmethod->index, rb_ivar_get(self, rb_intern("name"))); } @@ -6913,7 +6913,7 @@ ole_method_helpstring(ITypeInfo *pTypeInfo, UINT method_index) HRESULT hr; BSTR bhelpstring; hr = ole_method_docinfo_from_type(pTypeInfo, method_index, NULL, &bhelpstring, - NULL, NULL); + NULL, NULL); if (FAILED(hr)) return Qnil; return WC2VSTR(bhelpstring); @@ -6923,7 +6923,7 @@ ole_method_helpstring(ITypeInfo *pTypeInfo, UINT method_index) * call-seq: * WIN32OLE_METHOD#helpstring * - * Returns help string of OLE method. If the help string is not found, + * Returns help string of OLE method. If the help string is not found, * then the method returns nil. * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'IWebBrowser') * method = WIN32OLE_METHOD.new(tobj, 'Navigate') @@ -6944,7 +6944,7 @@ ole_method_helpfile(ITypeInfo *pTypeInfo, UINT method_index) HRESULT hr; BSTR bhelpfile; hr = ole_method_docinfo_from_type(pTypeInfo, method_index, NULL, NULL, - NULL, &bhelpfile); + NULL, &bhelpfile); if (FAILED(hr)) return Qnil; return WC2VSTR(bhelpfile); @@ -6953,8 +6953,8 @@ ole_method_helpfile(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: * WIN32OLE_METHOD#helpfile - * - * Returns help file. If help file is not found, then + * + * Returns help file. If help file is not found, then * the method returns nil. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') * method = WIN32OLE_METHOD.new(tobj, 'Add') @@ -6975,16 +6975,16 @@ ole_method_helpcontext(ITypeInfo *pTypeInfo, UINT method_index) HRESULT hr; DWORD helpcontext = 0; hr = ole_method_docinfo_from_type(pTypeInfo, method_index, NULL, NULL, - &helpcontext, NULL); + &helpcontext, NULL); if (FAILED(hr)) return Qnil; return INT2FIX(helpcontext); } -/* +/* * call-seq: * WIN32OLE_METHOD#helpcontext - * + * * Returns help context. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') * method = WIN32OLE_METHOD.new(tobj, 'Add') @@ -7007,7 +7007,7 @@ ole_method_dispid(ITypeInfo *pTypeInfo, UINT method_index) hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc); if (FAILED(hr)) return dispid; - dispid = INT2NUM(pFuncDesc->memid); + dispid = INT2NUM(pFuncDesc->memid); pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc); return dispid; } @@ -7015,7 +7015,7 @@ ole_method_dispid(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: * WIN32OLE_METHOD#dispid - * + * * Returns dispatch ID. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') * method = WIN32OLE_METHOD.new(tobj, 'Add') @@ -7038,7 +7038,7 @@ ole_method_offset_vtbl(ITypeInfo *pTypeInfo, UINT method_index) hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc); if (FAILED(hr)) return offset_vtbl; - offset_vtbl = INT2FIX(pFuncDesc->oVft); + offset_vtbl = INT2FIX(pFuncDesc->oVft); pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc); return offset_vtbl; } @@ -7046,7 +7046,7 @@ ole_method_offset_vtbl(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: * WIN32OLE_METHOD#offset_vtbl - * + * * Returns the offset ov VTBL. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') * method = WIN32OLE_METHOD.new(tobj, 'Add') @@ -7077,12 +7077,12 @@ ole_method_size_params(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: * WIN32OLE_METHOD#size_params - * + * * Returns the size of arguments of the method. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') * method = WIN32OLE_METHOD.new(tobj, 'SaveAs') * puts method.size_params # => 11 - * + * */ static VALUE folemethod_size_params(VALUE self) @@ -7109,7 +7109,7 @@ ole_method_size_opt_params(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: * WIN32OLE_METHOD#size_opt_params - * + * * Returns the size of optional parameters. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') * method = WIN32OLE_METHOD.new(tobj, 'SaveAs') @@ -7134,12 +7134,12 @@ ole_method_params(ITypeInfo *pTypeInfo, UINT method_index) VALUE param; VALUE params = rb_ary_new(); hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc); - if (FAILED(hr)) + if (FAILED(hr)) return params; len = 0; bstrs = ALLOCA_N(BSTR, pFuncDesc->cParams + 1); - hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, pFuncDesc->memid, + hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, pFuncDesc->memid, bstrs, pFuncDesc->cParams + 1, &len); if (FAILED(hr)) { @@ -7167,13 +7167,13 @@ ole_method_params(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: * WIN32OLE_METHOD#params - * + * * returns array of WIN32OLE_PARAM object corresponding with method parameters. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') * method = WIN32OLE_METHOD.new(tobj, 'SaveAs') - * p method.params # => [Filename, FileFormat, Password, WriteResPassword, - * ReadOnlyRecommended, CreateBackup, AccessMode, - * ConflictResolution, AddToMru, TextCodepage, + * p method.params # => [Filename, FileFormat, Password, WriteResPassword, + * ReadOnlyRecommended, CreateBackup, AccessMode, + * ConflictResolution, AddToMru, TextCodepage, * TextVisualLayout] */ static VALUE @@ -7200,14 +7200,14 @@ folemethod_inspect(VALUE self) /* * Document-class: WIN32OLE_PARAM * - * WIN32OLE_PARAM objects represent param information of + * WIN32OLE_PARAM objects represent param information of * the OLE method. */ static VALUE foleparam_s_allocate(VALUE klass) { struct oleparamdata *pparam; VALUE obj; - obj = Data_Make_Struct(klass, + obj = Data_Make_Struct(klass, struct oleparamdata, 0, oleparam_free, pparam); pparam->pTypeInfo = NULL; @@ -7216,7 +7216,7 @@ static VALUE foleparam_s_allocate(VALUE klass) return obj; } -static VALUE +static VALUE oleparam_ole_param_from_index(VALUE self, ITypeInfo *pTypeInfo, UINT method_index, int param_index) { FUNCDESC *pFuncDesc; @@ -7225,12 +7225,12 @@ oleparam_ole_param_from_index(VALUE self, ITypeInfo *pTypeInfo, UINT method_inde UINT len; struct oleparamdata *pparam; hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc); - if (FAILED(hr)) + if (FAILED(hr)) ole_raise(hr, rb_eRuntimeError, "fail to ITypeInfo::GetFuncDesc"); len = 0; bstrs = ALLOCA_N(BSTR, pFuncDesc->cParams + 1); - hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, pFuncDesc->memid, + hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, pFuncDesc->memid, bstrs, pFuncDesc->cParams + 1, &len); if (FAILED(hr)) { @@ -7275,7 +7275,7 @@ static VALUE foleparam_initialize(VALUE self, VALUE olemethod, VALUE n) /* * call-seq: * WIN32OLE_PARAM#name - * + * * Returns name. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') * method = WIN32OLE_METHOD.new(tobj, 'SaveAs') @@ -7297,7 +7297,7 @@ ole_param_ole_type(ITypeInfo *pTypeInfo, UINT method_index, UINT index) hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc); if (FAILED(hr)) return type; - type = ole_typedesc2val(pTypeInfo, + type = ole_typedesc2val(pTypeInfo, &(pFuncDesc->lprgelemdescParam[index].tdesc), Qnil); pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc); return type; @@ -7313,12 +7313,12 @@ ole_param_ole_type(ITypeInfo *pTypeInfo, UINT method_index, UINT index) * param1 = method.params[0] * puts param1.ole_type # => VARIANT */ -static VALUE +static VALUE foleparam_ole_type(VALUE self) { struct oleparamdata *pparam; Data_Get_Struct(self, struct oleparamdata, pparam); - return ole_param_ole_type(pparam->pTypeInfo, pparam->method_index, + return ole_param_ole_type(pparam->pTypeInfo, pparam->method_index, pparam->index); } @@ -7331,7 +7331,7 @@ ole_param_ole_type_detail(ITypeInfo *pTypeInfo, UINT method_index, UINT index) hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc); if (FAILED(hr)) return typedetail; - ole_typedesc2val(pTypeInfo, + ole_typedesc2val(pTypeInfo, &(pFuncDesc->lprgelemdescParam[index].tdesc), typedetail); pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc); return typedetail; @@ -7347,12 +7347,12 @@ ole_param_ole_type_detail(ITypeInfo *pTypeInfo, UINT method_index, UINT index) * param1 = method.params[0] * p param1.ole_type_detail # => ["PTR", "USERDEFINED", "Range"] */ -static VALUE +static VALUE foleparam_ole_type_detail(VALUE self) { struct oleparamdata *pparam; Data_Get_Struct(self, struct oleparamdata, pparam); - return ole_param_ole_type_detail(pparam->pTypeInfo, pparam->method_index, + return ole_param_ole_type_detail(pparam->pTypeInfo, pparam->method_index, pparam->index); } @@ -7363,9 +7363,9 @@ ole_param_flag_mask(ITypeInfo *pTypeInfo, UINT method_index, UINT index, USHORT HRESULT hr; VALUE ret = Qfalse; hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc); - if(FAILED(hr)) + if(FAILED(hr)) return ret; - if (V_UNION1((&(pFuncDesc->lprgelemdescParam[index])), paramdesc).wParamFlags &mask) + if (V_UNION1((&(pFuncDesc->lprgelemdescParam[index])), paramdesc).wParamFlags &mask) ret = Qtrue; pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc); return ret; @@ -7374,7 +7374,7 @@ ole_param_flag_mask(ITypeInfo *pTypeInfo, UINT method_index, UINT index, USHORT /* * call-seq: * WIN32OLE_PARAM#input? - * + * * Returns true if the parameter is input. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') * method = WIN32OLE_METHOD.new(tobj, 'SaveAs') @@ -7385,14 +7385,14 @@ static VALUE foleparam_input(VALUE self) { struct oleparamdata *pparam; Data_Get_Struct(self, struct oleparamdata, pparam); - return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index, + return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index, pparam->index, PARAMFLAG_FIN); } /* * call-seq: * WIN32OLE#output? - * + * * Returns true if argument is output. * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'DWebBrowserEvents') * method = WIN32OLE_METHOD.new(tobj, 'NewWindow') @@ -7412,14 +7412,14 @@ static VALUE foleparam_output(VALUE self) { struct oleparamdata *pparam; Data_Get_Struct(self, struct oleparamdata, pparam); - return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index, + return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index, pparam->index, PARAMFLAG_FOUT); } /* * call-seq: * WIN32OLE_PARAM#optional? - * + * * Returns true if argument is optional. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') * method = WIN32OLE_METHOD.new(tobj, 'SaveAs') @@ -7430,7 +7430,7 @@ static VALUE foleparam_optional(VALUE self) { struct oleparamdata *pparam; Data_Get_Struct(self, struct oleparamdata, pparam); - return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index, + return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index, pparam->index, PARAMFLAG_FOPT); } @@ -7439,7 +7439,7 @@ static VALUE foleparam_optional(VALUE self) * WIN32OLE_PARAM#retval? * * Returns true if argument is return value. - * tobj = WIN32OLE_TYPE.new('DirectX 7 for Visual Basic Type Library', + * tobj = WIN32OLE_TYPE.new('DirectX 7 for Visual Basic Type Library', * 'DirectPlayLobbyConnection') * method = WIN32OLE_METHOD.new(tobj, 'GetPlayerShortName') * param = method.params[0] @@ -7449,7 +7449,7 @@ static VALUE foleparam_retval(VALUE self) { struct oleparamdata *pparam; Data_Get_Struct(self, struct oleparamdata, pparam); - return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index, + return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index, pparam->index, PARAMFLAG_FRETVAL); } @@ -7466,7 +7466,7 @@ ole_param_default(ITypeInfo *pTypeInfo, UINT method_index, UINT index) hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc); if (FAILED(hr)) return defval; - pElemDesc = &pFuncDesc->lprgelemdescParam[index]; + pElemDesc = &pFuncDesc->lprgelemdescParam[index]; wParamFlags = V_UNION1(pElemDesc, paramdesc).wParamFlags; if ((wParamFlags & mask) == mask) { pParamDescEx = V_UNION1(pElemDesc, paramdesc).pparamdescex; @@ -7479,8 +7479,8 @@ ole_param_default(ITypeInfo *pTypeInfo, UINT method_index, UINT index) /* * call-seq: * WIN32OLE_PARAM#default - * - * Returns default value. If the default value does not exist, + * + * Returns default value. If the default value does not exist, * this method returns nil. * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') * method = WIN32OLE_METHOD.new(tobj, 'SaveAs') @@ -7532,7 +7532,7 @@ foleparam_inspect(VALUE self) } return make_inspect("WIN32OLE_PARAM", detail); } - + /* * Document-class: WIN32OLE_EVENT * @@ -7623,7 +7623,7 @@ ole_search_event_at(VALUE ary, VALUE ev) VALUE event; VALUE def_event; VALUE event_name; - long i, len; + long i, len; long ret = -1; def_event = Qnil; len = RARRAY_LEN(ary); @@ -7696,7 +7696,7 @@ ole_delete_event(VALUE ary, VALUE ev) } } -static void +static void hash2ptr_dispparams(VALUE hash, ITypeInfo *pTypeInfo, DISPID dispid, DISPPARAMS *pdispparams) { BSTR *bstrs; @@ -7707,7 +7707,7 @@ hash2ptr_dispparams(VALUE hash, ITypeInfo *pTypeInfo, DISPID dispid, DISPPARAMS VALUE key; len = 0; bstrs = ALLOCA_N(BSTR, pdispparams->cArgs + 1); - hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, dispid, + hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, dispid, bstrs, pdispparams->cArgs + 1, &len); if (FAILED(hr)) @@ -7716,7 +7716,7 @@ hash2ptr_dispparams(VALUE hash, ITypeInfo *pTypeInfo, DISPID dispid, DISPPARAMS for (i = 0; i < len - 1; i++) { key = WC2VSTR(bstrs[i + 1]); val = rb_hash_aref(hash, INT2FIX(i)); - if (val == Qnil) + if (val == Qnil) val = rb_hash_aref(hash, key); if (val == Qnil) val = rb_hash_aref(hash, rb_str_intern(key)); @@ -7725,7 +7725,7 @@ hash2ptr_dispparams(VALUE hash, ITypeInfo *pTypeInfo, DISPID dispid, DISPPARAMS } } -static VALUE +static VALUE hash2result(VALUE hash) { VALUE ret = Qnil; @@ -7761,7 +7761,7 @@ exec_callback(VALUE arg) static VALUE rescue_callback(VALUE arg) { - + VALUE error; VALUE e = rb_errinfo(); VALUE bt = rb_funcall(e, rb_intern("backtrace"), 0); @@ -7772,7 +7772,7 @@ rescue_callback(VALUE arg) rb_backtrace(); ruby_finalize(); exit(-1); - + return Qnil; } @@ -7853,7 +7853,7 @@ STDMETHODIMP EVENTSINK_Invoke( /* * if exception raised in event callback, - * then you receive cfp consistency error. + * then you receive cfp consistency error. * to avoid this error we use begin rescue end. * and the exception raised then error message print * and exit ruby process by Win32OLE itself. @@ -7876,7 +7876,7 @@ STDMETHODIMP EVENTSINK_Invoke( VariantInit(pvarResult); ole_val2variant(result, pvarResult); } - + return NOERROR; } @@ -8024,11 +8024,11 @@ find_iid(VALUE ole, char *pitf, IID *piid, ITypeInfo **ppTypeInfo) return hr; } -static HRESULT +static HRESULT find_coclass( - ITypeInfo *pTypeInfo, - TYPEATTR *pTypeAttr, - ITypeInfo **pCOTypeInfo, + ITypeInfo *pTypeInfo, + TYPEATTR *pTypeAttr, + ITypeInfo **pCOTypeInfo, TYPEATTR **pCOTypeAttr) { HRESULT hr = E_NOINTERFACE; @@ -8066,13 +8066,13 @@ find_coclass( hr = pTypeInfo2->lpVtbl->GetImplTypeFlags(pTypeInfo2, j, &flags); if (FAILED(hr)) continue; - if (!(flags & IMPLTYPEFLAG_FDEFAULT)) + if (!(flags & IMPLTYPEFLAG_FDEFAULT)) continue; hr = pTypeInfo2->lpVtbl->GetRefTypeOfImplType(pTypeInfo2, j, &href); if (FAILED(hr)) continue; hr = pTypeInfo2->lpVtbl->GetRefTypeInfo(pTypeInfo2, href, &pRefTypeInfo); - if (FAILED(hr)) + if (FAILED(hr)) continue; hr = OLE_GET_TYPEATTR(pRefTypeInfo, &pRefTypeAttr); if (FAILED(hr)) { @@ -8101,8 +8101,8 @@ find_coclass( static HRESULT find_default_source_from_typeinfo( - ITypeInfo *pTypeInfo, - TYPEATTR *pTypeAttr, + ITypeInfo *pTypeInfo, + TYPEATTR *pTypeAttr, ITypeInfo **ppTypeInfo) { int i = 0; @@ -8334,7 +8334,7 @@ ev_advise(int argc, VALUE *argv, VALUE self) * The second argument specifies OLE event name. * ie = WIN32OLE.new('InternetExplorer.Application') * ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents') - */ + */ static VALUE fev_initialize(int argc, VALUE *argv, VALUE self) { @@ -8348,7 +8348,7 @@ fev_initialize(int argc, VALUE *argv, VALUE self) /* * call-seq: * WIN32OLE_EVENT.message_loop - * + * * Translates and dispatches Windows message. */ static VALUE @@ -8397,7 +8397,7 @@ ev_on_event(int argc, VALUE *argv, VALUE self, VALUE is_ary_arg) /* * call-seq: * WIN32OLE_EVENT#on_event([event]){...} - * + * * Defines the callback event. * If argument is omitted, this method defines the callback of all events. * If you want to modify reference argument in callback, return hash in @@ -8407,14 +8407,14 @@ ev_on_event(int argc, VALUE *argv, VALUE self, VALUE is_ary_arg) * ie = WIN32OLE.new('InternetExplorer.Application') * ev = WIN32OLE_EVENT.new(ie) * ev.on_event("NavigateComplete") {|url| puts url} - * ev.on_event() {|ev, *args| puts "#{ev} fired"} + * ev.on_event() {|ev, *args| puts "#{ev} fired"} * - * ev.on_event("BeforeNavigate2") {|*args| + * ev.on_event("BeforeNavigate2") {|*args| * ... * # set true to BeforeNavigate reference argument `Cancel'. * # Cancel is 7-th argument of BeforeNavigate, * # so you can use 6 as key of hash instead of 'Cancel'. - * # The argument is counted from 0. + * # The argument is counted from 0. * # The hash key of 0 means first argument.) * {:Cancel => true} # or {'Cancel' => true} or {6 => true} * } @@ -8432,9 +8432,9 @@ fev_on_event(int argc, VALUE *argv, VALUE self) /* * call-seq: * WIN32OLE_EVENT#on_event_with_outargs([event]){...} - * + * * Defines the callback of event. - * If you want modify argument in callback, + * If you want modify argument in callback, * you could use this method instead of WIN32OLE_EVENT#on_event. * * ie = WIN32OLE.new('InternetExplorer.Application') @@ -8452,7 +8452,7 @@ fev_on_event_with_outargs(int argc, VALUE *argv, VALUE self) /* * call-seq: * WIN32OLE_EVENT#off_event([event]) - * + * * removes the callback of event. * * ie = WIN32OLE.new('InternetExplorer.Application') @@ -8503,7 +8503,7 @@ fev_off_event(int argc, VALUE *argv, VALUE self) * ev.unadvise * */ -static VALUE +static VALUE fev_unadvise(VALUE self) { struct oleeventdata *poleev; @@ -8518,7 +8518,7 @@ fev_unadvise(VALUE self) return Qnil; } -static VALUE +static VALUE evs_push(VALUE ev) { return rb_ary_push(ary_ole_event, ev); @@ -8531,13 +8531,13 @@ evs_delete(long i) return Qnil; } -static VALUE +static VALUE evs_entry(long i) { return rb_ary_entry(ary_ole_event, i); } -static VALUE +static VALUE evs_length() { return rb_funcall(ary_ole_event, rb_intern("length"), 0); @@ -8548,9 +8548,9 @@ evs_length() * WIN32OLE_EVENT#handler= * * sets event handler object. If handler object has onXXX - * method according to XXX event, then onXXX method is called + * method according to XXX event, then onXXX method is called * when XXX event occurs. - * + * * If handler object has method_missing and there is no * method according to the event, then method_missing * called and 1-st argument is event name. @@ -8571,7 +8571,7 @@ evs_length() * puts "other event #{ev}" * end * end - * + * * handler = Handler.new * ie = WIN32OLE.new('InternetExplorer.Application') * ev = WIN32OLE_EVENT.new(ie) @@ -8592,8 +8592,8 @@ fev_set_handler(VALUE self, VALUE val) * call-seq: * WIN32OLE_EVENT#handler * - * returns handler object. - * + * returns handler object. + * */ static VALUE fev_get_handler(VALUE self) @@ -8601,7 +8601,7 @@ fev_get_handler(VALUE self) return rb_ivar_get(self, rb_intern("handler")); } -static void +static void olevariant_free(struct olevariantdata *pvar) { VariantClear(&(pvar->realvar)); @@ -8626,8 +8626,8 @@ folevariant_s_allocate(VALUE klass) * WIN32OLE_VARIANT.array(ary, vt) * * Returns Ruby object wrapping OLE variant whose variant type is VT_ARRAY. - * The first argument should be Array object which specifies dimensions - * and each size of dimensions of OLE array. + * The first argument should be Array object which specifies dimensions + * and each size of dimensions of OLE array. * The second argument specifies variant type of the element of OLE array. * * The following create 2 dimensions OLE array. The first dimensions size @@ -8636,7 +8636,7 @@ folevariant_s_allocate(VALUE klass) * ole_ary = WIN32OLE_VARIANT.array([3,4], VT_I4) * ruby_ary = ole_ary.value # => [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] * - */ + */ static VALUE folevariant_s_array(VALUE klass, VALUE elems, VALUE vvt) { @@ -8693,7 +8693,7 @@ folevariant_s_array(VALUE klass, VALUE elems, VALUE vvt) * * Returns Ruby object wrapping OLE variant. * The first argument specifies Ruby object to convert OLE variant variable. - * The second argument specifies VARIANT type. + * The second argument specifies VARIANT type. * In some situation, you need the WIN32OLE_VARIANT object to pass OLE method * * shell = WIN32OLE.new("Shell.Application") @@ -8704,7 +8704,7 @@ folevariant_s_array(VALUE klass, VALUE elems, VALUE vvt) * shortcut = WIN32OLE_VARIANT.new("Create Shortcut(\&S)") * item.invokeVerb(shortcut) * - */ + */ static VALUE folevariant_initialize(VALUE self, VALUE args) { @@ -8722,7 +8722,7 @@ folevariant_initialize(VALUE self, VALUE args) VariantInit(&var); val = rb_ary_entry(args, 0); - if(!rb_obj_is_kind_of(val, cWIN32OLE) && + if(!rb_obj_is_kind_of(val, cWIN32OLE) && !rb_obj_is_kind_of(val, cWIN32OLE_VARIANT) && !rb_obj_is_kind_of(val, rb_cTime)) { switch (TYPE(val)) { @@ -8753,7 +8753,7 @@ folevariant_initialize(VALUE self, VALUE args) return self; } -static SAFEARRAY * +static SAFEARRAY * get_locked_safe_array(VALUE val) { struct olevariantdata *pvar; @@ -8795,7 +8795,7 @@ ary2safe_array_index(int ary_size, VALUE *ary, SAFEARRAY *psa) } static void -unlock_safe_array(SAFEARRAY *psa) +unlock_safe_array(SAFEARRAY *psa) { HRESULT hr; hr = SafeArrayUnlock(psa); @@ -8809,11 +8809,11 @@ unlock_safe_array(SAFEARRAY *psa) * WIN32OLE_VARIANT[i,j,...] #=> element of OLE array. * * Returns the element of WIN32OLE_VARIANT object(OLE array). - * This method is available only when the variant type of + * This method is available only when the variant type of * WIN32OLE_VARIANT object is VT_ARRAY. * - * REMARK: - * The all indicies should be 0 or natural number and + * REMARK: + * The all indicies should be 0 or natural number and * lower than or equal to max indicies. * (This point is different with Ruby Array indicies.) * @@ -8823,7 +8823,7 @@ unlock_safe_array(SAFEARRAY *psa) * p obj[2,0] # => WIN32OLERuntimeError * p obj[0, -1] # => WIN32OLERuntimeError * - */ + */ static VALUE folevariant_ary_aref(int argc, VALUE *argv, VALUE self) { @@ -8836,7 +8836,7 @@ folevariant_ary_aref(int argc, VALUE *argv, VALUE self) Data_Get_Struct(self, struct olevariantdata, pvar); if (!V_ISARRAY(&(pvar->var))) { - rb_raise(eWIN32OLERuntimeError, + rb_raise(eWIN32OLERuntimeError, "`[]' is not available for this variant type object"); } psa = get_locked_safe_array(self); @@ -8869,7 +8869,7 @@ val2variant_ptr(VALUE val, VARIANT *var, VARTYPE vt) p = var; } else { if ( (vt & ~VT_BYREF) != V_VT(var)) { - hr = VariantChangeTypeEx(var, var, + hr = VariantChangeTypeEx(var, var, cWIN32OLE_lcid, 0, (VARTYPE)(vt & ~VT_BYREF)); if (FAILED(hr)) { ole_raise(hr, rb_eRuntimeError, "failed to change type"); @@ -8888,10 +8888,10 @@ val2variant_ptr(VALUE val, VARIANT *var, VARTYPE vt) * WIN32OLE_VARIANT[i,j,...] = val #=> set the element of OLE array * * Set the element of WIN32OLE_VARIANT object(OLE array) to val. - * This method is available only when the variant type of + * This method is available only when the variant type of * WIN32OLE_VARIANT object is VT_ARRAY. * - * REMARK: + * REMARK: * The all indicies should be 0 or natural number and * lower than or equal to max indicies. * (This point is different with Ruby Array indicies.) @@ -8903,7 +8903,7 @@ val2variant_ptr(VALUE val, VARIANT *var, VARTYPE vt) * obj[2,0] = 9 # => WIN32OLERuntimeError * obj[0, -1] = 9 # => WIN32OLERuntimeError * - */ + */ static VALUE folevariant_ary_aset(int argc, VALUE *argv, VALUE self) { @@ -8917,7 +8917,7 @@ folevariant_ary_aset(int argc, VALUE *argv, VALUE self) Data_Get_Struct(self, struct olevariantdata, pvar); if (!V_ISARRAY(&(pvar->var))) { - rb_raise(eWIN32OLERuntimeError, + rb_raise(eWIN32OLERuntimeError, "`[]' is not available for this variant type object"); } psa = get_locked_safe_array(self); @@ -8952,7 +8952,7 @@ folevariant_ary_aset(int argc, VALUE *argv, VALUE self) * obj = WIN32OLE_VARIANT.new(1, WIN32OLE::VARIANT::VT_BSTR) * obj.value # => "1" (not Fixnum object, but String object "1") * - */ + */ static VALUE folevariant_value(VALUE self) { @@ -8989,9 +8989,9 @@ folevariant_value(VALUE self) * * Returns OLE variant type. * obj = WIN32OLE_VARIANT.new("string") - * obj.vartype # => WIN32OLE::VARIANT::VT_BSTR + * obj.vartype # => WIN32OLE::VARIANT::VT_BSTR * - */ + */ static VALUE folevariant_vartype(VALUE self) { @@ -9004,16 +9004,16 @@ folevariant_vartype(VALUE self) * call-seq: * WIN32OLE_VARIANT.value = val #=> set WIN32OLE_VARIANT value to val. * - * Sets variant value to val. If the val type does not match variant value - * type(vartype), then val is changed to match variant value type(vartype) + * Sets variant value to val. If the val type does not match variant value + * type(vartype), then val is changed to match variant value type(vartype) * before setting val. * Thie method is not available when vartype is VT_ARRAY(except VT_UI1|VT_ARRAY). * If the vartype is VT_UI1|VT_ARRAY, the val should be String object. * * obj = WIN32OLE_VARIANT.new(1) # obj.vartype is WIN32OLE::VARIANT::VT_I4 * obj.value = 3.2 # 3.2 is changed to 3 when setting value. - * p obj.value # => 3 - */ + * p obj.value # => 3 + */ static VALUE folevariant_set_value(VALUE self, VALUE val) { @@ -9022,14 +9022,14 @@ folevariant_set_value(VALUE self, VALUE val) Data_Get_Struct(self, struct olevariantdata, pvar); vt = V_VT(&(pvar->var)); if (V_ISARRAY(&(pvar->var)) && ((vt & ~VT_BYREF) != (VT_UI1|VT_ARRAY) || TYPE(val) != T_STRING)) { - rb_raise(eWIN32OLERuntimeError, + rb_raise(eWIN32OLERuntimeError, "`value=' is not available for this variant type object"); } ole_val2olevariantdata(val, vt, pvar); return Qnil; } -static void +static void init_enc2cp() { enc2cp_table = st_init_numtable(); @@ -9062,7 +9062,7 @@ Init_win32ole() message_filter.HandleInComingCall = mf_HandleInComingCall; message_filter.RetryRejectedCall = mf_RetryRejectedCall; message_filter.MessagePending = mf_MessagePending; - + com_hash = Data_Wrap_Struct(rb_cData, rb_mark_hash, st_free_table, st_init_numtable()); rb_gc_register_mark_object(com_hash); @@ -9093,7 +9093,7 @@ Init_win32ole() rb_define_method(cWIN32OLE, "_setproperty", fole_setproperty2, 3); /* support propput method that takes an argument */ - rb_define_method(cWIN32OLE, "[]=", fole_setproperty_with_bracket, -1); + rb_define_method(cWIN32OLE, "[]=", fole_setproperty_with_bracket, -1); rb_define_method(cWIN32OLE, "ole_free", fole_free, 0); @@ -9177,7 +9177,7 @@ Init_win32ole() rb_define_method(cWIN32OLE_TYPELIB, "library_name", foletypelib_library_name, 0); rb_define_alias(cWIN32OLE_TYPELIB, "to_s", "name"); rb_define_method(cWIN32OLE_TYPELIB, "inspect", foletypelib_inspect, 0); - + cWIN32OLE_TYPE = rb_define_class("WIN32OLE_TYPE", rb_cObject); rb_define_singleton_method(cWIN32OLE_TYPE, "ole_classes", foletype_s_ole_classes, 1); rb_define_singleton_method(cWIN32OLE_TYPE, "typelibs", foletype_s_typelibs, 0); @@ -9253,7 +9253,7 @@ Init_win32ole() rb_define_method(cWIN32OLE_PARAM, "default", foleparam_default, 0); rb_define_alias(cWIN32OLE_PARAM, "to_s", "name"); rb_define_method(cWIN32OLE_PARAM, "inspect", foleparam_inspect, 0); - + cWIN32OLE_EVENT = rb_define_class("WIN32OLE_EVENT", rb_cObject); rb_define_singleton_method(cWIN32OLE_EVENT, "message_loop", fev_s_msg_loop, 0); rb_define_alloc_func(cWIN32OLE_EVENT, fev_s_allocate); diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 8c3af3dfe7..f4abe43469 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -1052,7 +1052,7 @@ rb_zstream_avail_out(VALUE obj) /* * Allocates +size+ bytes of free space in the output buffer. If there are more - * than +size+ bytes already in the buffer, the buffer is truncated. Because + * than +size+ bytes already in the buffer, the buffer is truncated. Because * free space is allocated automatically, you usually don't need to use this * method. */ @@ -1358,7 +1358,7 @@ rb_deflate_flush(int argc, VALUE *argv, VALUE obj) /* * call-seq: params(level, strategy) - * + * * Changes the parameters of the deflate stream. See zlib.h for details. The * output from the stream by changing the params is preserved in output * buffer. @@ -2781,7 +2781,7 @@ rb_gzfile_ecopts(struct gzfile *gz, VALUE opts) * Document-class: Zlib::GzipWriter * * Zlib::GzipWriter is a class for writing gzipped files. GzipWriter should - * be used with an instance of IO, or IO-like, object. + * be used with an instance of IO, or IO-like, object. * * For example: * @@ -2842,7 +2842,7 @@ rb_gzwriter_initialize(int argc, VALUE *argv, VALUE obj) opt = rb_check_convert_type(argv[argc-1], T_HASH, "Hash", "to_hash"); if (!NIL_P(opt)) argc--; } - + rb_scan_args(argc, argv, "12", &io, &level, &strategy); Data_Get_Struct(obj, struct gzfile, gz); @@ -3739,21 +3739,21 @@ Init_zlib() /* * Document-class: Zlib::GzipFile::NoFooter * - * Raised when gzip file footer is not found. + * Raised when gzip file footer is not found. */ /* * Document-class: Zlib::GzipFile::CRCError * * Raised when the CRC checksum recorded in gzip file footer is not equivalent - * to the CRC checksum of the actual uncompressed data. + * to the CRC checksum of the actual uncompressed data. */ /* * Document-class: Zlib::GzipFile::LengthError * * Raised when the data length recorded in the gzip file footer is not equivalent - * to the length of the actual uncompressed data. + * to the length of the actual uncompressed data. */ -- cgit v1.2.3