Start SPHLite 0.2.1 hardening
This commit is contained in:
@@ -33,6 +33,13 @@ class SPHLite:
|
||||
self.lib.sphlite_initialize.restype = ctypes.c_int
|
||||
self.lib.sphlite_finalize.restype = ctypes.c_int
|
||||
|
||||
self.lib.sphlite_get_version.argtypes = [
|
||||
ctypes.POINTER(ctypes.c_int),
|
||||
ctypes.POINTER(ctypes.c_int),
|
||||
ctypes.POINTER(ctypes.c_int),
|
||||
]
|
||||
self.lib.sphlite_get_version.restype = ctypes.c_int
|
||||
|
||||
self.lib.sphlite_read_inp.argtypes = [ctypes.c_char_p]
|
||||
self.lib.sphlite_read_inp.restype = ctypes.c_int
|
||||
|
||||
@@ -118,6 +125,17 @@ class SPHLite:
|
||||
def finalize(self) -> None:
|
||||
self._check(self.lib.sphlite_finalize())
|
||||
|
||||
def version(self) -> tuple[int, int, int]:
|
||||
major = ctypes.c_int(0)
|
||||
minor = ctypes.c_int(0)
|
||||
patch = ctypes.c_int(0)
|
||||
self._check(self.lib.sphlite_get_version(
|
||||
ctypes.byref(major),
|
||||
ctypes.byref(minor),
|
||||
ctypes.byref(patch),
|
||||
))
|
||||
return int(major.value), int(minor.value), int(patch.value)
|
||||
|
||||
def read_inp(self, filename: str | Path) -> None:
|
||||
encoded = str(Path(filename)).encode("utf-8")
|
||||
self._check(self.lib.sphlite_read_inp(encoded))
|
||||
|
||||
Reference in New Issue
Block a user