1 /**
2   Mirror _moduleobject.h
3 
4   Module object interface
5   */
6 module deimos.python.moduleobject;
7 
8 import deimos.python.pyport;
9 import deimos.python.object;
10 import deimos.python.methodobject;
11 
12 extern(C):
13 // Python-header-file: Include/moduleobject.h:
14 
15 /// _
16 mixin(PyAPI_DATA!"PyTypeObject PyModule_Type");
17 
18 // D translation of C macro:
19 /// _
20 int PyModule_Check()(PyObject *op) {
21     return PyObject_TypeCheck(op, &PyModule_Type);
22 }
23 // D translation of C macro:
24 /// _
25 int PyModule_CheckExact()(PyObject *op) {
26     return Py_TYPE(op) == &PyModule_Type;
27 }
28 
29 /// _
30 PyObject* PyModule_New(const(char)*);
31 /// _
32 PyObject_BorrowedRef* PyModule_GetDict(PyObject*);
33 /// _
34 const(char)* PyModule_GetName(PyObject*);
35 /// _
36 const(char)* PyModule_GetFilename(PyObject*);
37 version(Python_3_0_Or_Later) {
38     /// Availability: 3.*
39     PyObject* PyModule_GetFilenameObject(PyObject*);
40 }
41 /// _
42 void _PyModule_Clear(PyObject*);
43 
44 version(Python_3_0_Or_Later) {
45     /// Availability: 3.*
46     PyModuleDef* PyModule_GetDef(PyObject*);
47     /// Availability: 3.*
48     void* PyModule_GetState(PyObject*);
49 
50     /// subclass of PyObject
51     /// Availability: 3.*
52     struct PyModuleDef_Base {
53         mixin PyObject_HEAD;
54         /// _
55         PyObject* function() m_init;
56         /// _
57         Py_ssize_t m_index;
58         /// _
59         PyObject* m_copy;
60     }
61 
62     version(Python_3_5_Or_Later) {
63         struct PyModuleDef_Slot {
64             int slot;
65             void* value;
66         }
67 
68         enum Py_mod_create = 1;
69         enum Py_mod_exec = 2;
70     }
71 
72     /// Availability: 3.*
73     struct PyModuleDef{
74         /// _
75         PyModuleDef_Base m_base;
76         /// _
77         const(char)* m_name;
78         /// _
79         const(char)* m_doc;
80         /// _
81         Py_ssize_t m_size;
82         /// _
83         PyMethodDef* m_methods;
84         version(Python_3_5_Or_Later) {
85             /// _
86             PyModuleDef_Slot* m_slots;
87         }else{
88             /// _
89             inquiry m_reload;
90         }
91         /// _
92         traverseproc m_traverse;
93         /// _
94         inquiry m_clear;
95         /// _
96         freefunc m_free;
97     }
98 }