PageRenderTime 24ms CodeModel.GetById 15ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/Tools/modulator/Templates/object_tp_as_number

http://unladen-swallow.googlecode.com/
#! | 169 lines | 143 code | 26 blank | 0 comment | 0 complexity | e9ccbf9accf18cadc561e4bad8526e3c MD5 | raw file
  1
  2/* Code to access $name$ objects as numbers */
  3
  4static PyObject *
  5$abbrev$_add($abbrev$object *v, $abbrev$object *w)
  6{
  7	/* XXXX Add them */
  8}
  9
 10static PyObject *
 11$abbrev$_sub($abbrev$object *v, $abbrev$object *w)
 12{
 13	/* XXXX Subtract them */
 14}
 15
 16static PyObject *
 17$abbrev$_mul($abbrev$object *v, $abbrev$object *w)
 18{
 19	/* XXXX Multiply them */
 20}
 21
 22static PyObject *
 23$abbrev$_div($abbrev$object *x, $abbrev$object *y)
 24{
 25	/* XXXX Divide them */
 26}
 27
 28static PyObject *
 29$abbrev$_mod($abbrev$object *x, $abbrev$object *y)
 30{
 31	/* XXXX Modulo them */
 32}
 33
 34static PyObject *
 35$abbrev$_divmod($abbrev$object *x, $abbrev$object *y)
 36{
 37	/* XXXX Return 2-tuple with div and mod */
 38}
 39
 40static PyObject *
 41$abbrev$_pow($abbrev$object *v, $abbrev$object *w, $abbrev$object *z)
 42{
 43	/* XXXX */
 44}				
 45
 46static PyObject *
 47$abbrev$_neg($abbrev$object *v)
 48{
 49	/* XXXX */
 50}
 51
 52static PyObject *
 53$abbrev$_pos($abbrev$object *v)
 54{
 55	/* XXXX */
 56}
 57
 58static PyObject *
 59$abbrev$_abs($abbrev$object *v)
 60{
 61	/* XXXX */
 62}
 63
 64static int
 65$abbrev$_nonzero($abbrev$object *v)
 66{
 67	/* XXXX Return 1 if non-zero */
 68}
 69
 70static PyObject *
 71$abbrev$_invert($abbrev$object *v)
 72{
 73	/* XXXX */
 74}
 75
 76static PyObject *
 77$abbrev$_lshift($abbrev$object *v, $abbrev$object *w)
 78{
 79	/* XXXX */
 80}
 81
 82static PyObject *
 83$abbrev$_rshift($abbrev$object *v, $abbrev$object *w)
 84{
 85	/* XXXX */
 86}
 87
 88static PyObject *
 89$abbrev$_and($abbrev$object *v, $abbrev$object *w)
 90{
 91	/* XXXX */
 92}
 93
 94static PyObject *
 95$abbrev$_xor($abbrev$object *v, $abbrev$object *w)
 96{
 97	/* XXXX */
 98}
 99
100static PyObject *
101$abbrev$_or($abbrev$object *v, $abbrev$object *w)
102{
103	/* XXXX */
104}
105
106static int
107$abbrev$_coerce(PyObject **pv, PyObject **pw)
108{
109	/* XXXX I haven't a clue... */
110	return 1;
111}
112
113static PyObject *
114$abbrev$_int($abbrev$object *v)
115{
116	/* XXXX */
117}
118
119static PyObject *
120$abbrev$_long($abbrev$object *v)
121{
122	/* XXXX */
123}
124
125static PyObject *
126$abbrev$_float($abbrev$object *v)
127{
128	/* XXXX */
129}
130
131static PyObject *
132$abbrev$_oct($abbrev$object *v)
133{
134	/* XXXX Return object as octal stringobject */
135}
136
137static PyObject *
138$abbrev$_hex($abbrev$object *v)
139{
140	/* XXXX Return object as hex stringobject */
141}
142
143static PyNumberMethods $abbrev$_as_number = {
144	(binaryfunc)$abbrev$_add,	/*nb_add*/
145	(binaryfunc)$abbrev$_sub,	/*nb_subtract*/
146	(binaryfunc)$abbrev$_mul,	/*nb_multiply*/
147	(binaryfunc)$abbrev$_div,	/*nb_divide*/
148	(binaryfunc)$abbrev$_mod,	/*nb_remainder*/
149	(binaryfunc)$abbrev$_divmod,	/*nb_divmod*/
150	(ternaryfunc)$abbrev$_pow,	/*nb_power*/
151	(unaryfunc)$abbrev$_neg,	/*nb_negative*/
152	(unaryfunc)$abbrev$_pos,	/*nb_positive*/
153	(unaryfunc)$abbrev$_abs,	/*nb_absolute*/
154	(inquiry)$abbrev$_nonzero,	/*nb_nonzero*/
155	(unaryfunc)$abbrev$_invert,	/*nb_invert*/
156	(binaryfunc)$abbrev$_lshift,	/*nb_lshift*/
157	(binaryfunc)$abbrev$_rshift,	/*nb_rshift*/
158	(binaryfunc)$abbrev$_and,	/*nb_and*/
159	(binaryfunc)$abbrev$_xor,	/*nb_xor*/
160	(binaryfunc)$abbrev$_or,	/*nb_or*/
161	(coercion)$abbrev$_coerce,	/*nb_coerce*/
162	(unaryfunc)$abbrev$_int,	/*nb_int*/
163	(unaryfunc)$abbrev$_long,	/*nb_long*/
164	(unaryfunc)$abbrev$_float,	/*nb_float*/
165	(unaryfunc)$abbrev$_oct,	/*nb_oct*/
166	(unaryfunc)$abbrev$_hex,	/*nb_hex*/
167};
168
169/* ------------------------------------------------------- */