1 | # pyOASIS - A Python wrapper for OASIS |
---|
2 | # Authors: Philippe Gambron, Rupert Ford |
---|
3 | # Copyright (C) 2019 UKRI - STFC |
---|
4 | |
---|
5 | # This program is free software: you can redistribute it and/or modify |
---|
6 | # it under the terms of the GNU Lesser General Public License as |
---|
7 | # published by the Free Software Foundation, either version 3 of the |
---|
8 | # License, or any later version. |
---|
9 | |
---|
10 | # This program is distributed in the hope that it will be useful, |
---|
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | # GNU Lesser General Public License for more details. |
---|
14 | |
---|
15 | # A copy of the GNU Lesser General Public License, version 3, is supplied |
---|
16 | # with this program, in the file lgpl-3.0.txt. It is also available at |
---|
17 | # <https://www.gnu.org/licenses/lgpl-3.0.html>. |
---|
18 | |
---|
19 | |
---|
20 | """System type methods""" |
---|
21 | |
---|
22 | import ctypes |
---|
23 | from ctypes import cdll, CDLL, c_int, c_char_p |
---|
24 | |
---|
25 | cdll.LoadLibrary("liboasis.cbind.so") |
---|
26 | LIB = CDLL("liboasis.cbind.so") |
---|
27 | |
---|
28 | |
---|
29 | LIB.oasis_c_abort.argtypes = [ctypes.c_int, c_char_p, c_char_p, c_char_p, c_int] |
---|
30 | LIB.oasis_c_abort.restype = ctypes.c_int |
---|
31 | |
---|
32 | def oasis_abort(comp_id, routine, message, filename, line): |
---|
33 | """OASIS abort method, publicly available to users""" |
---|
34 | kinfo = c_int(0) |
---|
35 | kinfo = LIB.oasis_c_abort(comp_id, routine.encode(), message.encode(), |
---|
36 | filename.encode(), line) |
---|
37 | return kinfo |
---|