summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/luapraxisd.cc14
-rw-r--r--server/src/luapraxisd.h90
2 files changed, 97 insertions, 7 deletions
diff --git a/server/src/luapraxisd.cc b/server/src/luapraxisd.cc
index b50446c..bdaf372 100644
--- a/server/src/luapraxisd.cc
+++ b/server/src/luapraxisd.cc
@@ -44,7 +44,7 @@ typedef struct px_userdata {
Praxisd *px;
} px_userdata;
-static int px_addcave(lua_State *L)
+int px_addcave(lua_State *L)
{
px_userdata *pxu;
pxu = (px_userdata *)luaL_checkudata(L, 1, "Praxisd");
@@ -80,7 +80,7 @@ static int px_addcave(lua_State *L)
return 0;
}
-static int px_addbehandling(lua_State *L)
+int px_addbehandling(lua_State *L)
{
px_userdata *pxu;
pxu = (px_userdata *)luaL_checkudata(L, 1, "Praxisd");
@@ -112,7 +112,7 @@ static int px_addbehandling(lua_State *L)
return 0;
}
-static int px_adddiagnose(lua_State *L)
+int px_adddiagnose(lua_State *L)
{
px_userdata *pxu;
pxu = (px_userdata *)luaL_checkudata(L, 1, "Praxisd");
@@ -144,7 +144,7 @@ static int px_adddiagnose(lua_State *L)
return 0;
}
-static int px_getcave(lua_State *L)
+int px_getcave(lua_State *L)
{
px_userdata *pxu;
pxu = (px_userdata *)luaL_checkudata(L, 1, "Praxisd");
@@ -185,7 +185,7 @@ static int px_getcave(lua_State *L)
return 1;
}
-static int px_cavelist(lua_State *L)
+int px_cavelist(lua_State *L)
{
px_userdata *pxu;
pxu = (px_userdata *)luaL_checkudata(L, 1, "Praxisd");
@@ -211,7 +211,7 @@ static int px_cavelist(lua_State *L)
return 1;
}
-static int px_new(lua_State *L)
+int px_new(lua_State *L)
{
const char *host = luaL_checkstring(L, 1);
int port = (int)luaL_checknumber(L, 2);
@@ -244,7 +244,7 @@ static int px_gc(lua_State *L)
}
static const struct luaL_Reg px_meths[] = {
- {"__gc" ,px_gc},
+ {"__gc", px_gc},
{"cavelist", px_cavelist},
{"getcave", px_getcave},
{"addcave", px_addcave},
diff --git a/server/src/luapraxisd.h b/server/src/luapraxisd.h
index 2ab9ab5..71225bf 100644
--- a/server/src/luapraxisd.h
+++ b/server/src/luapraxisd.h
@@ -30,6 +30,96 @@
#include <lua.hpp>
+/***
+ * Praxisd Class
+ * @class Praxisd
+ * @serverside
+ * The praxisd class connects and handles communication with the praxisd
+ * daemon process.
+ */
+
+/***
+ * @method object Praxisd.new(string host, int port)
+ * Create a new Praxisd connection object.
+ * @param host The hostname to connect to.
+ * @param port The port number to connect to.
+ * @return The newly created communication object.
+ * @example Create a new praxisd object:
+ * px = Praxisd.new('localhost', 10000)
+ */
+int px_new(lua_State *L);
+
+/***
+ * @method stringlist praxisd:cavelist()
+ * Get server cave list.
+ * To retrieve cavelist for a patient see @see praxisd:getcave().
+ * @return The complete list of known (possible) cave from the server.
+ * @example Create a new praxisd object, get and print cavelist:
+ * px = Praxisd.new('localhost', 10000)
+ * lst = px:cavelist()
+ * for i=0,#lst do
+ * print(lst[i])
+ * end
+ */
+int px_cavelist(lua_State *L);
+
+/***
+ * @method stringlist praxisd:getcave(string patientid)
+ * Get cave list from a patient.
+ * To retrieve cavelist from the server see @see praxisd:cavelist(). To add cave
+ * to a patient see @see praxisd:addcave().
+ * @param patientid A string containing the patientid.
+ * @return The list cave registered with the patient.
+ * @example Create a new praxisd object, get and print cavelist:
+ * px = Praxisd.new('localhost', 10000)
+ * lst = px:getcave('1234567890')
+ * for i=0,#lst do
+ * print(lst[i])
+ * end
+ */
+int px_getcave(lua_State *L);
+
+/***
+ * @method nil praxisd:adddiagnose(string patientid, string diagnose, string text)
+ * Add a diagnose to a patient.
+ * @param patientid A string containing the patientid.
+ * @param diagnose The diagnose code.
+ * @param text A text to store with the diagnose code. The string mat be up to 6
+ * characters long. If longer it will be trunkated.
+ * @example Create a new praxisd object and add a diagnose:
+ * px = Praxisd.new('localhost', 10000)
+ * px:adddiagnose('1234567890', 'C0001', 'o.dxt')
+ */
+int px_adddiagnose(lua_State *L);
+
+/***
+ * @method nil praxisd:addbehandling(string patientid, string behandling, string text)
+ * Add a behandling to a patient.
+ * @param patientid A string containing the patientid.
+ * @param diagnose The behandling code.
+ * @param text A text to store with the behandling code. The string mat be up to 6
+ * characters long. If longer it will be trunkated.
+ * @example Create a new praxisd object and add a behandling:
+ * px = Praxisd.new('localhost', 10000)
+ * px:addbehandling('1234567890', 'B0001', 'o.sin')
+ */
+int px_addbehandling(lua_State *L);
+
+/***
+ * @method nil praxisd:addcave(string patientid, string cave, string text)
+ * Add a cave entry to a patient. To retrieve list of cave from a patient
+ * see @see praxisd:getcave().
+ * @param patientid A string containing the patientid.
+ * @param diagnose The cave string.
+ * @param text A text to store with the cave entry. NOTE: This is not shown in
+ * PCPraxis! The string mat be up to 6 characters long. If longer it will be
+ * trunkated.
+ * @example Create a new praxisd object and add a cave entry:
+ * px = Praxisd.new('localhost', 10000)
+ * px:addcave('1234567890', 'AZOPT', '')
+ */
+int px_addcave(lua_State *L);
+
void register_praxisd(lua_State *L);
#endif/*__PRACRO_LUAPRAXISD_H__*/