Sparse Virtual File System  0.4.0
A Sparse Virtual File System.
cSVFS.cpp
Go to the documentation of this file.
1 
30 #include "cpp_svfs.h"
31 
32 #include "_cSVF.cpp"
33 #include "_cSVFS.cpp"
34 
35 // Module initialisation
36 #pragma mark Module initialisation
37 
38 static PyModuleDef svfsmodule = {
39  PyModuleDef_HEAD_INIT,
40  .m_name = "svfsc",
41  .m_doc = \
42  "This module contains Sparse Virtual File System classes."
43  "\n"
44  "A Sparse Virtual File (SVF) is one where data from the actual file is held in memory at the relevant"
45  " file locations as in the original file."
46  " The original file is identified by a string ID."
47  " Data can be written to an SVF, if the data differs from that existing an error might be raised."
48  " Data can be read from an SVF, if the SVF does not have the data an error will be raised."
49  " Before any ``read()`` the SVF can describe what, if any, data is missing and the user can obtain and write that"
50  " data to the SVF before reading."
51  "\n\n"
52  "A Sparse Virtual File System (SVFS) is an extension of that concept where a file ID (string) is the key to the"
53  " appropriate SVF.",
54  .m_size = -1,
55 };
56 
57 PyMODINIT_FUNC
59 {
60  PyObject *m = NULL;
61 
62  m = PyModule_Create(&svfsmodule);
63  if (m == NULL) {
64  return NULL;
65  }
66  if (PyModule_AddStringConstant(m, "SVFS_CPP_VERSION", SVFS_CPP_VERSION)) {
67  return NULL;
68  }
69  if (PyModule_AddIntConstant(m, "SVFS_CPP_VERSION_MAJOR", SVFS_CPP_VERSION_MAJOR)) {
70  return NULL;
71  }
72  if (PyModule_AddIntConstant(m, "SVFS_CPP_VERSION_MINOR", SVFS_CPP_VERSION_MINOR)) {
73  return NULL;
74  }
75  if (PyModule_AddIntConstant(m, "SVFS_CPP_VERSION_PATCH", SVFS_CPP_VERSION_PATCH)) {
76  return NULL;
77  }
78  if (PyModule_AddStringConstant(m, "SVFS_CPP_VERSION_SUFFIX", SVFS_CPP_VERSION_SUFFIX)) {
79  return NULL;
80  }
81  if (PyModule_AddIntConstant(m, "SVF_THREAD_SAFE",
82 #ifdef SVF_THREAD_SAFE
83  SVF_THREAD_SAFE
84 #else
85  0
86 #endif
87  )) {
88  return NULL;
89  }
90  if (PyModule_AddIntConstant(m, "SVFS_THREAD_SAFE",
91 #ifdef SVFS_THREAD_SAFE
92  SVFS_THREAD_SAFE
93 #else
94  0
95 #endif
96  )) {
97  return NULL;
98  }
99  if (PyModule_AddIntConstant(m, "PY_THREAD_SAFE",
100 #ifdef PY_THREAD_SAFE
101  1
102 #else
103  0
104 #endif
105  )) {
106  return NULL;
107  }
108 
109  if (PyType_Ready(&svfsc_cSVF) < 0) {
110  return NULL;
111  }
112  Py_INCREF(&svfsc_cSVF);
113  PyModule_AddObject(m, "cSVF", (PyObject *) &svfsc_cSVF);
114 
115  if (PyType_Ready(&svfsc_cSVFS) < 0) {
116  return NULL;
117  }
118  Py_INCREF(&svfsc_cSVF);
119  PyModule_AddObject(m, "cSVFS", (PyObject *) &svfsc_cSVFS);
120 
121 
122  PyDateTime_IMPORT;
123  return m;
124 }
125 
126 // END: Module initialisation
127 #pragma mark END: Module initialisation
static PyTypeObject svfsc_cSVF
Definition: _cSVF.cpp:1521
static PyTypeObject svfsc_cSVFS
Definition: _cSVFS.cpp:1598
static PyModuleDef svfsmodule
Definition: cSVFS.cpp:38
PyMODINIT_FUNC PyInit_svfsc(void)
Definition: cSVFS.cpp:58
const char * SVFS_CPP_VERSION_SUFFIX
Version suffix string, could be "rc2" for example.
Definition: cpp_svfs.cpp:44
int SVFS_CPP_VERSION_PATCH
Patch version number.
Definition: cpp_svfs.cpp:42
int SVFS_CPP_VERSION_MINOR
Minor version number.
Definition: cpp_svfs.cpp:40
int SVFS_CPP_VERSION_MAJOR
Major version number.
Definition: cpp_svfs.cpp:38
const char * SVFS_CPP_VERSION
The version as a string.
Definition: cpp_svfs.cpp:35