mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
205f310c29
eval_error.h, eval_jump.h, eval_load.c, eval_thread.c, gc.c, insnhelper.h, insns.def, iseq.c, main.c, numeric.c, parse.y, range.c, regenc.h, ruby.h, signal.c, thread.c, thread_win32.ci, vm.c, vm.h, vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h: fixed indents and non-C90 comments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
94 lines
2.4 KiB
C
94 lines
2.4 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 */
|
|
}
|