mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
99d65b14b4
pack.c, parse.y, re.c, thread.c, vm.c, vm_dump.c, call_cfunc.ci, thread_pthread.ci, thread_win32.ci: fixed indentation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
94 lines
2.5 KiB
C
94 lines
2.5 KiB
C
/* -*-c-*- */
|
|
|
|
/* from ruby1.9/eval.c */
|
|
|
|
static inline VALUE
|
|
call_cfunc(func, recv, len, argc, argv)
|
|
VALUE (*func) ();
|
|
VALUE recv;
|
|
int len, argc;
|
|
const VALUE *argv;
|
|
{
|
|
/* printf("len: %d, argc: %d\n", len, argc); */
|
|
|
|
if (len >= 0 && argc != len) {
|
|
rb_raise(rb_eArgError, "wrong number of arguments(%d for %d)",
|
|
argc, len);
|
|
}
|
|
|
|
switch (len) {
|
|
case -2:
|
|
return (*func) (recv, rb_ary_new4(argc, argv));
|
|
break;
|
|
case -1:
|
|
return (*func) (argc, argv, recv);
|
|
break;
|
|
case 0:
|
|
return (*func) (recv);
|
|
break;
|
|
case 1:
|
|
return (*func) (recv, argv[0]);
|
|
break;
|
|
case 2:
|
|
return (*func) (recv, argv[0], argv[1]);
|
|
break;
|
|
case 3:
|
|
return (*func) (recv, argv[0], argv[1], argv[2]);
|
|
break;
|
|
case 4:
|
|
return (*func) (recv, argv[0], argv[1], argv[2], argv[3]);
|
|
break;
|
|
case 5:
|
|
return (*func) (recv, argv[0], argv[1], argv[2], argv[3], argv[4]);
|
|
break;
|
|
case 6:
|
|
return (*func) (recv, argv[0], argv[1], argv[2], argv[3], argv[4],
|
|
argv[5]);
|
|
break;
|
|
case 7:
|
|
return (*func) (recv, argv[0], argv[1], argv[2], argv[3], argv[4],
|
|
argv[5], argv[6]);
|
|
break;
|
|
case 8:
|
|
return (*func) (recv, argv[0], argv[1], argv[2], argv[3], argv[4],
|
|
argv[5], argv[6], argv[7]);
|
|
break;
|
|
case 9:
|
|
return (*func) (recv, argv[0], argv[1], argv[2], argv[3], argv[4],
|
|
argv[5], argv[6], argv[7], argv[8]);
|
|
break;
|
|
case 10:
|
|
return (*func) (recv, argv[0], argv[1], argv[2], argv[3], argv[4],
|
|
argv[5], argv[6], argv[7], argv[8], argv[9]);
|
|
break;
|
|
case 11:
|
|
return (*func) (recv, argv[0], argv[1], argv[2], argv[3], argv[4],
|
|
argv[5], argv[6], argv[7], argv[8], argv[9],
|
|
argv[10]);
|
|
break;
|
|
case 12:
|
|
return (*func) (recv, argv[0], argv[1], argv[2], argv[3], argv[4],
|
|
argv[5], argv[6], argv[7], argv[8], argv[9],
|
|
argv[10], argv[11]);
|
|
break;
|
|
case 13:
|
|
return (*func) (recv, argv[0], argv[1], argv[2], argv[3], argv[4],
|
|
argv[5], argv[6], argv[7], argv[8], argv[9], argv[10],
|
|
argv[11], argv[12]);
|
|
break;
|
|
case 14:
|
|
return (*func) (recv, argv[0], argv[1], argv[2], argv[3], argv[4],
|
|
argv[5], argv[6], argv[7], argv[8], argv[9], argv[10],
|
|
argv[11], argv[12], argv[13]);
|
|
break;
|
|
case 15:
|
|
return (*func) (recv, argv[0], argv[1], argv[2], argv[3], argv[4],
|
|
argv[5], argv[6], argv[7], argv[8], argv[9], argv[10],
|
|
argv[11], argv[12], argv[13], argv[14]);
|
|
break;
|
|
default:
|
|
rb_raise(rb_eArgError, "too many arguments(%d)", len);
|
|
break;
|
|
}
|
|
return Qnil; /* not reached */
|
|
}
|