cpython/Tools/modulator/Templates/object_tp_as_number

250 lines
4.4 KiB
Plaintext

/* Code to access $name$ objects as numbers */
static object *
$abbrev$_add(v, w)
$abbrev$object *v;
$abbrev$object *w;
{
/* XXXX Add them */
err_setstr(SystemError, "not implemented");
return NULL;
}
static object *
$abbrev$_sub(v, w)
$abbrev$object *v;
$abbrev$object *w;
{
/* XXXX Subtract them */
err_setstr(SystemError, "not implemented");
return NULL;
}
static object *
$abbrev$_mul(v, w)
$abbrev$object *v;
$abbrev$object *w;
{
/* XXXX Multiply them */
err_setstr(SystemError, "not implemented");
return NULL;
}
static object *
$abbrev$_div(x, y)
$abbrev$object *x;
$abbrev$object *y;
{
/* XXXX Divide them */
err_setstr(SystemError, "not implemented");
return NULL;
}
static object *
$abbrev$_mod(x, y)
$abbrev$object *x;
$abbrev$object *y;
{
/* XXXX Modulo them */
err_setstr(SystemError, "not implemented");
return NULL;
}
static object *
$abbrev$_divmod(x, y)
$abbrev$object *x;
$abbrev$object *y;
{
/* XXXX Return 2-tuple with div and mod */
err_setstr(SystemError, "not implemented");
return NULL;
}
static object *
$abbrev$_pow(v, w, z)
$abbrev$object *v;
$abbrev$object *w;
$abbrev$object *z;
{
/* XXXX */
err_setstr(SystemError, "not implemented");
return NULL;
}
static object *
$abbrev$_neg(v)
$abbrev$object *v;
{
/* XXXX */
err_setstr(SystemError, "not implemented");
return NULL;
}
static object *
$abbrev$_pos(v)
$abbrev$object *v;
{
/* XXXX */
err_setstr(SystemError, "not implemented");
return NULL;
}
static object *
$abbrev$_abs(v)
$abbrev$object *v;
{
/* XXXX */
err_setstr(SystemError, "not implemented");
return NULL;
}
static int
$abbrev$_nonzero(v)
$abbrev$object *v;
{
/* XXXX Return 1 if non-zero */
err_setstr(SystemError, "not implemented");
return -1;
}
static object *
$abbrev$_invert(v)
$abbrev$object *v;
{
/* XXXX */
err_setstr(SystemError, "not implemented");
return NULL;
}
static object *
$abbrev$_lshift(v, w)
$abbrev$object *v;
$abbrev$object *w;
{
/* XXXX */
err_setstr(SystemError, "not implemented");
return NULL;
}
static object *
$abbrev$_rshift(v, w)
$abbrev$object *v;
$abbrev$object *w;
{
/* XXXX */
err_setstr(SystemError, "not implemented");
return NULL;
}
static object *
$abbrev$_and(v, w)
$abbrev$object *v;
$abbrev$object *w;
{
/* XXXX */
err_setstr(SystemError, "not implemented");
return NULL;
}
static object *
$abbrev$_xor(v, w)
$abbrev$object *v;
$abbrev$object *w;
{
/* XXXX */
err_setstr(SystemError, "not implemented");
return NULL;
}
static object *
$abbrev$_or(v, w)
$abbrev$object *v;
$abbrev$object *w;
{
/* XXXX */
err_setstr(SystemError, "not implemented");
return NULL;
}
static int
$abbrev$_coerce(pv, pw)
object **pv;
object **pw;
{
/* XXXX I haven't a clue... */
return 1;
}
static object *
$abbrev$_int(v)
$abbrev$object *v;
{
/* XXXX */
err_setstr(SystemError, "not implemented");
return NULL;
}
static object *
$abbrev$_long(v)
$abbrev$object *v;
{
/* XXXX */
err_setstr(SystemError, "not implemented");
return NULL;
}
static object *
$abbrev$_float(v)
$abbrev$object *v;
{
/* XXXX */
err_setstr(SystemError, "not implemented");
return NULL;
}
static object *
$abbrev$_oct(v)
$abbrev$object *v;
{
/* XXXX Return object as octal stringobject */
err_setstr(SystemError, "not implemented");
return NULL;
}
static object *
$abbrev$_hex(v)
$abbrev$object *v;
{
/* XXXX Return object as hex stringobject */
err_setstr(SystemError, "not implemented");
return NULL;
}
static number_methods $abbrev$_as_number = {
(binaryfunc)$abbrev$_add, /*nb_add*/
(binaryfunc)$abbrev$_sub, /*nb_subtract*/
(binaryfunc)$abbrev$_mul, /*nb_multiply*/
(binaryfunc)$abbrev$_div, /*nb_divide*/
(binaryfunc)$abbrev$_mod, /*nb_remainder*/
(binaryfunc)$abbrev$_divmod, /*nb_divmod*/
(ternaryfunc)$abbrev$_pow, /*nb_power*/
(unaryfunc)$abbrev$_neg, /*nb_negative*/
(unaryfunc)$abbrev$_pos, /*nb_positive*/
(unaryfunc)$abbrev$_abs, /*nb_absolute*/
(inquiry)$abbrev$_nonzero, /*nb_nonzero*/
(unaryfunc)$abbrev$_invert, /*nb_invert*/
(binaryfunc)$abbrev$_lshift, /*nb_lshift*/
(binaryfunc)$abbrev$_rshift, /*nb_rshift*/
(binaryfunc)$abbrev$_and, /*nb_and*/
(binaryfunc)$abbrev$_xor, /*nb_xor*/
(binaryfunc)$abbrev$_or, /*nb_or*/
(coercion)$abbrev$_coerce, /*nb_coerce*/
(unaryfunc)$abbrev$_int, /*nb_int*/
(unaryfunc)$abbrev$_long, /*nb_long*/
(unaryfunc)$abbrev$_float, /*nb_float*/
(unaryfunc)$abbrev$_oct, /*nb_oct*/
(unaryfunc)$abbrev$_hex, /*nb_hex*/
};
/* ------------------------------------------------------- */