mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/Win32API/Win32API.c (Win32API_initialize): use RSTRING_PTR and
RSTRING_LEN. * ext/tk/stubs.c, ext/tk/tcltklib.c, ext/tk/tkutil/tkutil.c: ditto. * ext/win32ole/win32ole.c (ole_val2olevariantdata): ditto. * lib/mkmf.rb (create_makefile): follow nil.to_s. * win32/resource.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5b5e4a6fc1
commit
6790891ef0
8 changed files with 146 additions and 135 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,9 @@
|
||||||
|
Thu Aug 31 20:50:46 2006 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/mkmf.rb (create_makefile): follow nil.to_s.
|
||||||
|
|
||||||
|
* win32/resource.rb: ditto.
|
||||||
|
|
||||||
Thu Aug 31 20:21:47 2006 NAKAMURA Usaku <usa@ruby-lang.org>
|
Thu Aug 31 20:21:47 2006 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* file.c (test_identical, rb_file_s_truncate): use RSTRING_PTR and
|
* file.c (test_identical, rb_file_s_truncate): use RSTRING_PTR and
|
||||||
|
@ -9,6 +15,12 @@ Thu Aug 31 20:21:47 2006 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* util.c (ruby_add_suffix): ditto.
|
* util.c (ruby_add_suffix): ditto.
|
||||||
|
|
||||||
|
* ext/Win32API/Win32API.c (Win32API_initialize): ditto.
|
||||||
|
|
||||||
|
* ext/tk/stubs.c, ext/tk/tcltklib.c, ext/tk/tkutil/tkutil.c: ditto.
|
||||||
|
|
||||||
|
* ext/win32ole/win32ole.c (ole_val2olevariantdata): ditto.
|
||||||
|
|
||||||
Thu Aug 31 18:23:00 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Thu Aug 31 18:23:00 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* ruby.h (struct RString): embed small strings.
|
* ruby.h (struct RString): embed small strings.
|
||||||
|
|
|
@ -50,18 +50,18 @@ Win32API_initialize(self, dllname, proc, import, export)
|
||||||
|
|
||||||
SafeStringValue(dllname);
|
SafeStringValue(dllname);
|
||||||
SafeStringValue(proc);
|
SafeStringValue(proc);
|
||||||
hdll = LoadLibrary(RSTRING(dllname)->ptr);
|
hdll = LoadLibrary(RSTRING_PTR(dllname));
|
||||||
if (!hdll)
|
if (!hdll)
|
||||||
rb_raise(rb_eRuntimeError, "LoadLibrary: %s\n", RSTRING(dllname)->ptr);
|
rb_raise(rb_eRuntimeError, "LoadLibrary: %s\n", RSTRING_PTR(dllname));
|
||||||
rb_iv_set(self, "__hdll__", Data_Wrap_Struct(rb_cData, 0, Win32API_FreeLibrary, (void*)hdll));
|
rb_iv_set(self, "__hdll__", Data_Wrap_Struct(rb_cData, 0, Win32API_FreeLibrary, (void*)hdll));
|
||||||
hproc = (HANDLE)GetProcAddress(hdll, RSTRING(proc)->ptr);
|
hproc = (HANDLE)GetProcAddress(hdll, RSTRING_PTR(proc));
|
||||||
if (!hproc) {
|
if (!hproc) {
|
||||||
str = rb_str_new3(proc);
|
str = rb_str_new3(proc);
|
||||||
str = rb_str_cat(str, "A", 1);
|
str = rb_str_cat(str, "A", 1);
|
||||||
hproc = (HANDLE)GetProcAddress(hdll, RSTRING(str)->ptr);
|
hproc = (HANDLE)GetProcAddress(hdll, RSTRING_PTR(str));
|
||||||
if (!hproc)
|
if (!hproc)
|
||||||
rb_raise(rb_eRuntimeError, "GetProcAddress: %s or %s\n",
|
rb_raise(rb_eRuntimeError, "GetProcAddress: %s or %s\n",
|
||||||
RSTRING(proc)->ptr, RSTRING(str)->ptr);
|
RSTRING_PTR(proc), RSTRING_PTR(str));
|
||||||
}
|
}
|
||||||
rb_iv_set(self, "__dll__", UINT2NUM((unsigned long)hdll));
|
rb_iv_set(self, "__dll__", UINT2NUM((unsigned long)hdll));
|
||||||
rb_iv_set(self, "__dllname__", dllname);
|
rb_iv_set(self, "__dllname__", dllname);
|
||||||
|
@ -75,7 +75,7 @@ Win32API_initialize(self, dllname, proc, import, export)
|
||||||
ptr = RARRAY(import)->ptr;
|
ptr = RARRAY(import)->ptr;
|
||||||
for (i = 0, len = RARRAY(import)->len; i < len; i++) {
|
for (i = 0, len = RARRAY(import)->len; i < len; i++) {
|
||||||
SafeStringValue(ptr[i]);
|
SafeStringValue(ptr[i]);
|
||||||
switch (*(char *)RSTRING(ptr[i])->ptr) {
|
switch (*(char *)RSTRING_PTR(ptr[i])) {
|
||||||
case 'N': case 'n': case 'L': case 'l':
|
case 'N': case 'n': case 'L': case 'l':
|
||||||
rb_ary_push(a_import, INT2FIX(_T_NUMBER));
|
rb_ary_push(a_import, INT2FIX(_T_NUMBER));
|
||||||
break;
|
break;
|
||||||
|
@ -90,8 +90,8 @@ Win32API_initialize(self, dllname, proc, import, export)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
SafeStringValue(import);
|
SafeStringValue(import);
|
||||||
s = RSTRING(import)->ptr;
|
s = RSTRING_PTR(import);
|
||||||
for (i = 0, len = RSTRING(import)->len; i < len; i++) {
|
for (i = 0, len = RSTRING_LEN(import); i < len; i++) {
|
||||||
switch (*s++) {
|
switch (*s++) {
|
||||||
case 'N': case 'n': case 'L': case 'l':
|
case 'N': case 'n': case 'L': case 'l':
|
||||||
rb_ary_push(a_import, INT2FIX(_T_NUMBER));
|
rb_ary_push(a_import, INT2FIX(_T_NUMBER));
|
||||||
|
@ -117,7 +117,7 @@ Win32API_initialize(self, dllname, proc, import, export)
|
||||||
ex = _T_VOID;
|
ex = _T_VOID;
|
||||||
} else {
|
} else {
|
||||||
SafeStringValue(export);
|
SafeStringValue(export);
|
||||||
switch (*RSTRING(export)->ptr) {
|
switch (*RSTRING_PTR(export)) {
|
||||||
case 'V': case 'v':
|
case 'V': case 'v':
|
||||||
ex = _T_VOID;
|
ex = _T_VOID;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -140,8 +140,8 @@ ruby_open_tk_dll()
|
||||||
char tk_name[20];
|
char tk_name[20];
|
||||||
|
|
||||||
if (!tcl_dll) {
|
if (!tcl_dll) {
|
||||||
/* int ret = ruby_open_tcl_dll(RSTRING(rb_argv0)->ptr); */
|
/* int ret = ruby_open_tcl_dll(RSTRING_PTR(rb_argv0)); */
|
||||||
int ret = ruby_open_tcl_dll(rb_argv0 ? RSTRING(rb_argv0)->ptr : 0);
|
int ret = ruby_open_tcl_dll(rb_argv0 ? RSTRING_PTR(rb_argv0) : 0);
|
||||||
if (ret != TCLTK_STUBS_OK) return ret;
|
if (ret != TCLTK_STUBS_OK) return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,8 +210,8 @@ ruby_tcl_create_ip_and_stubs_init(int *st)
|
||||||
Tcl_Interp *(*p_Tcl_DeleteInterp)();
|
Tcl_Interp *(*p_Tcl_DeleteInterp)();
|
||||||
|
|
||||||
if (!tcl_dll) {
|
if (!tcl_dll) {
|
||||||
/* int ret = ruby_open_tcl_dll(RSTRING(rb_argv0)->ptr); */
|
/* int ret = ruby_open_tcl_dll(RSTRING_PTR(rb_argv0)); */
|
||||||
int ret = ruby_open_tcl_dll(rb_argv0 ? RSTRING(rb_argv0)->ptr : 0);
|
int ret = ruby_open_tcl_dll(rb_argv0 ? RSTRING_PTR(rb_argv0) : 0);
|
||||||
|
|
||||||
if (ret != TCLTK_STUBS_OK) {
|
if (ret != TCLTK_STUBS_OK) {
|
||||||
if (st) *st = ret;
|
if (st) *st = ret;
|
||||||
|
@ -343,8 +343,8 @@ ruby_tcltk_stubs()
|
||||||
int st;
|
int st;
|
||||||
Tcl_Interp *tcl_ip;
|
Tcl_Interp *tcl_ip;
|
||||||
|
|
||||||
/* st = ruby_open_tcltk_dll(RSTRING(rb_argv0)->ptr); */
|
/* st = ruby_open_tcltk_dll(RSTRING_PTR(rb_argv0)); */
|
||||||
st = ruby_open_tcltk_dll(rb_argv0 ? RSTRING(rb_argv0)->ptr : 0);
|
st = ruby_open_tcltk_dll(rb_argv0 ? RSTRING_PTR(rb_argv0) : 0);
|
||||||
switch(st) {
|
switch(st) {
|
||||||
case NO_FindExecutable:
|
case NO_FindExecutable:
|
||||||
return -7;
|
return -7;
|
||||||
|
@ -405,8 +405,8 @@ ruby_open_tcl_dll(char *appname)
|
||||||
int ruby_open_tk_dll()
|
int ruby_open_tk_dll()
|
||||||
{
|
{
|
||||||
if (!open_tcl_dll) {
|
if (!open_tcl_dll) {
|
||||||
/* ruby_open_tcl_dll(RSTRING(rb_argv0)->ptr); */
|
/* ruby_open_tcl_dll(RSTRING_PTR(rb_argv0)); */
|
||||||
ruby_open_tcl_dll(rb_argv0 ? RSTRING(rb_argv0)->ptr : 0);
|
ruby_open_tcl_dll(rb_argv0 ? RSTRING_PTR(rb_argv0) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TCLTK_STUBS_OK;
|
return TCLTK_STUBS_OK;
|
||||||
|
@ -435,8 +435,8 @@ ruby_tcl_create_ip_and_stubs_init(int *st)
|
||||||
Tcl_Interp *tcl_ip;
|
Tcl_Interp *tcl_ip;
|
||||||
|
|
||||||
if (!open_tcl_dll) {
|
if (!open_tcl_dll) {
|
||||||
/* ruby_open_tcl_dll(RSTRING(rb_argv0)->ptr); */
|
/* ruby_open_tcl_dll(RSTRING_PTR(rb_argv0)); */
|
||||||
ruby_open_tcl_dll(rb_argv0 ? RSTRING(rb_argv0)->ptr : 0);
|
ruby_open_tcl_dll(rb_argv0 ? RSTRING_PTR(rb_argv0) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (st) *st = 0;
|
if (st) *st = 0;
|
||||||
|
@ -498,8 +498,8 @@ ruby_tk_stubs_safeinit(Tcl_Interp *tcl_ip)
|
||||||
int
|
int
|
||||||
ruby_tcltk_stubs()
|
ruby_tcltk_stubs()
|
||||||
{
|
{
|
||||||
/* Tcl_FindExecutable(RSTRING(rb_argv0)->ptr); */
|
/* Tcl_FindExecutable(RSTRING_PTR(rb_argv0)); */
|
||||||
Tcl_FindExecutable(rb_argv0 ? RSTRING(rb_argv0)->ptr : 0);
|
Tcl_FindExecutable(rb_argv0 ? RSTRING_PTR(rb_argv0) : 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -896,7 +896,7 @@ call_original_exit(ptr, state)
|
||||||
char **argv;
|
char **argv;
|
||||||
argv = (char **)ALLOC_N(char *, 3);
|
argv = (char **)ALLOC_N(char *, 3);
|
||||||
argv[0] = "exit";
|
argv[0] = "exit";
|
||||||
argv[1] = RSTRING(rb_fix2str(INT2NUM(state), 10))->ptr;
|
argv[1] = RSTRING_PTR(rb_fix2str(INT2NUM(state), 10));
|
||||||
argv[2] = (char *)NULL;
|
argv[2] = (char *)NULL;
|
||||||
|
|
||||||
ptr->return_value = (*(info->proc))(info->clientData, ptr->ip,
|
ptr->return_value = (*(info->proc))(info->clientData, ptr->ip,
|
||||||
|
@ -2151,20 +2151,20 @@ ip_set_exc_message(interp, exc)
|
||||||
if (NIL_P(enc)) {
|
if (NIL_P(enc)) {
|
||||||
encoding = (Tcl_Encoding)NULL;
|
encoding = (Tcl_Encoding)NULL;
|
||||||
} else if (TYPE(enc) == T_STRING) {
|
} else if (TYPE(enc) == T_STRING) {
|
||||||
encoding = Tcl_GetEncoding(interp, RSTRING(enc)->ptr);
|
encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc));
|
||||||
} else {
|
} else {
|
||||||
enc = rb_funcall(enc, ID_to_s, 0, 0);
|
enc = rb_funcall(enc, ID_to_s, 0, 0);
|
||||||
encoding = Tcl_GetEncoding(interp, RSTRING(enc)->ptr);
|
encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* to avoid a garbled error message dialog */
|
/* to avoid a garbled error message dialog */
|
||||||
buf = ALLOC_N(char, (RSTRING(msg)->len)+1);
|
buf = ALLOC_N(char, (RSTRING_LEN(msg))+1);
|
||||||
memcpy(buf, RSTRING(msg)->ptr, RSTRING(msg)->len);
|
memcpy(buf, RSTRING_PTR(msg), RSTRING_LEN(msg));
|
||||||
buf[RSTRING(msg)->len] = 0;
|
buf[RSTRING_LEN(msg)] = 0;
|
||||||
|
|
||||||
Tcl_DStringInit(&dstr);
|
Tcl_DStringInit(&dstr);
|
||||||
Tcl_DStringFree(&dstr);
|
Tcl_DStringFree(&dstr);
|
||||||
Tcl_ExternalToUtfDString(encoding, buf, RSTRING(msg)->len, &dstr);
|
Tcl_ExternalToUtfDString(encoding, buf, RSTRING_LEN(msg), &dstr);
|
||||||
|
|
||||||
Tcl_AppendResult(interp, Tcl_DStringValue(&dstr), (char*)NULL);
|
Tcl_AppendResult(interp, Tcl_DStringValue(&dstr), (char*)NULL);
|
||||||
DUMP2("error message:%s", Tcl_DStringValue(&dstr));
|
DUMP2("error message:%s", Tcl_DStringValue(&dstr));
|
||||||
|
@ -2172,7 +2172,7 @@ ip_set_exc_message(interp, exc)
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
||||||
#else /* TCL_VERSION <= 8.0 */
|
#else /* TCL_VERSION <= 8.0 */
|
||||||
Tcl_AppendResult(interp, RSTRING(msg)->ptr, (char*)NULL);
|
Tcl_AppendResult(interp, RSTRING_PTR(msg), (char*)NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rb_thread_critical = thr_crit_bup;
|
rb_thread_critical = thr_crit_bup;
|
||||||
|
@ -2367,12 +2367,12 @@ tcl_protect_core(interp, proc, data) /* should not raise exception */
|
||||||
|
|
||||||
ret = TkStringValue(ret);
|
ret = TkStringValue(ret);
|
||||||
DUMP1("Tcl_AppendResult");
|
DUMP1("Tcl_AppendResult");
|
||||||
Tcl_AppendResult(interp, RSTRING(ret)->ptr, (char *)NULL);
|
Tcl_AppendResult(interp, RSTRING_PTR(ret), (char *)NULL);
|
||||||
|
|
||||||
rb_thread_critical = thr_crit_bup;
|
rb_thread_critical = thr_crit_bup;
|
||||||
}
|
}
|
||||||
|
|
||||||
DUMP2("(result) %s", NIL_P(ret) ? "nil" : RSTRING(ret)->ptr);
|
DUMP2("(result) %s", NIL_P(ret) ? "nil" : RSTRING_PTR(ret));
|
||||||
|
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
|
@ -5413,25 +5413,25 @@ get_obj_from_str(str)
|
||||||
const char *s = StringValuePtr(str);
|
const char *s = StringValuePtr(str);
|
||||||
|
|
||||||
#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0
|
#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0
|
||||||
return Tcl_NewStringObj((char*)s, RSTRING(str)->len);
|
return Tcl_NewStringObj((char*)s, RSTRING_LEN(str));
|
||||||
#else /* TCL_VERSION >= 8.1 */
|
#else /* TCL_VERSION >= 8.1 */
|
||||||
VALUE enc = rb_attr_get(str, ID_at_enc);
|
VALUE enc = rb_attr_get(str, ID_at_enc);
|
||||||
|
|
||||||
if (!NIL_P(enc)) {
|
if (!NIL_P(enc)) {
|
||||||
StringValue(enc);
|
StringValue(enc);
|
||||||
if (strcmp(RSTRING(enc)->ptr, "binary") == 0) {
|
if (strcmp(RSTRING_PTR(enc), "binary") == 0) {
|
||||||
/* binary string */
|
/* binary string */
|
||||||
return Tcl_NewByteArrayObj(s, RSTRING(str)->len);
|
return Tcl_NewByteArrayObj(s, RSTRING_LEN(str));
|
||||||
} else {
|
} else {
|
||||||
/* text string */
|
/* text string */
|
||||||
return Tcl_NewStringObj(s, RSTRING(str)->len);
|
return Tcl_NewStringObj(s, RSTRING_LEN(str));
|
||||||
}
|
}
|
||||||
} else if (strlen(s) != RSTRING(str)->len) {
|
} else if (strlen(s) != RSTRING_LEN(str)) {
|
||||||
/* probably binary string */
|
/* probably binary string */
|
||||||
return Tcl_NewByteArrayObj(s, RSTRING(str)->len);
|
return Tcl_NewByteArrayObj(s, RSTRING_LEN(str));
|
||||||
} else {
|
} else {
|
||||||
/* probably text string */
|
/* probably text string */
|
||||||
return Tcl_NewStringObj(s, RSTRING(str)->len);
|
return Tcl_NewStringObj(s, RSTRING_LEN(str));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -5875,7 +5875,7 @@ ip_eval(self, str)
|
||||||
} else {
|
} else {
|
||||||
DUMP2("eval from current eventloop %lx", current);
|
DUMP2("eval from current eventloop %lx", current);
|
||||||
}
|
}
|
||||||
result = ip_eval_real(self, RSTRING(str)->ptr, RSTRING(str)->len);
|
result = ip_eval_real(self, RSTRING_PTR(str), RSTRING_LEN(str));
|
||||||
if (rb_obj_is_kind_of(result, rb_eException)) {
|
if (rb_obj_is_kind_of(result, rb_eException)) {
|
||||||
rb_exc_raise(result);
|
rb_exc_raise(result);
|
||||||
}
|
}
|
||||||
|
@ -5891,9 +5891,9 @@ ip_eval(self, str)
|
||||||
alloc_done = (int*)ALLOC(int);
|
alloc_done = (int*)ALLOC(int);
|
||||||
*alloc_done = 0;
|
*alloc_done = 0;
|
||||||
|
|
||||||
eval_str = ALLOC_N(char, RSTRING(str)->len + 1);
|
eval_str = ALLOC_N(char, RSTRING_LEN(str) + 1);
|
||||||
memcpy(eval_str, RSTRING(str)->ptr, RSTRING(str)->len);
|
memcpy(eval_str, RSTRING_PTR(str), RSTRING_LEN(str));
|
||||||
eval_str[RSTRING(str)->len] = 0;
|
eval_str[RSTRING_LEN(str)] = 0;
|
||||||
|
|
||||||
/* allocate memory (freed by Tcl_ServiceEvent) */
|
/* allocate memory (freed by Tcl_ServiceEvent) */
|
||||||
evq = (struct eval_queue *)Tcl_Alloc(sizeof(struct eval_queue));
|
evq = (struct eval_queue *)Tcl_Alloc(sizeof(struct eval_queue));
|
||||||
|
@ -5907,7 +5907,7 @@ ip_eval(self, str)
|
||||||
/* construct event data */
|
/* construct event data */
|
||||||
evq->done = alloc_done;
|
evq->done = alloc_done;
|
||||||
evq->str = eval_str;
|
evq->str = eval_str;
|
||||||
evq->len = RSTRING(str)->len;
|
evq->len = RSTRING_LEN(str);
|
||||||
evq->interp = ip_obj;
|
evq->interp = ip_obj;
|
||||||
evq->result = result;
|
evq->result = result;
|
||||||
evq->thread = current;
|
evq->thread = current;
|
||||||
|
@ -6102,21 +6102,21 @@ lib_toUTF8_core(ip_obj, src, encodename)
|
||||||
encoding = (Tcl_Encoding)NULL;
|
encoding = (Tcl_Encoding)NULL;
|
||||||
} else {
|
} else {
|
||||||
StringValue(enc);
|
StringValue(enc);
|
||||||
encoding = Tcl_GetEncoding(interp, RSTRING(enc)->ptr);
|
encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc));
|
||||||
if (encoding == (Tcl_Encoding)NULL) {
|
if (encoding == (Tcl_Encoding)NULL) {
|
||||||
rb_warning("Tk-interp has unknown encoding information (@encoding:'%s')", RSTRING(enc)->ptr);
|
rb_warning("Tk-interp has unknown encoding information (@encoding:'%s')", RSTRING_PTR(enc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
StringValue(enc);
|
StringValue(enc);
|
||||||
if (strcmp(RSTRING(enc)->ptr, "binary") == 0) {
|
if (strcmp(RSTRING_PTR(enc), "binary") == 0) {
|
||||||
rb_thread_critical = thr_crit_bup;
|
rb_thread_critical = thr_crit_bup;
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
encoding = Tcl_GetEncoding(interp, RSTRING(enc)->ptr);
|
encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc));
|
||||||
if (encoding == (Tcl_Encoding)NULL) {
|
if (encoding == (Tcl_Encoding)NULL) {
|
||||||
rb_warning("string has unknown encoding information (@encoding:'%s')", RSTRING(enc)->ptr);
|
rb_warning("string has unknown encoding information (@encoding:'%s')", RSTRING_PTR(enc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -6124,30 +6124,30 @@ lib_toUTF8_core(ip_obj, src, encodename)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
StringValue(encodename);
|
StringValue(encodename);
|
||||||
encoding = Tcl_GetEncoding(interp, RSTRING(encodename)->ptr);
|
encoding = Tcl_GetEncoding(interp, RSTRING_PTR(encodename));
|
||||||
if (encoding == (Tcl_Encoding)NULL) {
|
if (encoding == (Tcl_Encoding)NULL) {
|
||||||
/*
|
/*
|
||||||
rb_warning("unknown encoding name '%s'",
|
rb_warning("unknown encoding name '%s'",
|
||||||
RSTRING(encodename)->ptr);
|
RSTRING_PTR(encodename));
|
||||||
*/
|
*/
|
||||||
rb_raise(rb_eArgError, "unknown encoding name '%s'",
|
rb_raise(rb_eArgError, "unknown encoding name '%s'",
|
||||||
RSTRING(encodename)->ptr);
|
RSTRING_PTR(encodename));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StringValue(str);
|
StringValue(str);
|
||||||
if (!RSTRING(str)->len) {
|
if (!RSTRING_LEN(str)) {
|
||||||
rb_thread_critical = thr_crit_bup;
|
rb_thread_critical = thr_crit_bup;
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
buf = ALLOC_N(char,(RSTRING(str)->len)+1);
|
buf = ALLOC_N(char,RSTRING_LEN(str)+1);
|
||||||
memcpy(buf, RSTRING(str)->ptr, RSTRING(str)->len);
|
memcpy(buf, RSTRING_PTR(str), RSTRING_LEN(str));
|
||||||
buf[RSTRING(str)->len] = 0;
|
buf[RSTRING_LEN(str)] = 0;
|
||||||
|
|
||||||
Tcl_DStringInit(&dstr);
|
Tcl_DStringInit(&dstr);
|
||||||
Tcl_DStringFree(&dstr);
|
Tcl_DStringFree(&dstr);
|
||||||
/* Tcl_ExternalToUtfDString(encoding,buf,strlen(buf),&dstr); */
|
/* Tcl_ExternalToUtfDString(encoding,buf,strlen(buf),&dstr); */
|
||||||
Tcl_ExternalToUtfDString(encoding, buf, RSTRING(str)->len, &dstr);
|
Tcl_ExternalToUtfDString(encoding, buf, RSTRING_LEN(str), &dstr);
|
||||||
|
|
||||||
/* str = rb_tainted_str_new2(Tcl_DStringValue(&dstr)); */
|
/* str = rb_tainted_str_new2(Tcl_DStringValue(&dstr)); */
|
||||||
/* str = rb_str_new2(Tcl_DStringValue(&dstr)); */
|
/* str = rb_str_new2(Tcl_DStringValue(&dstr)); */
|
||||||
|
@ -6238,7 +6238,7 @@ lib_fromUTF8_core(ip_obj, src, encodename)
|
||||||
enc = rb_attr_get(str, ID_at_enc);
|
enc = rb_attr_get(str, ID_at_enc);
|
||||||
if (!NIL_P(enc)) {
|
if (!NIL_P(enc)) {
|
||||||
StringValue(enc);
|
StringValue(enc);
|
||||||
if (strcmp(RSTRING(enc)->ptr, "binary") == 0) {
|
if (strcmp(RSTRING_PTR(enc), "binary") == 0) {
|
||||||
rb_thread_critical = thr_crit_bup;
|
rb_thread_critical = thr_crit_bup;
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -6253,9 +6253,9 @@ lib_fromUTF8_core(ip_obj, src, encodename)
|
||||||
encoding = (Tcl_Encoding)NULL;
|
encoding = (Tcl_Encoding)NULL;
|
||||||
} else {
|
} else {
|
||||||
StringValue(enc);
|
StringValue(enc);
|
||||||
encoding = Tcl_GetEncoding(interp, RSTRING(enc)->ptr);
|
encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc));
|
||||||
if (encoding == (Tcl_Encoding)NULL) {
|
if (encoding == (Tcl_Encoding)NULL) {
|
||||||
rb_warning("Tk-interp has unknown encoding information (@encoding:'%s')", RSTRING(enc)->ptr);
|
rb_warning("Tk-interp has unknown encoding information (@encoding:'%s')", RSTRING_PTR(enc));
|
||||||
} else {
|
} else {
|
||||||
encodename = rb_obj_dup(enc);
|
encodename = rb_obj_dup(enc);
|
||||||
}
|
}
|
||||||
|
@ -6265,13 +6265,13 @@ lib_fromUTF8_core(ip_obj, src, encodename)
|
||||||
} else {
|
} else {
|
||||||
StringValue(encodename);
|
StringValue(encodename);
|
||||||
|
|
||||||
if (strcmp(RSTRING(encodename)->ptr, "binary") == 0) {
|
if (strcmp(RSTRING_PTR(encodename), "binary") == 0) {
|
||||||
char *s;
|
char *s;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
StringValue(str);
|
StringValue(str);
|
||||||
s = Tcl_GetByteArrayFromObj(Tcl_NewStringObj(RSTRING(str)->ptr,
|
s = Tcl_GetByteArrayFromObj(Tcl_NewStringObj(RSTRING_PTR(str),
|
||||||
RSTRING(str)->len),
|
RSTRING_LEN(str)),
|
||||||
&len);
|
&len);
|
||||||
str = rb_tainted_str_new(s, len);
|
str = rb_tainted_str_new(s, len);
|
||||||
rb_ivar_set(str, ID_at_enc, rb_tainted_str_new2("binary"));
|
rb_ivar_set(str, ID_at_enc, rb_tainted_str_new2("binary"));
|
||||||
|
@ -6280,33 +6280,33 @@ lib_fromUTF8_core(ip_obj, src, encodename)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
encoding = Tcl_GetEncoding(interp, RSTRING(encodename)->ptr);
|
encoding = Tcl_GetEncoding(interp, RSTRING_PTR(encodename));
|
||||||
if (encoding == (Tcl_Encoding)NULL) {
|
if (encoding == (Tcl_Encoding)NULL) {
|
||||||
/*
|
/*
|
||||||
rb_warning("unknown encoding name '%s'",
|
rb_warning("unknown encoding name '%s'",
|
||||||
RSTRING(encodename)->ptr);
|
RSTRING_PTR(encodename));
|
||||||
encodename = Qnil;
|
encodename = Qnil;
|
||||||
*/
|
*/
|
||||||
rb_raise(rb_eArgError, "unknown encoding name '%s'",
|
rb_raise(rb_eArgError, "unknown encoding name '%s'",
|
||||||
RSTRING(encodename)->ptr);
|
RSTRING_PTR(encodename));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StringValue(str);
|
StringValue(str);
|
||||||
|
|
||||||
if (RSTRING(str)->len == 0) {
|
if (RSTRING_LEN(str) == 0) {
|
||||||
rb_thread_critical = thr_crit_bup;
|
rb_thread_critical = thr_crit_bup;
|
||||||
return rb_tainted_str_new2("");
|
return rb_tainted_str_new2("");
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = ALLOC_N(char,strlen(RSTRING(str)->ptr)+1);
|
buf = ALLOC_N(char,strlen(RSTRING_PTR(str))+1);
|
||||||
memcpy(buf, RSTRING(str)->ptr, RSTRING(str)->len);
|
memcpy(buf, RSTRING_PTR(str), RSTRING_LEN(str));
|
||||||
buf[RSTRING(str)->len] = 0;
|
buf[RSTRING_LEN(str)] = 0;
|
||||||
|
|
||||||
Tcl_DStringInit(&dstr);
|
Tcl_DStringInit(&dstr);
|
||||||
Tcl_DStringFree(&dstr);
|
Tcl_DStringFree(&dstr);
|
||||||
/* Tcl_UtfToExternalDString(encoding,buf,strlen(buf),&dstr); */
|
/* Tcl_UtfToExternalDString(encoding,buf,strlen(buf),&dstr); */
|
||||||
Tcl_UtfToExternalDString(encoding,buf,RSTRING(str)->len,&dstr);
|
Tcl_UtfToExternalDString(encoding,buf,RSTRING_LEN(str),&dstr);
|
||||||
|
|
||||||
/* str = rb_tainted_str_new2(Tcl_DStringValue(&dstr)); */
|
/* str = rb_tainted_str_new2(Tcl_DStringValue(&dstr)); */
|
||||||
/* str = rb_str_new2(Tcl_DStringValue(&dstr)); */
|
/* str = rb_str_new2(Tcl_DStringValue(&dstr)); */
|
||||||
|
@ -6371,21 +6371,21 @@ lib_UTF_backslash_core(self, str, all_bs)
|
||||||
tcl_stubs_check();
|
tcl_stubs_check();
|
||||||
|
|
||||||
StringValue(str);
|
StringValue(str);
|
||||||
if (!RSTRING(str)->len) {
|
if (!RSTRING_LEN(str)) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
thr_crit_bup = rb_thread_critical;
|
thr_crit_bup = rb_thread_critical;
|
||||||
rb_thread_critical = Qtrue;
|
rb_thread_critical = Qtrue;
|
||||||
|
|
||||||
src_buf = ALLOC_N(char,(RSTRING(str)->len)+1);
|
src_buf = ALLOC_N(char,RSTRING_LEN(str)+1);
|
||||||
memcpy(src_buf, RSTRING(str)->ptr, RSTRING(str)->len);
|
memcpy(src_buf, RSTRING_PTR(str), RSTRING_LEN(str));
|
||||||
src_buf[RSTRING(str)->len] = 0;
|
src_buf[RSTRING_LEN(str)] = 0;
|
||||||
|
|
||||||
dst_buf = ALLOC_N(char,(RSTRING(str)->len)+1);
|
dst_buf = ALLOC_N(char,RSTRING_LEN(str)+1);
|
||||||
|
|
||||||
ptr = src_buf;
|
ptr = src_buf;
|
||||||
while(RSTRING(str)->len > ptr - src_buf) {
|
while(RSTRING_LEN(str) > ptr - src_buf) {
|
||||||
if (*ptr == '\\' && (all_bs || *(ptr + 1) == 'u')) {
|
if (*ptr == '\\' && (all_bs || *(ptr + 1) == 'u')) {
|
||||||
dst_len += Tcl_UtfBackslash(ptr, &read_len, (dst_buf + dst_len));
|
dst_len += Tcl_UtfBackslash(ptr, &read_len, (dst_buf + dst_len));
|
||||||
ptr += read_len;
|
ptr += read_len;
|
||||||
|
@ -6451,7 +6451,7 @@ lib_set_system_encoding(self, enc_name)
|
||||||
if (Tcl_SetSystemEncoding((Tcl_Interp *)NULL,
|
if (Tcl_SetSystemEncoding((Tcl_Interp *)NULL,
|
||||||
StringValuePtr(enc_name)) != TCL_OK) {
|
StringValuePtr(enc_name)) != TCL_OK) {
|
||||||
rb_raise(rb_eArgError, "unknown encoding name '%s'",
|
rb_raise(rb_eArgError, "unknown encoding name '%s'",
|
||||||
RSTRING(enc_name)->ptr);
|
RSTRING_PTR(enc_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return enc_name;
|
return enc_name;
|
||||||
|
@ -7101,8 +7101,8 @@ ip_get_variable2_core(interp, argc, argv)
|
||||||
} else {
|
} else {
|
||||||
/* Tcl_Preserve(ptr->ip); */
|
/* Tcl_Preserve(ptr->ip); */
|
||||||
rbtk_preserve_ip(ptr);
|
rbtk_preserve_ip(ptr);
|
||||||
ret = Tcl_GetVar2Ex(ptr->ip, RSTRING(varname)->ptr,
|
ret = Tcl_GetVar2Ex(ptr->ip, RSTRING_PTR(varname),
|
||||||
NIL_P(index) ? NULL : RSTRING(index)->ptr,
|
NIL_P(index) ? NULL : RSTRING_PTR(index),
|
||||||
FIX2INT(flag));
|
FIX2INT(flag));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7139,8 +7139,8 @@ ip_get_variable2_core(interp, argc, argv)
|
||||||
} else {
|
} else {
|
||||||
/* Tcl_Preserve(ptr->ip); */
|
/* Tcl_Preserve(ptr->ip); */
|
||||||
rbtk_preserve_ip(ptr);
|
rbtk_preserve_ip(ptr);
|
||||||
ret = Tcl_GetVar2(ptr->ip, RSTRING(varname)->ptr,
|
ret = Tcl_GetVar2(ptr->ip, RSTRING_PTR(varname),
|
||||||
NIL_P(index) ? NULL : RSTRING(index)->ptr,
|
NIL_P(index) ? NULL : RSTRING_PTR(index),
|
||||||
FIX2INT(flag));
|
FIX2INT(flag));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7238,8 +7238,8 @@ ip_set_variable2_core(interp, argc, argv)
|
||||||
} else {
|
} else {
|
||||||
/* Tcl_Preserve(ptr->ip); */
|
/* Tcl_Preserve(ptr->ip); */
|
||||||
rbtk_preserve_ip(ptr);
|
rbtk_preserve_ip(ptr);
|
||||||
ret = Tcl_SetVar2Ex(ptr->ip, RSTRING(varname)->ptr,
|
ret = Tcl_SetVar2Ex(ptr->ip, RSTRING_PTR(varname),
|
||||||
NIL_P(index) ? NULL : RSTRING(index)->ptr,
|
NIL_P(index) ? NULL : RSTRING_PTR(index),
|
||||||
valobj, FIX2INT(flag));
|
valobj, FIX2INT(flag));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7279,9 +7279,9 @@ ip_set_variable2_core(interp, argc, argv)
|
||||||
} else {
|
} else {
|
||||||
/* Tcl_Preserve(ptr->ip); */
|
/* Tcl_Preserve(ptr->ip); */
|
||||||
rbtk_preserve_ip(ptr);
|
rbtk_preserve_ip(ptr);
|
||||||
ret = Tcl_SetVar2(ptr->ip, RSTRING(varname)->ptr,
|
ret = Tcl_SetVar2(ptr->ip, RSTRING_PTR(varname),
|
||||||
NIL_P(index) ? NULL : RSTRING(index)->ptr,
|
NIL_P(index) ? NULL : RSTRING_PTR(index),
|
||||||
RSTRING(value)->ptr, FIX2INT(flag));
|
RSTRING_PTR(value), FIX2INT(flag));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == (char*)NULL) {
|
if (ret == (char*)NULL) {
|
||||||
|
@ -7361,8 +7361,8 @@ ip_unset_variable2_core(interp, argc, argv)
|
||||||
return Qtrue;
|
return Qtrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr->return_value = Tcl_UnsetVar2(ptr->ip, RSTRING(varname)->ptr,
|
ptr->return_value = Tcl_UnsetVar2(ptr->ip, RSTRING_PTR(varname),
|
||||||
NIL_P(index) ? NULL : RSTRING(index)->ptr,
|
NIL_P(index) ? NULL : RSTRING_PTR(index),
|
||||||
FIX2INT(flag));
|
FIX2INT(flag));
|
||||||
|
|
||||||
if (ptr->return_value == TCL_ERROR) {
|
if (ptr->return_value == TCL_ERROR) {
|
||||||
|
@ -7555,7 +7555,7 @@ lib_split_tklist_core(ip_obj, list_str)
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
|
|
||||||
if (Tcl_SplitList(interp, RSTRING(list_str)->ptr,
|
if (Tcl_SplitList(interp, RSTRING_PTR(list_str),
|
||||||
&argc, &argv) == TCL_ERROR) {
|
&argc, &argv) == TCL_ERROR) {
|
||||||
if (interp == (Tcl_Interp*)NULL) {
|
if (interp == (Tcl_Interp*)NULL) {
|
||||||
rb_raise(rb_eRuntimeError, "can't get elements from list");
|
rb_raise(rb_eRuntimeError, "can't get elements from list");
|
||||||
|
@ -7635,7 +7635,7 @@ lib_merge_tklist(argc, argv, obj)
|
||||||
if (OBJ_TAINTED(argv[num])) taint_flag = 1;
|
if (OBJ_TAINTED(argv[num])) taint_flag = 1;
|
||||||
dst = StringValuePtr(argv[num]);
|
dst = StringValuePtr(argv[num]);
|
||||||
#if TCL_MAJOR_VERSION >= 8
|
#if TCL_MAJOR_VERSION >= 8
|
||||||
len += Tcl_ScanCountedElement(dst, RSTRING(argv[num])->len,
|
len += Tcl_ScanCountedElement(dst, RSTRING_LEN(argv[num]),
|
||||||
&flagPtr[num]) + 1;
|
&flagPtr[num]) + 1;
|
||||||
#else /* TCL_MAJOR_VERSION < 8 */
|
#else /* TCL_MAJOR_VERSION < 8 */
|
||||||
len += Tcl_ScanElement(dst, &flagPtr[num]) + 1;
|
len += Tcl_ScanElement(dst, &flagPtr[num]) + 1;
|
||||||
|
@ -7647,11 +7647,11 @@ lib_merge_tklist(argc, argv, obj)
|
||||||
dst = result;
|
dst = result;
|
||||||
for(num = 0; num < argc; num++) {
|
for(num = 0; num < argc; num++) {
|
||||||
#if TCL_MAJOR_VERSION >= 8
|
#if TCL_MAJOR_VERSION >= 8
|
||||||
len = Tcl_ConvertCountedElement(RSTRING(argv[num])->ptr,
|
len = Tcl_ConvertCountedElement(RSTRING_PTR(argv[num]),
|
||||||
RSTRING(argv[num])->len,
|
RSTRING_LEN(argv[num]),
|
||||||
dst, flagPtr[num]);
|
dst, flagPtr[num]);
|
||||||
#else /* TCL_MAJOR_VERSION < 8 */
|
#else /* TCL_MAJOR_VERSION < 8 */
|
||||||
len = Tcl_ConvertElement(RSTRING(argv[num])->ptr, dst, flagPtr[num]);
|
len = Tcl_ConvertElement(RSTRING_PTR(argv[num]), dst, flagPtr[num]);
|
||||||
#endif
|
#endif
|
||||||
dst += len;
|
dst += len;
|
||||||
*dst = ' ';
|
*dst = ' ';
|
||||||
|
@ -7694,19 +7694,18 @@ lib_conv_listelement(self, src)
|
||||||
StringValue(src);
|
StringValue(src);
|
||||||
|
|
||||||
#if TCL_MAJOR_VERSION >= 8
|
#if TCL_MAJOR_VERSION >= 8
|
||||||
len = Tcl_ScanCountedElement(RSTRING(src)->ptr, RSTRING(src)->len,
|
len = Tcl_ScanCountedElement(RSTRING_PTR(src), RSTRING_LEN(src),
|
||||||
&scan_flag);
|
&scan_flag);
|
||||||
dst = rb_str_new(0, len + 1);
|
dst = rb_str_new(0, len + 1);
|
||||||
len = Tcl_ConvertCountedElement(RSTRING(src)->ptr, RSTRING(src)->len,
|
len = Tcl_ConvertCountedElement(RSTRING_PTR(src), RSTRING_LEN(src),
|
||||||
RSTRING(dst)->ptr, scan_flag);
|
RSTRING_PTR(dst), scan_flag);
|
||||||
#else /* TCL_MAJOR_VERSION < 8 */
|
#else /* TCL_MAJOR_VERSION < 8 */
|
||||||
len = Tcl_ScanElement(RSTRING(src)->ptr, &scan_flag);
|
len = Tcl_ScanElement(RSTRING_PTR(src), &scan_flag);
|
||||||
dst = rb_str_new(0, len + 1);
|
dst = rb_str_new(0, len + 1);
|
||||||
len = Tcl_ConvertElement(RSTRING(src)->ptr, RSTRING(dst)->ptr, scan_flag);
|
len = Tcl_ConvertElement(RSTRING_PTR(src), RSTRING_PTR(dst), scan_flag);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RSTRING(dst)->len = len;
|
rb_str_resize(dst, len);
|
||||||
RSTRING(dst)->ptr[len] = '\0';
|
|
||||||
if (taint_flag) OBJ_TAINT(dst);
|
if (taint_flag) OBJ_TAINT(dst);
|
||||||
|
|
||||||
rb_thread_critical = thr_crit_bup;
|
rb_thread_critical = thr_crit_bup;
|
||||||
|
@ -7828,7 +7827,7 @@ ip_make_menu_embeddable(interp, menu_path)
|
||||||
|
|
||||||
StringValue(menu_path);
|
StringValue(menu_path);
|
||||||
|
|
||||||
menuRefPtr = TkFindMenuReferences(ptr->ip, RSTRING(menu_path)->ptr);
|
menuRefPtr = TkFindMenuReferences(ptr->ip, RSTRING_PTR(menu_path));
|
||||||
if (menuRefPtr == (struct dummy_TkMenuRef *) NULL) {
|
if (menuRefPtr == (struct dummy_TkMenuRef *) NULL) {
|
||||||
rb_raise(rb_eArgError, "not a menu widget, or invalid widget path");
|
rb_raise(rb_eArgError, "not a menu widget, or invalid widget path");
|
||||||
}
|
}
|
||||||
|
@ -8118,7 +8117,7 @@ Init_tcltklib()
|
||||||
|
|
||||||
/* --------------------------------------------------------------- */
|
/* --------------------------------------------------------------- */
|
||||||
|
|
||||||
ret = ruby_open_tcl_dll(rb_argv0 ? RSTRING(rb_argv0)->ptr : 0);
|
ret = ruby_open_tcl_dll(rb_argv0 ? RSTRING_PTR(rb_argv0) : 0);
|
||||||
switch(ret) {
|
switch(ret) {
|
||||||
case TCLTK_STUBS_OK:
|
case TCLTK_STUBS_OK:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -155,16 +155,16 @@ tk_uninstall_cmd(self, cmd_id)
|
||||||
int prefix_len = strlen(cmd_id_prefix);
|
int prefix_len = strlen(cmd_id_prefix);
|
||||||
|
|
||||||
StringValue(cmd_id);
|
StringValue(cmd_id);
|
||||||
if (strncmp(cmd_id_head, RSTRING(cmd_id)->ptr, head_len) != 0) {
|
if (strncmp(cmd_id_head, RSTRING_PTR(cmd_id), head_len) != 0) {
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
if (strncmp(cmd_id_prefix,
|
if (strncmp(cmd_id_prefix,
|
||||||
RSTRING(cmd_id)->ptr + head_len, prefix_len) != 0) {
|
RSTRING_PTR(cmd_id) + head_len, prefix_len) != 0) {
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rb_hash_delete(CALLBACK_TABLE,
|
return rb_hash_delete(CALLBACK_TABLE,
|
||||||
rb_str_new2(RSTRING(cmd_id)->ptr + head_len));
|
rb_str_new2(RSTRING_PTR(cmd_id) + head_len));
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -862,7 +862,7 @@ get_eval_string_core(obj, enc_flag, self)
|
||||||
}
|
}
|
||||||
|
|
||||||
rb_warning("fail to convert '%s' to string for Tk",
|
rb_warning("fail to convert '%s' to string for Tk",
|
||||||
RSTRING(rb_funcall(obj, rb_intern("inspect"), 0, 0))->ptr);
|
RSTRING_PTR(rb_funcall(obj, rb_intern("inspect"), 0, 0)));
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
@ -966,13 +966,13 @@ tcl2rb_bool(self, value)
|
||||||
|
|
||||||
value = rb_funcall(value, ID_downcase, 0);
|
value = rb_funcall(value, ID_downcase, 0);
|
||||||
|
|
||||||
if (RSTRING(value)->ptr == (char*)NULL) return Qnil;
|
if (RSTRING_PTR(value) == (char*)NULL) return Qnil;
|
||||||
|
|
||||||
if (RSTRING(value)->ptr[0] == '\0'
|
if (RSTRING_PTR(value)[0] == '\0'
|
||||||
|| strcmp(RSTRING(value)->ptr, "0") == 0
|
|| strcmp(RSTRING_PTR(value), "0") == 0
|
||||||
|| strcmp(RSTRING(value)->ptr, "no") == 0
|
|| strcmp(RSTRING_PTR(value), "no") == 0
|
||||||
|| strcmp(RSTRING(value)->ptr, "off") == 0
|
|| strcmp(RSTRING_PTR(value), "off") == 0
|
||||||
|| strcmp(RSTRING(value)->ptr, "false") == 0) {
|
|| strcmp(RSTRING_PTR(value), "false") == 0) {
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
} else {
|
} else {
|
||||||
return Qtrue;
|
return Qtrue;
|
||||||
|
@ -983,21 +983,21 @@ static VALUE
|
||||||
tkstr_to_dec(value)
|
tkstr_to_dec(value)
|
||||||
VALUE value;
|
VALUE value;
|
||||||
{
|
{
|
||||||
return rb_cstr_to_inum(RSTRING(value)->ptr, 10, 1);
|
return rb_cstr_to_inum(RSTRING_PTR(value), 10, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
tkstr_to_int(value)
|
tkstr_to_int(value)
|
||||||
VALUE value;
|
VALUE value;
|
||||||
{
|
{
|
||||||
return rb_cstr_to_inum(RSTRING(value)->ptr, 0, 1);
|
return rb_cstr_to_inum(RSTRING_PTR(value), 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
tkstr_to_float(value)
|
tkstr_to_float(value)
|
||||||
VALUE value;
|
VALUE value;
|
||||||
{
|
{
|
||||||
return rb_float_new(rb_cstr_to_dbl(RSTRING(value)->ptr, 1));
|
return rb_float_new(rb_cstr_to_dbl(RSTRING_PTR(value), 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -1005,7 +1005,7 @@ tkstr_invalid_numstr(value)
|
||||||
VALUE value;
|
VALUE value;
|
||||||
{
|
{
|
||||||
rb_raise(rb_eArgError,
|
rb_raise(rb_eArgError,
|
||||||
"invalid value for Number: '%s'", RSTRING(value)->ptr);
|
"invalid value for Number: '%s'", RSTRING_PTR(value));
|
||||||
return Qnil; /*dummy*/
|
return Qnil; /*dummy*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1024,7 +1024,7 @@ tkstr_to_number(value)
|
||||||
{
|
{
|
||||||
rb_check_type(value, T_STRING);
|
rb_check_type(value, T_STRING);
|
||||||
|
|
||||||
if (RSTRING(value)->ptr == (char*)NULL) return INT2FIX(0);
|
if (RSTRING_PTR(value) == (char*)NULL) return INT2FIX(0);
|
||||||
|
|
||||||
return rb_rescue2(tkstr_to_int, value,
|
return rb_rescue2(tkstr_to_int, value,
|
||||||
tkstr_rescue_float, value,
|
tkstr_rescue_float, value,
|
||||||
|
@ -1046,8 +1046,8 @@ tkstr_to_str(value)
|
||||||
char * ptr;
|
char * ptr;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
ptr = RSTRING(value)->ptr;
|
ptr = RSTRING_PTR(value);
|
||||||
len = RSTRING(value)->len;
|
len = RSTRING_LEN(value);
|
||||||
|
|
||||||
if (len > 1 && *ptr == '{' && *(ptr + len - 1) == '}') {
|
if (len > 1 && *ptr == '{' && *(ptr + len - 1) == '}') {
|
||||||
return rb_str_new(ptr + 1, len - 2);
|
return rb_str_new(ptr + 1, len - 2);
|
||||||
|
@ -1062,7 +1062,7 @@ tcl2rb_string(self, value)
|
||||||
{
|
{
|
||||||
rb_check_type(value, T_STRING);
|
rb_check_type(value, T_STRING);
|
||||||
|
|
||||||
if (RSTRING(value)->ptr == (char*)NULL) return rb_tainted_str_new2("");
|
if (RSTRING_PTR(value) == (char*)NULL) return rb_tainted_str_new2("");
|
||||||
|
|
||||||
return tkstr_to_str(value);
|
return tkstr_to_str(value);
|
||||||
}
|
}
|
||||||
|
@ -1074,7 +1074,7 @@ tcl2rb_num_or_str(self, value)
|
||||||
{
|
{
|
||||||
rb_check_type(value, T_STRING);
|
rb_check_type(value, T_STRING);
|
||||||
|
|
||||||
if (RSTRING(value)->ptr == (char*)NULL) return rb_tainted_str_new2("");
|
if (RSTRING_PTR(value) == (char*)NULL) return rb_tainted_str_new2("");
|
||||||
|
|
||||||
return rb_rescue2(tkstr_to_number, value,
|
return rb_rescue2(tkstr_to_number, value,
|
||||||
tkstr_to_str, value,
|
tkstr_to_str, value,
|
||||||
|
@ -1181,7 +1181,7 @@ each_attr_def(key, value, klass)
|
||||||
|
|
||||||
switch(TYPE(key)) {
|
switch(TYPE(key)) {
|
||||||
case T_STRING:
|
case T_STRING:
|
||||||
key_id = rb_intern(RSTRING(key)->ptr);
|
key_id = rb_intern(RSTRING_PTR(key));
|
||||||
break;
|
break;
|
||||||
case T_SYMBOL:
|
case T_SYMBOL:
|
||||||
key_id = SYM2ID(key);
|
key_id = SYM2ID(key);
|
||||||
|
@ -1193,7 +1193,7 @@ each_attr_def(key, value, klass)
|
||||||
|
|
||||||
switch(TYPE(value)) {
|
switch(TYPE(value)) {
|
||||||
case T_STRING:
|
case T_STRING:
|
||||||
value_id = rb_intern(RSTRING(value)->ptr);
|
value_id = rb_intern(RSTRING_PTR(value));
|
||||||
break;
|
break;
|
||||||
case T_SYMBOL:
|
case T_SYMBOL:
|
||||||
value_id = SYM2ID(value);
|
value_id = SYM2ID(value);
|
||||||
|
@ -1250,7 +1250,7 @@ cbsubst_get_subst_arg(argc, argv, self)
|
||||||
for(i = 0; i < argc; i++) {
|
for(i = 0; i < argc; i++) {
|
||||||
switch(TYPE(argv[i])) {
|
switch(TYPE(argv[i])) {
|
||||||
case T_STRING:
|
case T_STRING:
|
||||||
str = RSTRING(argv[i])->ptr;
|
str = RSTRING_PTR(argv[i]);
|
||||||
arg_sym = ID2SYM(rb_intern(str));
|
arg_sym = ID2SYM(rb_intern(str));
|
||||||
break;
|
break;
|
||||||
case T_SYMBOL:
|
case T_SYMBOL:
|
||||||
|
@ -1265,7 +1265,7 @@ cbsubst_get_subst_arg(argc, argv, self)
|
||||||
str = rb_id2name(SYM2ID(ret));
|
str = rb_id2name(SYM2ID(ret));
|
||||||
}
|
}
|
||||||
|
|
||||||
id = rb_intern(RSTRING(rb_str_cat2(rb_str_new2("@"), str))->ptr);
|
id = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), str)));
|
||||||
|
|
||||||
for(j = 0; j < len; j++) {
|
for(j = 0; j < len; j++) {
|
||||||
if (inf->ivar[j] == id) break;
|
if (inf->ivar[j] == id) break;
|
||||||
|
@ -1305,7 +1305,7 @@ cbsubst_get_subst_key(self, str)
|
||||||
buf = ALLOC_N(char, len + 1);
|
buf = ALLOC_N(char, len + 1);
|
||||||
|
|
||||||
for(i = 0; i < len; i++) {
|
for(i = 0; i < len; i++) {
|
||||||
ptr = RSTRING(RARRAY(list)->ptr[i])->ptr;
|
ptr = RSTRING_PTR(RARRAY(list)->ptr[i]);
|
||||||
if (*ptr == '%' && *(ptr + 2) == '\0') {
|
if (*ptr == '%' && *(ptr + 2) == '\0') {
|
||||||
*(buf + i) = *(ptr + 1);
|
*(buf + i) = *(ptr + 1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1388,10 +1388,10 @@ cbsubst_table_setup(self, key_inf, proc_inf)
|
||||||
|
|
||||||
*(ivar + real_len)
|
*(ivar + real_len)
|
||||||
= rb_intern(
|
= rb_intern(
|
||||||
RSTRING(
|
RSTRING_PTR(
|
||||||
rb_str_cat2(rb_str_new2("@"),
|
rb_str_cat2(rb_str_new2("@"),
|
||||||
rb_id2name(SYM2ID(RARRAY(inf)->ptr[2])))
|
rb_id2name(SYM2ID(RARRAY(inf)->ptr[2])))
|
||||||
)->ptr
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
rb_attr(self, SYM2ID(RARRAY(inf)->ptr[2]), 1, 0, Qtrue);
|
rb_attr(self, SYM2ID(RARRAY(inf)->ptr[2]), 1, 0, Qtrue);
|
||||||
|
@ -1453,12 +1453,12 @@ cbsubst_scan_args(self, arg_key, val_ary)
|
||||||
|
|
||||||
RARRAY(dst)->len = 0;
|
RARRAY(dst)->len = 0;
|
||||||
for(idx = 0; idx < len; idx++) {
|
for(idx = 0; idx < len; idx++) {
|
||||||
if (idx >= RSTRING(arg_key)->len) {
|
if (idx >= RSTRING_LEN(arg_key)) {
|
||||||
proc = Qnil;
|
proc = Qnil;
|
||||||
} else if (*(RSTRING(arg_key)->ptr + idx) == ' ') {
|
} else if (*(RSTRING_PTR(arg_key) + idx) == ' ') {
|
||||||
proc = Qnil;
|
proc = Qnil;
|
||||||
} else {
|
} else {
|
||||||
ptr = strchr(inf->key, *(RSTRING(arg_key)->ptr + idx));
|
ptr = strchr(inf->key, *(RSTRING_PTR(arg_key) + idx));
|
||||||
if (ptr == (char*)NULL) {
|
if (ptr == (char*)NULL) {
|
||||||
proc = Qnil;
|
proc = Qnil;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1069,7 +1069,7 @@ ole_val2olevariantdata(VALUE val, VARTYPE vtype, struct olevariantdata *pvar)
|
||||||
VARIANT var;
|
VARIANT var;
|
||||||
|
|
||||||
if (((vtype & ~VT_BYREF) == (VT_ARRAY | VT_UI1)) && TYPE(val) == T_STRING) {
|
if (((vtype & ~VT_BYREF) == (VT_ARRAY | VT_UI1)) && TYPE(val) == T_STRING) {
|
||||||
long len = RSTRING(val)->len;
|
long len = RSTRING_LEN(val);
|
||||||
char *pdest = NULL;
|
char *pdest = NULL;
|
||||||
SAFEARRAY *psa = SafeArrayCreateVector(VT_UI1, 0, len);
|
SAFEARRAY *psa = SafeArrayCreateVector(VT_UI1, 0, len);
|
||||||
if (!psa) {
|
if (!psa) {
|
||||||
|
@ -1077,7 +1077,7 @@ ole_val2olevariantdata(VALUE val, VARTYPE vtype, struct olevariantdata *pvar)
|
||||||
}
|
}
|
||||||
hr = SafeArrayAccessData(psa, (void **)&pdest);
|
hr = SafeArrayAccessData(psa, (void **)&pdest);
|
||||||
if (SUCCEEDED(hr)) {
|
if (SUCCEEDED(hr)) {
|
||||||
memcpy(pdest, RSTRING(val)->ptr, len);
|
memcpy(pdest, RSTRING_PTR(val), len);
|
||||||
SafeArrayUnaccessData(psa);
|
SafeArrayUnaccessData(psa);
|
||||||
V_VT(&(pvar->realvar)) = vtype;
|
V_VT(&(pvar->realvar)) = vtype;
|
||||||
V_ARRAY(&(pvar->realvar)) = psa;
|
V_ARRAY(&(pvar->realvar)) = psa;
|
||||||
|
|
|
@ -1335,7 +1335,7 @@ site-install-rb: install-rb
|
||||||
end
|
end
|
||||||
mfile.print "\n\n"
|
mfile.print "\n\n"
|
||||||
if makedef
|
if makedef
|
||||||
mfile.print "$(DEFFILE): #{origdef}\n"
|
mfile.print "$(DEFFILE): #{origdef || ''}\n"
|
||||||
mfile.print "\t$(RUBY) #{makedef} #{origdef} > $@\n\n"
|
mfile.print "\t$(RUBY) #{makedef} #{origdef} > $@\n\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ end
|
||||||
#include <winver.h>
|
#include <winver.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#{icons}
|
#{icons || ''}
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION #{fversion}
|
FILEVERSION #{fversion}
|
||||||
PRODUCTVERSION #{fversion}
|
PRODUCTVERSION #{fversion}
|
||||||
|
|
Loading…
Reference in a new issue