summaryrefslogtreecommitdiffstats
path: root/pywrap
diff options
context:
space:
mode:
authorVasilii Chernov <vchernov@inr.ru>2016-03-03 15:38:32 +0100
committerVasilii Chernov <vchernov@inr.ru>2016-03-03 15:38:32 +0100
commitc79d43273769d88f7129a3d53c80b85a6dc1946c (patch)
tree0b8071b6261d74ef8bdf50a029525546250369ed /pywrap
parentee16e47966afe180d3c32e2b1d93301052894fac (diff)
downloadpcitool-c79d43273769d88f7129a3d53c80b85a6dc1946c.tar.gz
pcitool-c79d43273769d88f7129a3d53c80b85a6dc1946c.tar.bz2
pcitool-c79d43273769d88f7129a3d53c80b85a6dc1946c.tar.xz
pcitool-c79d43273769d88f7129a3d53c80b85a6dc1946c.zip
1. Pcipywrap: add persistent locking wrappings
2. html-server: - add scripts tab - change tab view to jQuery tabs
Diffstat (limited to 'pywrap')
-rw-r--r--pywrap/CMakeLists.txt1
-rw-r--r--pywrap/pcilib.py2
-rw-r--r--pywrap/pcipywrap.c43
-rw-r--r--pywrap/pcipywrap.h4
-rw-r--r--pywrap/pcipywrap.i3
5 files changed, 46 insertions, 7 deletions
diff --git a/pywrap/CMakeLists.txt b/pywrap/CMakeLists.txt
index 033298e..933d2ff 100644
--- a/pywrap/CMakeLists.txt
+++ b/pywrap/CMakeLists.txt
@@ -23,4 +23,5 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pcilib.py DESTINATION ${PYTHON_INSTALL
if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test_pcilib.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+ configure_file(pcilib.py pcilib.py)
endif(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
diff --git a/pywrap/pcilib.py b/pywrap/pcilib.py
index f4976bf..a72c79b 100644
--- a/pywrap/pcilib.py
+++ b/pywrap/pcilib.py
@@ -28,6 +28,8 @@ class pcilib(pcipywrap):
curr_script['name'] = script
if 'description' in dir(s.__scipts[script]):
curr_script['description'] = s.__scipts[script].description
+ if 'run' in dir(s.__scipts[script]):
+ curr_script['valid'] = True
scripts.append(curr_script)
return scripts
diff --git a/pywrap/pcipywrap.c b/pywrap/pcipywrap.c
index cb99ce2..7431604 100644
--- a/pywrap/pcipywrap.c
+++ b/pywrap/pcipywrap.c
@@ -552,10 +552,10 @@ void pcipywrap_unlock_global(pcipywrap *self)
return;
}
-PyObject* pcipywrap_lock(pcipywrap *self, const char *lock_id)
+PyObject* lock(pcipywrap *self, const char *lock_id, pcilib_lock_flags_t flags)
{
pcilib_lock_t* lock = pcilib_get_lock(self->ctx,
- PCILIB_LOCK_FLAG_PERSISTENT,
+ flags,
lock_id);
if(!lock)
{
@@ -574,10 +574,21 @@ PyObject* pcipywrap_lock(pcipywrap *self, const char *lock_id)
return PyLong_FromLong((long)1);
}
-PyObject* pcipywrap_try_lock(pcipywrap *self, const char *lock_id)
+PyObject* pcipywrap_lock(pcipywrap *self, const char *lock_id)
+{
+ return lock(self, lock_id, PCILIB_LOCK_FLAGS_DEFAULT);
+}
+
+PyObject* pcipywrap_lock_persistent(pcipywrap *self, const char *lock_id)
+{
+ return lock(self, lock_id, PCILIB_LOCK_FLAG_PERSISTENT);
+}
+
+
+PyObject* try_lock(pcipywrap *self, const char *lock_id, pcilib_lock_flags_t flags)
{
pcilib_lock_t* lock = pcilib_get_lock(self->ctx,
- PCILIB_LOCK_FLAG_PERSISTENT,
+ flags,
lock_id);
if(!lock)
{
@@ -595,10 +606,20 @@ PyObject* pcipywrap_try_lock(pcipywrap *self, const char *lock_id)
return PyLong_FromLong((long)1);
}
-PyObject* pcipywrap_unlock(pcipywrap *self, const char *lock_id)
+PyObject* pcipywrap_try_lock(pcipywrap *self, const char *lock_id)
+{
+ return try_lock(self, lock_id, PCILIB_LOCK_FLAGS_DEFAULT);
+}
+
+PyObject* pcipywrap_try_lock_persistent(pcipywrap *self, const char *lock_id)
+{
+ return try_lock(self, lock_id, PCILIB_LOCK_FLAG_PERSISTENT);
+}
+
+PyObject* unlock(pcipywrap *self, const char *lock_id, pcilib_lock_flags_t flags)
{
pcilib_lock_t* lock = pcilib_get_lock(self->ctx,
- PCILIB_LOCK_FLAG_PERSISTENT,
+ flags,
lock_id);
if(!lock)
{
@@ -610,4 +631,14 @@ PyObject* pcipywrap_unlock(pcipywrap *self, const char *lock_id)
return PyLong_FromLong((long)1);
}
+PyObject* pcipywrap_unlock(pcipywrap *self, const char *lock_id)
+{
+ return unlock(self, lock_id, PCILIB_LOCK_FLAGS_DEFAULT);
+}
+
+PyObject* pcipywrap_unlock_persistent(pcipywrap *self, const char *lock_id)
+{
+ return unlock(self, lock_id, PCILIB_LOCK_FLAG_PERSISTENT);
+}
+
diff --git a/pywrap/pcipywrap.h b/pywrap/pcipywrap.h
index 1b71a56..1992e07 100644
--- a/pywrap/pcipywrap.h
+++ b/pywrap/pcipywrap.h
@@ -79,8 +79,10 @@ void pcipywrap_unlock_global(pcipywrap *self);
* \return 1, serialized to PyObject or NULL with exeption text, if failed.
*/
PyObject* pcipywrap_lock(pcipywrap *self, const char *lock_id);
-
+PyObject* pcipywrap_lock_persistent(pcipywrap *self, const char *lock_id);
PyObject* pcipywrap_try_lock(pcipywrap *self, const char *lock_id);
+PyObject* pcipywrap_try_lock_persistent(pcipywrap *self, const char *lock_id);
PyObject* pcipywrap_unlock(pcipywrap *self, const char *lock_id);
+PyObject* pcipywrap_unlock_persistent(pcipywrap *self, const char *lock_id);
#endif /* PCIPYWRAP_H */
diff --git a/pywrap/pcipywrap.i b/pywrap/pcipywrap.i
index 5ee1bd1..b8f5bdb 100644
--- a/pywrap/pcipywrap.i
+++ b/pywrap/pcipywrap.i
@@ -27,7 +27,10 @@ typedef struct {
void unlock_global();
PyObject* lock(const char *lock_id);
+ PyObject* lock_persistent(const char *lock_id);
PyObject* try_lock(const char *lock_id);
+ PyObject* try_lock_persistent(const char *lock_id);
PyObject* unlock(const char *lock_id);
+ PyObject* unlock_persistent(const char *lock_id);
}
} pcipywrap;