/Tools/modulator/Templates/object_tp_as_sequence

http://unladen-swallow.googlecode.com/ · #! · 58 lines · 48 code · 10 blank · 0 comment · 0 complexity · 900a179388ec208afc3b316e75a4181b MD5 · raw file

  1. /* Code to handle accessing $name$ objects as sequence objects */
  2. static int
  3. $abbrev$_length($abbrev$object *self)
  4. {
  5. /* XXXX Return the size of the object */
  6. }
  7. static PyObject *
  8. $abbrev$_concat($abbrev$object *self, PyObject *bb)
  9. {
  10. /* XXXX Return the concatenation of self and bb */
  11. }
  12. static PyObject *
  13. $abbrev$_repeat($abbrev$object *self, int n)
  14. {
  15. /* XXXX Return a new object that is n times self */
  16. }
  17. static PyObject *
  18. $abbrev$_item($abbrev$object *self, int i)
  19. {
  20. /* XXXX Return the i-th object of self */
  21. }
  22. static PyObject *
  23. $abbrev$_slice($abbrev$object *self, int ilow, int ihigh)
  24. {
  25. /* XXXX Return the ilow..ihigh slice of self in a new object */
  26. }
  27. static int
  28. $abbrev$_ass_item($abbrev$object *self, int i, PyObject *v)
  29. {
  30. /* XXXX Assign to the i-th element of self */
  31. return 0;
  32. }
  33. static int
  34. $abbrev$_ass_slice(PyListObject *self, int ilow, int ihigh, PyObject *v)
  35. {
  36. /* XXXX Replace ilow..ihigh slice of self with v */
  37. return 0;
  38. }
  39. static PySequenceMethods $abbrev$_as_sequence = {
  40. (inquiry)$abbrev$_length, /*sq_length*/
  41. (binaryfunc)$abbrev$_concat, /*sq_concat*/
  42. (intargfunc)$abbrev$_repeat, /*sq_repeat*/
  43. (intargfunc)$abbrev$_item, /*sq_item*/
  44. (intintargfunc)$abbrev$_slice, /*sq_slice*/
  45. (intobjargproc)$abbrev$_ass_item, /*sq_ass_item*/
  46. (intintobjargproc)$abbrev$_ass_slice, /*sq_ass_slice*/
  47. };
  48. /* -------------------------------------------------------------- */