PageRenderTime 68ms CodeModel.GetById 35ms RepoModel.GetById 0ms app.codeStats 1ms

/HTML/S/540.html

https://github.com/cocoatomo/Python3.2_C_API_Tutorial
HTML | 113 lines | 113 code | 0 blank | 0 comment | 0 complexity | 209172bbf226d32645e396edd2a8799a MD5 | raw file
  1. <html>
  2. <head>
  3. <title>Include/methodobject.h</title>
  4. <meta name='robots' content='noindex,nofollow'>
  5. <meta name='generator' content='GLOBAL-5.8.1'>
  6. </head>
  7. <body text='#191970' bgcolor='#f5f5dc' vlink='gray'>
  8. <a name='TOP'><h2><a href='../mains.html'>root</a>/<a href='../files/3349.html'>Include</a>/methodobject.h</h2>
  9. <i><font color='green'>/* [&lt;][&gt;]<a href='#L23'>[^]</a><a href='#L49'>[v]</a>[top]<a href='#BOTTOM'>[bottom]</a><a href='../mains.html'>[index]</a><a href='../help.html'>[help]</a> */</font></i>
  10. <hr>
  11. <h2><a href='570.html#L88' title='Included from 88 in Include/Python.h.'>INCLUDED FROM</a></h2>
  12. <hr>
  13. <h2>DEFINITIONS</h2>
  14. This source file includes following definitions.
  15. <ol>
  16. <li><a href='#L23' title='Defined at 23.'>PyAPI_FUNC</a>
  17. <li><a href='#L49' title='Defined at 49.'>PyAPI_FUNC</a>
  18. </ol>
  19. <hr>
  20. <pre>
  21. <a name='L1'>
  22. <a name='L2'><i><font color='green'>/* Method object interface */</font></i>
  23. <a name='L3'>
  24. <a name='L4'><font color='darkred'>#ifndef</font> <a href='../S/540.html#L5' title='Defined at 5 in Include/methodobject.h.'>Py_METHODOBJECT_H</a>
  25. <a name='L5'><font color='darkred'>#define</font> <a href='../S/540.html#L4' title='Refered from 4 in Include/methodobject.h.'>Py_METHODOBJECT_H</a>
  26. <a name='L6'><font color='darkred'>#ifdef</font> __cplusplus
  27. <a name='L7'><b>extern</b> "C" <font color='red'>{</font>
  28. <a name='L8'><font color='darkred'>#endif</font>
  29. <a name='L9'>
  30. <a name='L10'><i><font color='green'>/* This is about the type 'builtin_function_or_method',</font></i>
  31. <a name='L11'><i><font color='green'> not Python methods in user-defined classes. See classobject.h</font></i>
  32. <a name='L12'><i><font color='green'> for the latter. */</font></i>
  33. <a name='L13'>
  34. <a name='L14'><a href='../D/2715.html' title='Multiple defined in 8 places.'>PyAPI_DATA</a>(PyTypeObject) PyCFunction_Type;
  35. <a name='L15'>
  36. <a name='L16'><font color='darkred'>#define</font> PyCFunction_Check(op) (Py_TYPE(op) == &amp;PyCFunction_Type)
  37. <a name='L17'>
  38. <a name='L18'><b>typedef</b> <a href='../D/3593.html' title='Multiple defined in 2 places.'>PyObject</a> *(*PyCFunction)(PyObject *, PyObject *);
  39. <a name='L19'><b>typedef</b> <a href='../D/3593.html' title='Multiple defined in 2 places.'>PyObject</a> *(*PyCFunctionWithKeywords)(PyObject *, PyObject *,
  40. <a name='L20'> PyObject *);
  41. <a name='L21'><b>typedef</b> <a href='../D/3593.html' title='Multiple defined in 2 places.'>PyObject</a> *(*PyNoArgsFunction)(PyObject *);
  42. <a name='L22'>
  43. <a name='L23'><a href='../R/2475.html' title='Multiple refered from 87 places.'>PyAPI_FUNC</a>(PyCFunction) PyCFunction_GetFunction(PyObject *);
  44. <a name='L24'>PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *);
  45. <a name='L25'>PyAPI_FUNC(<b>int</b>) PyCFunction_GetFlags(PyObject *);
  46. <a name='L26'>
  47. <a name='L27'><i><font color='green'>/* Macros for direct access to these values. Type checks are *not*</font></i>
  48. <a name='L28'><i><font color='green'> done, so use with care. */</font></i>
  49. <a name='L29'><font color='darkred'>#ifndef</font> Py_LIMITED_API
  50. <a name='L30'><font color='darkred'>#define</font> PyCFunction_GET_FUNCTION(func) \
  51. <a name='L31'> (((PyCFunctionObject *)func) -&gt; m_ml -&gt; ml_meth)
  52. <a name='L32'><font color='darkred'>#define</font> PyCFunction_GET_SELF(func) \
  53. <a name='L33'> (((PyCFunctionObject *)func) -&gt; m_self)
  54. <a name='L34'><font color='darkred'>#define</font> PyCFunction_GET_FLAGS(func) \
  55. <a name='L35'> (((PyCFunctionObject *)func) -&gt; m_ml -&gt; ml_flags)
  56. <a name='L36'><font color='darkred'>#endif</font>
  57. <a name='L37'>PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *);
  58. <a name='L38'>
  59. <a name='L39'><b>struct</b> PyMethodDef <font color='red'>{</font>
  60. <a name='L40'> <b>const</b> <b>char</b> *ml_name; <i><font color='green'>/* The name of the built-in function/method */</font></i>
  61. <a name='L41'> PyCFunction ml_meth; <i><font color='green'>/* The C function that implements it */</font></i>
  62. <a name='L42'> <b>int</b> ml_flags; <i><font color='green'>/* Combination of METH_xxx flags, which mostly</font></i>
  63. <a name='L43'><i><font color='green'> describe the args expected by the C func */</font></i>
  64. <a name='L44'> <b>const</b> <b>char</b> *ml_doc; <i><font color='green'>/* The __doc__ attribute, or NULL */</font></i>
  65. <a name='L45'><font color='red'>}</font>;
  66. <a name='L46'><b>typedef</b> <b>struct</b> <a href='../D/3525.html' title='Multiple defined in 3 places.'>PyMethodDef</a> <a href='../R/3180.html' title='Multiple refered from 255 places.'>PyMethodDef</a>;
  67. <a name='L47'>
  68. <a name='L48'><font color='darkred'>#define</font> <a href='../R/2605.html' title='Multiple refered from 13 places.'>PyCFunction_New</a>(ML, SELF) <a href='../S/2801.html#L17' title='Defined at 17 in Objects/methodobject.c.'>PyCFunction_NewEx</a>((ML), (SELF), <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a>)
  69. <a name='L49'><a href='../R/2475.html' title='Multiple refered from 87 places.'>PyAPI_FUNC</a>(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
  70. <a name='L50'> PyObject *);
  71. <a name='L51'>
  72. <a name='L52'><i><font color='green'>/* Flag passed to newmethodobject */</font></i>
  73. <a name='L53'><i><font color='green'>/* #define METH_OLDARGS 0x0000 -- unsupported now */</font></i>
  74. <a name='L54'><font color='darkred'>#define</font> <a href='../S/2858.html#L633' title='Defined at 633 in PC/bdist_wininst/install.c.'>METH_VARARGS</a> 0x0001
  75. <a name='L55'><font color='darkred'>#define</font> METH_KEYWORDS 0x0002
  76. <a name='L56'><i><font color='green'>/* METH_NOARGS and METH_O must not be combined with the flags above. */</font></i>
  77. <a name='L57'><font color='darkred'>#define</font> <a href='../S/2858.html#L634' title='Defined at 634 in PC/bdist_wininst/install.c.'>METH_NOARGS</a> 0x0004
  78. <a name='L58'><font color='darkred'>#define</font> METH_O 0x0008
  79. <a name='L59'>
  80. <a name='L60'><i><font color='green'>/* METH_CLASS and METH_STATIC are a little different; these control</font></i>
  81. <a name='L61'><i><font color='green'> the construction of methods for a class. These cannot be used for</font></i>
  82. <a name='L62'><i><font color='green'> functions in modules. */</font></i>
  83. <a name='L63'><font color='darkred'>#define</font> METH_CLASS 0x0010
  84. <a name='L64'><font color='darkred'>#define</font> METH_STATIC 0x0020
  85. <a name='L65'>
  86. <a name='L66'><i><font color='green'>/* METH_COEXIST allows a method to be entered even though a slot has</font></i>
  87. <a name='L67'><i><font color='green'> already filled the entry. When defined, the flag allows a separate</font></i>
  88. <a name='L68'><i><font color='green'> method, "__contains__" for example, to coexist with a defined </font></i>
  89. <a name='L69'><i><font color='green'> slot like sq_contains. */</font></i>
  90. <a name='L70'>
  91. <a name='L71'><font color='darkred'>#define</font> METH_COEXIST 0x0040
  92. <a name='L72'>
  93. <a name='L73'><font color='darkred'>#ifndef</font> Py_LIMITED_API
  94. <a name='L74'><b>typedef</b> <b>struct</b> <font color='red'>{</font>
  95. <a name='L75'> <a href='../S/544.html#L82' title='Defined at 82 in Include/object.h.'>PyObject_HEAD</a>
  96. <a name='L76'> <a href='../D/3525.html' title='Multiple defined in 3 places.'>PyMethodDef</a> *m_ml; <i><font color='green'>/* Description of the C function to call */</font></i>
  97. <a name='L77'> <a href='../D/3593.html' title='Multiple defined in 2 places.'>PyObject</a> *m_self; <i><font color='green'>/* Passed as 'self' arg to the C func, can be NULL */</font></i>
  98. <a name='L78'> <a href='../D/3593.html' title='Multiple defined in 2 places.'>PyObject</a> *m_module; <i><font color='green'>/* The __module__ attribute, can be anything */</font></i>
  99. <a name='L79'><font color='red'>}</font> PyCFunctionObject;
  100. <a name='L80'><font color='darkred'>#endif</font>
  101. <a name='L81'>
  102. <a name='L82'><a href='../D/2716.html' title='Multiple defined in 45 places.'>PyAPI_FUNC</a>(<b>int</b>) PyCFunction_ClearFreeList(<b>void</b>);
  103. <a name='L83'>
  104. <a name='L84'><font color='darkred'>#ifdef</font> __cplusplus
  105. <a name='L85'><font color='red'>}</font>
  106. <a name='L86'><font color='darkred'>#endif</font>
  107. <a name='L87'><font color='darkred'>#endif</font> <i><font color='green'>/* !Py_METHODOBJECT_H */</font></i>
  108. </pre>
  109. <hr>
  110. <a name='BOTTOM'>
  111. <i><font color='green'>/* [&lt;][&gt;]<a href='#L23'>[^]</a><a href='#L49'>[v]</a><a href='#TOP'>[top]</a>[bottom]<a href='../mains.html'>[index]</a><a href='../help.html'>[help]</a> */</font></i>
  112. </body>
  113. </html>