removed the variadic field from the moo_pfinfo_t structure.
defined variadic Integer>>bitAnd, Integer>>bitOr, Integer>>bitXor methods
This commit is contained in:
parent
5004b39125
commit
044177fa61
@ -219,18 +219,36 @@ class(#limited) Number(Magnitude)
|
||||
^(self bitShift: index negated) bitAnd: 1.
|
||||
}
|
||||
|
||||
method(#variadic) bitAnd(operand)
|
||||
{
|
||||
<primitive: #Integer_bitand>
|
||||
self primitiveFailed.
|
||||
}
|
||||
|
||||
method bitAnd: aNumber
|
||||
{
|
||||
<primitive: #Integer_bitand>
|
||||
self primitiveFailed.
|
||||
}
|
||||
|
||||
method(#variadic) bitOr(operand)
|
||||
{
|
||||
<primitive: #Integer_bitor>
|
||||
self primitiveFailed.
|
||||
}
|
||||
|
||||
method bitOr: aNumber
|
||||
{
|
||||
<primitive: #Integer_bitor>
|
||||
self primitiveFailed.
|
||||
}
|
||||
|
||||
method(#variadic) bitXor(operand)
|
||||
{
|
||||
<primitive: #Integer_bitxor>
|
||||
self primitiveFailed.
|
||||
}
|
||||
|
||||
method bitXor: aNumber
|
||||
{
|
||||
<primitive: #Integer_bitxor>
|
||||
|
@ -3747,8 +3747,9 @@ static moo_pfrc_t pf_integer_bitat (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
|
||||
static moo_pfrc_t pf_integer_bitand (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
|
||||
{
|
||||
moo_oop_t rcv, arg, res;
|
||||
moo_oow_t i;
|
||||
|
||||
MOO_ASSERT (moo, nargs == 1);
|
||||
MOO_ASSERT (moo, nargs >= 1);
|
||||
|
||||
rcv = MOO_STACK_GETRCV(moo, nargs);
|
||||
arg = MOO_STACK_GETARG(moo, nargs, 0);
|
||||
@ -3756,6 +3757,13 @@ static moo_pfrc_t pf_integer_bitand (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs
|
||||
res = moo_bitandints(moo, rcv, arg);
|
||||
if (!res) return (moo->errnum == MOO_EINVAL? MOO_PF_FAILURE: MOO_PF_HARD_FAILURE);
|
||||
|
||||
for (i = 1; i < nargs; i++)
|
||||
{
|
||||
arg = MOO_STACK_GETARG(moo, nargs, i);
|
||||
res = moo_bitandints(moo, res, arg);
|
||||
if (!res) return (moo->errnum == MOO_EINVAL? MOO_PF_FAILURE: MOO_PF_HARD_FAILURE);
|
||||
}
|
||||
|
||||
MOO_STACK_SETRET (moo, nargs, res);
|
||||
return MOO_PF_SUCCESS;
|
||||
}
|
||||
@ -3763,8 +3771,9 @@ static moo_pfrc_t pf_integer_bitand (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs
|
||||
static moo_pfrc_t pf_integer_bitor (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
|
||||
{
|
||||
moo_oop_t rcv, arg, res;
|
||||
moo_oow_t i;
|
||||
|
||||
MOO_ASSERT (moo, nargs == 1);
|
||||
MOO_ASSERT (moo, nargs >= 1);
|
||||
|
||||
rcv = MOO_STACK_GETRCV(moo, nargs);
|
||||
arg = MOO_STACK_GETARG(moo, nargs, 0);
|
||||
@ -3772,6 +3781,13 @@ static moo_pfrc_t pf_integer_bitor (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
|
||||
res = moo_bitorints(moo, rcv, arg);
|
||||
if (!res) return (moo->errnum == MOO_EINVAL? MOO_PF_FAILURE: MOO_PF_HARD_FAILURE);
|
||||
|
||||
for (i = 1; i < nargs; i++)
|
||||
{
|
||||
arg = MOO_STACK_GETARG(moo, nargs, i);
|
||||
res = moo_bitorints(moo, res, arg);
|
||||
if (!res) return (moo->errnum == MOO_EINVAL? MOO_PF_FAILURE: MOO_PF_HARD_FAILURE);
|
||||
}
|
||||
|
||||
MOO_STACK_SETRET (moo, nargs, res);
|
||||
return MOO_PF_SUCCESS;
|
||||
}
|
||||
@ -3779,8 +3795,9 @@ static moo_pfrc_t pf_integer_bitor (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
|
||||
static moo_pfrc_t pf_integer_bitxor (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
|
||||
{
|
||||
moo_oop_t rcv, arg, res;
|
||||
moo_oow_t i;
|
||||
|
||||
MOO_ASSERT (moo, nargs == 1);
|
||||
MOO_ASSERT (moo, nargs >= 1);
|
||||
|
||||
rcv = MOO_STACK_GETRCV(moo, nargs);
|
||||
arg = MOO_STACK_GETARG(moo, nargs, 0);
|
||||
@ -3788,6 +3805,13 @@ static moo_pfrc_t pf_integer_bitxor (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs
|
||||
res = moo_bitxorints(moo, rcv, arg);
|
||||
if (!res) return (moo->errnum == MOO_EINVAL? MOO_PF_FAILURE: MOO_PF_HARD_FAILURE);
|
||||
|
||||
for (i = 1; i < nargs; i++)
|
||||
{
|
||||
arg = MOO_STACK_GETARG(moo, nargs, i);
|
||||
res = moo_bitxorints(moo, res, arg);
|
||||
if (!res) return (moo->errnum == MOO_EINVAL? MOO_PF_FAILURE: MOO_PF_HARD_FAILURE);
|
||||
}
|
||||
|
||||
MOO_STACK_SETRET (moo, nargs, res);
|
||||
return MOO_PF_SUCCESS;
|
||||
}
|
||||
@ -4366,12 +4390,12 @@ static pf_t pftab[] =
|
||||
{ "FixedPointDecimal_scale:", { pf_number_scale, 1, 1 } },
|
||||
|
||||
{ "Integer_add", { pf_integer_add, 1, 1 } },
|
||||
{ "Integer_bitand", { pf_integer_bitand, 1, 1 } },
|
||||
{ "Integer_bitand", { pf_integer_bitand, 1, MA } },
|
||||
{ "Integer_bitat", { pf_integer_bitat, 1, 1 } },
|
||||
{ "Integer_bitinv", { pf_integer_bitinv, 0, 0 } },
|
||||
{ "Integer_bitor", { pf_integer_bitor, 1, 1 } },
|
||||
{ "Integer_bitor", { pf_integer_bitor, 1, MA } },
|
||||
{ "Integer_bitshift", { pf_integer_bitshift, 1, 1 } },
|
||||
{ "Integer_bitxor", { pf_integer_bitxor, 1, 1 } },
|
||||
{ "Integer_bitxor", { pf_integer_bitxor, 1, MA } },
|
||||
{ "Integer_div", { pf_integer_div, 1, 1 } },
|
||||
{ "Integer_eq", { pf_integer_eq, 1, 1 } },
|
||||
{ "Integer_ge", { pf_integer_ge, 1, 1 } },
|
||||
|
@ -1328,7 +1328,6 @@ struct moo_pfinfo_t
|
||||
{
|
||||
moo_method_type_t type;
|
||||
const moo_bch_t* name;
|
||||
int variadic;
|
||||
moo_pfbase_t base;
|
||||
};
|
||||
|
||||
|
@ -256,11 +256,11 @@ einval:
|
||||
|
||||
static moo_pfinfo_t pfinfos[] =
|
||||
{
|
||||
{ I, "clear", 0, { pf_clear, 0, 0 } },
|
||||
{ I, "close", 0, { pf_close, 0, 0 } },
|
||||
{ I, "open", 0, { pf_open, 0, 0 } },
|
||||
{ I, "setcursor", 0, { pf_setcursor, 2, 2 } },
|
||||
{ I, "write", 0, { pf_write, 1, 1 } }
|
||||
{ I, "clear", { pf_clear, 0, 0 } },
|
||||
{ I, "close", { pf_close, 0, 0 } },
|
||||
{ I, "open", { pf_open, 0, 0 } },
|
||||
{ I, "setcursor", { pf_setcursor, 2, 2 } },
|
||||
{ I, "write", { pf_write, 1, 1 } }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
@ -1198,10 +1198,10 @@ softfail:
|
||||
|
||||
static moo_pfinfo_t pfinfos[] =
|
||||
{
|
||||
{ I, "call", 0, { pf_call, 3, 3 } },
|
||||
{ I, "close", 0, { pf_close, 0, 0 } },
|
||||
{ I, "getsym", 0, { pf_getsym, 1, 1 } },
|
||||
{ I, "open", 0, { pf_open, 1, 1 } }
|
||||
{ I, "call", { pf_call, 3, 3 } },
|
||||
{ I, "close", { pf_close, 0, 0 } },
|
||||
{ I, "getsym", { pf_getsym, 1, 1 } },
|
||||
{ I, "open", { pf_open, 1, 1 } }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
@ -120,8 +120,8 @@ oops:
|
||||
|
||||
static moo_pfinfo_t pfinfos[] =
|
||||
{
|
||||
{ I, "open:flags:", 0, { pf_open_file, 2, 2 } },
|
||||
{ I, "open:flags:mode:", 0, { pf_open_file, 3, 3 } },
|
||||
{ I, "open:flags:", { pf_open_file, 2, 2 } },
|
||||
{ I, "open:flags:mode:", { pf_open_file, 3, 3 } },
|
||||
};
|
||||
|
||||
static moo_pvinfo_t pvinfos[] =
|
||||
|
10
moo/mod/io.c
10
moo/mod/io.c
@ -219,11 +219,11 @@ static moo_pfrc_t pf_write_bytes (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
|
||||
|
||||
static moo_pfinfo_t pfinfos[] =
|
||||
{
|
||||
{ I, "close", 0, { pf_close_io, 0, 0 } },
|
||||
{ I, "readBytesInto:", 0, { pf_read_bytes, 1, 1 } },
|
||||
{ I, "readBytesInto:startingAt:for:", 0, { pf_read_bytes, 3, 3 } },
|
||||
{ I, "writeBytesFrom:", 0, { pf_write_bytes, 1, 1 } },
|
||||
{ I, "writeBytesFrom:startingAt:for:", 0, { pf_write_bytes, 3, 3 } }
|
||||
{ I, "close", { pf_close_io, 0, 0 } },
|
||||
{ I, "readBytesInto:", { pf_read_bytes, 1, 1 } },
|
||||
{ I, "readBytesInto:startingAt:for:", { pf_read_bytes, 3, 3 } },
|
||||
{ I, "writeBytesFrom:", { pf_write_bytes, 1, 1 } },
|
||||
{ I, "writeBytesFrom:startingAt:for:", { pf_write_bytes, 3, 3 } }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
@ -494,8 +494,8 @@ static moo_pfrc_t pf_from_string (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
|
||||
|
||||
static moo_pfinfo_t pfinfos[] =
|
||||
{
|
||||
{ I, "family", 0, { pf_get_family, 0, 0 } },
|
||||
{ I, "fromString:", 0, { pf_from_string, 1, 1 } }
|
||||
{ I, "family", { pf_get_family, 0, 0 } },
|
||||
{ I, "fromString:", { pf_from_string, 1, 1 } }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
@ -576,17 +576,17 @@ static moo_pfrc_t pf_write_socket (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
|
||||
|
||||
static moo_pfinfo_t pfinfos[] =
|
||||
{
|
||||
{ I, "accept:", 0, { pf_accept_socket, 1, 1 } },
|
||||
{ I, "bind:", 0, { pf_bind_socket, 1, 1 } },
|
||||
{ I, "close", 0, { pf_close_socket, 0, 0 } },
|
||||
{ I, "connect:", 0, { pf_connect_socket, 1, 1 } },
|
||||
{ I, "listen:", 0, { pf_listen_socket, 1, 1 } },
|
||||
{ I, "open", 0, { pf_open_socket, 1, 3 } },
|
||||
{ I, "readBytesInto:", 0, { pf_read_socket, 1, 1 } },
|
||||
{ I, "readBytesInto:startingAt:for:", 0, { pf_read_socket, 3, 3 } },
|
||||
{ I, "socketError", 0, { pf_get_socket_error, 0, 0 } },
|
||||
{ I, "writeBytesFrom:", 0, { pf_write_socket, 1, 1 } },
|
||||
{ I, "writeBytesFrom:startingAt:for:", 0, { pf_write_socket, 3, 3 } }
|
||||
{ I, "accept:", { pf_accept_socket, 1, 1 } },
|
||||
{ I, "bind:", { pf_bind_socket, 1, 1 } },
|
||||
{ I, "close", { pf_close_socket, 0, 0 } },
|
||||
{ I, "connect:", { pf_connect_socket, 1, 1 } },
|
||||
{ I, "listen:", { pf_listen_socket, 1, 1 } },
|
||||
{ I, "open", { pf_open_socket, 1, 3 } },
|
||||
{ I, "readBytesInto:", { pf_read_socket, 1, 1 } },
|
||||
{ I, "readBytesInto:startingAt:for:", { pf_read_socket, 3, 3 } },
|
||||
{ I, "socketError", { pf_get_socket_error, 0, 0 } },
|
||||
{ I, "writeBytesFrom:", { pf_write_socket, 1, 1 } },
|
||||
{ I, "writeBytesFrom:startingAt:for:", { pf_write_socket, 3, 3 } }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
@ -211,11 +211,11 @@ static moo_pfrc_t pf_puts (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
|
||||
|
||||
static moo_pfinfo_t pfinfos[] =
|
||||
{
|
||||
{ I, "close", 0, { pf_close, 0, 0 } },
|
||||
{ I, "gets", 0, { pf_gets, 0, 0 } },
|
||||
{ I, "open", 0, { pf_open, 2, 2 } },
|
||||
{ I, "putc", 1, { pf_putc, 0, MA } },
|
||||
{ I, "puts", 1, { pf_puts, 0, MA } }
|
||||
{ I, "close", { pf_close, 0, 0 } },
|
||||
{ I, "gets", { pf_gets, 0, 0 } },
|
||||
{ I, "open", { pf_open, 2, 2 } },
|
||||
{ I, "putc", { pf_putc, 0, MA } },
|
||||
{ I, "puts", { pf_puts, 0, MA } }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
@ -797,19 +797,19 @@ static moo_pfrc_t pf_draw_string (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
|
||||
|
||||
static moo_pfinfo_t x11_pfinfo[] =
|
||||
{
|
||||
{ MI, "apply_gc", 0, { pf_apply_gc, 1, 1 } },
|
||||
{ MI, "close_display", 0, { pf_close_display, 0, 0 } },
|
||||
{ MI, "create_gc", 0, { pf_create_gc, 1, 1 } },
|
||||
{ MI, "create_window", 0, { pf_create_window, 7, 7 } },
|
||||
{ MI, "destroy_gc", 0, { pf_destroy_gc, 1, 1 } },
|
||||
{ MI, "destroy_window", 0, { pf_destroy_window, 1, 1 } },
|
||||
{ MI, "apply_gc", { pf_apply_gc, 1, 1 } },
|
||||
{ MI, "close_display", { pf_close_display, 0, 0 } },
|
||||
{ MI, "create_gc", { pf_create_gc, 1, 1 } },
|
||||
{ MI, "create_window", { pf_create_window, 7, 7 } },
|
||||
{ MI, "destroy_gc", { pf_destroy_gc, 1, 1 } },
|
||||
{ MI, "destroy_window", { pf_destroy_window, 1, 1 } },
|
||||
|
||||
{ MI, "draw_rectangle", 0, { pf_draw_rectangle, 6, 6 } },
|
||||
{ MI, "draw_string", 0, { pf_draw_string, 4, 4 } },
|
||||
{ MI, "fill_rectangle", 0, { pf_fill_rectangle, 6, 6 } },
|
||||
{ MI, "get_fd", 0, { pf_get_fd, 0, 0 } },
|
||||
{ MI, "get_llevent", 0, { pf_get_llevent, 1, 1 } },
|
||||
{ MI, "open_display", 0, { pf_open_display, 0, 1 } }
|
||||
{ MI, "draw_rectangle", { pf_draw_rectangle, 6, 6 } },
|
||||
{ MI, "draw_string", { pf_draw_string, 4, 4 } },
|
||||
{ MI, "fill_rectangle", { pf_fill_rectangle, 6, 6 } },
|
||||
{ MI, "get_fd", { pf_get_fd, 0, 0 } },
|
||||
{ MI, "get_llevent", { pf_get_llevent, 1, 1 } },
|
||||
{ MI, "open_display", { pf_open_display, 0, 1 } }
|
||||
};
|
||||
|
||||
static int x11_import (moo_t* moo, moo_mod_t* mod, moo_oop_class_t _class)
|
||||
|
Loading…
Reference in New Issue
Block a user