Skip to content

Commit

Permalink
eban
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
eban committed Aug 30, 2000
1 parent d1a3cd4 commit 4970f29
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 25 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
Wed Aug 30 11:31:47 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>

* ext/Win32API/Win32API.c (Win32API_initialize): add the
arguments checking.

Tue Aug 29 15:18:20 2000 Yukihiro Matsumoto <matz@ruby-lang.org>

* ruby.c (proc_options): the value of -K may be empty.
Expand Down
58 changes: 33 additions & 25 deletions ext/Win32API/Win32API.c
Expand Up @@ -70,36 +70,44 @@ Win32API_initialize(self, dllname, proc, import, export)
rb_iv_set(self, "__proc__", UINT2NUM((unsigned long)hproc));

a_import = rb_ary_new();
ptr = RARRAY(import)->ptr;
for (i = 0, len = RARRAY(import)->len; i < len; i++) {
int c = *(char *)RSTRING(ptr[i])->ptr;
switch (c) {
case 'N': case 'n': case 'L': case 'l':
rb_ary_push(a_import, INT2FIX(_T_NUMBER));
break;
case 'P': case 'p':
rb_ary_push(a_import, INT2FIX(_T_POINTER));
break;
case 'I': case 'i':
rb_ary_push(a_import, INT2FIX(_T_INTEGER));
break;
if (!NIL_P(import)) {
Check_Type(import, T_ARRAY);
ptr = RARRAY(import)->ptr;
for (i = 0, len = RARRAY(import)->len; i < len; i++) {
Check_Type(ptr[i], T_STRING);
switch (*(char *)RSTRING(ptr[i])->ptr) {
case 'N': case 'n': case 'L': case 'l':
rb_ary_push(a_import, INT2FIX(_T_NUMBER));
break;
case 'P': case 'p':
rb_ary_push(a_import, INT2FIX(_T_POINTER));
break;
case 'I': case 'i':
rb_ary_push(a_import, INT2FIX(_T_INTEGER));
break;
}
}
}
rb_iv_set(self, "__import__", a_import);

switch (*RSTRING(export)->ptr) {
case 'V': case 'v':
if (NIL_P(export)) {
ex = _T_VOID;
break;
case 'N': case 'n': case 'L': case 'l':
ex = _T_NUMBER;
break;
case 'P': case 'p':
ex = _T_POINTER;
break;
case 'I': case 'i':
ex = _T_INTEGER;
break;
} else {
Check_Type(export, T_STRING);
switch (*RSTRING(export)->ptr) {
case 'V': case 'v':
ex = _T_VOID;
break;
case 'N': case 'n': case 'L': case 'l':
ex = _T_NUMBER;
break;
case 'P': case 'p':
ex = _T_POINTER;
break;
case 'I': case 'i':
ex = _T_INTEGER;
break;
}
}
rb_iv_set(self, "__export__", INT2FIX(ex));

Expand Down

0 comments on commit 4970f29

Please sign in to comment.