/* Code to access $name$ objects as numbers */ /* Note that we follow the new pattern without coersion. We leave the coerce slot empty and all binary and ternary operations take PyObject* arguments. At least one of the arguments will be of an $abbrev$$object$, but it may not be the first. */ /* If you don't want to implement any of these, just remove the function def and change the reference to a 0 in the structure below. */ static PyObject * $abbrev$_add(PyObject *v, PyObject *w) { /* XXXX Add them */ } static PyObject * $abbrev$_sub(PyObject *v, PyObject *w) { /* XXXX Subtract them */ } static PyObject * $abbrev$_mul(PyObject *v, PyObject *w) { /* XXXX Multiply them */ } static PyObject * $abbrev$_div(PyObject *x, PyObject *y) { /* XXXX Divide them */ } static PyObject * $abbrev$_mod(PyObject *x, PyObject *y) { /* XXXX Modulo them */ } static PyObject * $abbrev$_divmod(PyObject *x, PyObject *y) { /* XXXX Return 2-tuple with div and mod */ } static PyObject * $abbrev$_pow(PyObject *v, PyObject *w, PyObject *z) { /* XXXX */ } static PyObject * $abbrev$_neg($abbrev$$object$ *v) { /* XXXX */ } static PyObject * $abbrev$_pos($abbrev$$object$ *v) { /* XXXX */ } static PyObject * $abbrev$_abs($abbrev$$object$ *v) { /* XXXX */ } static int $abbrev$_nonzero($abbrev$$object$ *v) { /* XXXX Return 1 if non-zero */ } static PyObject * $abbrev$_invert($abbrev$$object$ *v) { /* XXXX */ } static PyObject * $abbrev$_lshift(PyObject *v, PyObject *w) { /* XXXX */ } static PyObject * $abbrev$_rshift(PyObject *v, PyObject *w) { /* XXXX */ } static PyObject * $abbrev$_and(PyObject *v, PyObject *w) { /* XXXX */ } static PyObject * $abbrev$_xor(PyObject *v, PyObject *w) { /* XXXX */ } static PyObject * $abbrev$_or(PyObject *v, PyObject *w) { /* XXXX */ } static PyObject * $abbrev$_int($abbrev$$object$ *v) { /* XXXX */ } static PyObject * $abbrev$_long($abbrev$$object$ *v) { /* XXXX */ } static PyObject * $abbrev$_float($abbrev$$object$ *v) { /* XXXX */ } static PyObject * $abbrev$_oct($abbrev$$object$ *v) { /* XXXX Return object as octal stringobject */ } static PyObject * $abbrev$_hex($abbrev$$object$ *v) { /* XXXX Return object as hex stringobject */ } PyObject * $abbrev$_inplace_add(PyObject *v, PyObject *w) { } PyObject * $abbrev$_inplace_subtract(PyObject *v, PyObject *w) { } PyObject * $abbrev$_inplace_multiply(PyObject *v, PyObject *w) { } PyObject * $abbrev$_inplace_divide(PyObject *v, PyObject *w) { } PyObject * $abbrev$_inplace_remainder(PyObject *v, PyObject *w) { } PyObject * $abbrev$b_inplace_power(PyObject *v, PyObject *w, PyObject *modulo) { } PyObject * $abbrev$_inplace_lshift(PyObject *v, PyObject *w) { } PyObject * $abbrev$_inplace_rshift(PyObject *v, PyObject *w) { } PyObject * $abbrev$_inplace_and(PyObject *v, PyObject *w) { } PyObject * $abbrev$_inplace_xor(PyObject *v, PyObject *w) { } PyObject * $abbrev$_inplace_or(PyObject *v, PyObject *w) { } PyObject * $abbrev$_floor_divide(PyObject *v, PyObject *w) { } PyObject * $abbrev$_true_divide(PyObject *v, PyObject *w) { } PyObject * $abbrev$_inplace_floor_divide(PyObject *v, PyObject *w) { } PyObject * $abbrev$_inplace_true_divide(PyObject *v, PyObject *w) { } static PyNumberMethods $abbrev$_as_number = { /* nb_add */ (binaryfunc)$abbrev$_add, /* nb_subtract */ (binaryfunc)$abbrev$_sub, /* nb_multiply */ (binaryfunc)$abbrev$_mul, /* nb_divide */ (binaryfunc)$abbrev$_div, /* nb_remainder */ (binaryfunc)$abbrev$_mod, /* nb_divmod */ (binaryfunc)$abbrev$_divmod, /* nb_power */ (ternaryfunc)$abbrev$_pow, /* nb_negative */ (unaryfunc)$abbrev$_neg, /* nb_positive */ (unaryfunc)$abbrev$_pos, /* nb_absolute */ (unaryfunc)$abbrev$_abs, /* nb_nonzero */ (inquiry)$abbrev$_nonzero, /* nb_invert */ (unaryfunc)$abbrev$_invert, /* nb_lshift */ (binaryfunc)$abbrev$_lshift, /* nb_rshift */ (binaryfunc)$abbrev$_rshift, /* nb_and */ (binaryfunc)$abbrev$_and, /* nb_xor */ (binaryfunc)$abbrev$_xor, /* nb_or */ (binaryfunc)$abbrev$_or, /* nb_coerce */ 0, /* Coercion is obsolete! */ /* nb_int */ (unaryfunc)$abbrev$_int, /* nb_long */ (unaryfunc)$abbrev$_long, /* nb_float */ (unaryfunc)$abbrev$_float, /* nb_oct */ (unaryfunc)$abbrev$_oct, /* nb_hex */ (unaryfunc)$abbrev$_hex, /* nb_inplace_add */ (binaryfunc)$abbrev$_inplace_add, /* nb_inplace_subtract */ (binaryfunc)$abbrev$_inplace_subtract, /* nb_inplace_multiply */ (binaryfunc)$abbrev$_inplace_multiply, /* nb_inplace_divide */ (binaryfunc)$abbrev$_inplace_divide, /* nb_inplace_remainder */ (binaryfunc)$abbrev$_inplace_remainder, /* nb_inplace_power */ (ternaryfunc)$abbrev$_inplace_power, /* nb_inplace_lshift */ (binaryfunc)$abbrev$_inplace_lshift, /* nb_inplace_rshift */ (binaryfunc)$abbrev$_inplace_rshift, /* nb_inplace_and */ (binaryfunc)$abbrev$_inplace_and, /* nb_inplace_xor */ (binaryfunc)$abbrev$_inplace_xor, /* nb_inplace_or */ (binaryfunc)$abbrev$_inplace_or, /* nb_floor_divide */ (binaryfunc)$abbrev$_floor_divide, /* nb_true_divide */ (binaryfunc)$abbrev$_true_divide, /* nb_inplace_floor_divide */ (binaryfunc)$abbrev$_inplace_floor_divide, /* nb_inplace_true_divide */ (binaryfunc)$abbrev$_inplace_true_divide, }; /* ------------------------------------------------------- */