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