From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- .../x-cvsweb-markup&hideattic=0/index.html | 145 +++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 cvs/cvsweb.cgi/code/nelns/agent_service/Attic/py_object_trans.cpp?rev=1.1&content-type=text/x-cvsweb-markup&hideattic=0/index.html (limited to 'cvs/cvsweb.cgi/code/nelns/agent_service/Attic/py_object_trans.cpp?rev=1.1&content-type=text') diff --git a/cvs/cvsweb.cgi/code/nelns/agent_service/Attic/py_object_trans.cpp?rev=1.1&content-type=text/x-cvsweb-markup&hideattic=0/index.html b/cvs/cvsweb.cgi/code/nelns/agent_service/Attic/py_object_trans.cpp?rev=1.1&content-type=text/x-cvsweb-markup&hideattic=0/index.html new file mode 100644 index 00000000..306918b9 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nelns/agent_service/Attic/py_object_trans.cpp?rev=1.1&content-type=text/x-cvsweb-markup&hideattic=0/index.html @@ -0,0 +1,145 @@ + + + +code/nelns/agent_service/py_object_trans.cpp - view - 1.1 + +
[BACK] Return to py_object_trans.cpp + CVS log [TXT][DIR] Up to Nevrax / code / nelns / agent_service

File: Nevrax / code / nelns / agent_service / Attic / py_object_trans.cpp (download)
+Revision 1.1, Wed Apr 18 13:54:25 2001 UTC (15 months, 1 week ago) by valignat +
Branch: MAIN +
+RENAMED code/server to code/nelns.
+
+

#include "py_object_trans.h"
+//#include "ag_compile.h"
+
+
+namespace SRV
+{
+        static PyObject *commandSell(pyCPyEditWin *self, PyObject *arg)
+        {
+                char *txt;
+                PyObject *argi;
+                argi = PyTuple_GetItem (arg, 0);
+                PyArg_Parse(argi,"s",&txt);
+                txt[strlen(txt)] = 0;
+                char command[1024*16];
+#ifdef NL_DEBUG
+                memset(command,0,sizeof(command));
+#endif
+                int i = 0,j = 0;
+
+                while(txt[i] != 0)
+                {
+                        if(txt[i] != '\n')
+                        {
+                                command[j] = txt[i];
+                                j ++;
+                        }
+                        else
+                        {
+                                command[j] = 0;
+                                self->Instance->commandSell(command);
+                                j = 0;                                
+                        }
+                        i ++;                        
+                }                                        
+                if(j)
+                {
+                        command[j] = 0;
+                        self->Instance->commandSell(command);                                
+                }
+                return Py_BuildValue("i",false);
+        }
+
+        static PyObject *coord(pyCPyEditWin *self, PyObject *arg)
+        {
+                char *txt;
+                PyObject *argi;
+                argi = PyTuple_GetItem (arg, 0);
+                PyArg_Parse(argi,"s",&txt);
+                //txt[strlen(txt)] = 0;
+                char num[1024];                
+#ifdef NL_DEBUG
+                memset(num,0,sizeof(num));                
+#endif
+                int i = 0,j = 0;
+                int x = -1,y = -1;
+                while(txt[i] != 0)
+                {
+                        if(txt[i] == '.')
+                        {
+                                num[j] = 0;
+                                x = atoi(num);
+                                j = 0;
+                                i++;
+                                break;
+                        }
+                        else
+                        {
+                                num[j ++] = txt[i];
+                        }
+                        i ++;
+                }                        
+
+                while(1)
+                {
+                        if(txt[i] == 0)
+                        {
+                                num[j] = 0;
+                                y = atoi(num);
+                                break;
+                        }
+                        else
+                        {
+                                num[j ++] = txt[i];
+                        }
+                        i ++;
+                }                        
+                return Py_BuildValue("ii",x,y);
+        }
+
+        static PyMethodDef V_methods[] = 
+        {        
+                {"commandSell", (PyCFunction) commandSell,         1, NULL},
+                {"coord", (PyCFunction) coord,         1, NULL},
+                {NULL,                NULL}                /* sentinel */
+        };
+        
+        static PyObject *getAttribDigitalType(pyCPyEditWin *self,char *name)
+        {        
+                return Py_FindMethod(V_methods, (PyObject *)self, name);
+        }
+
+        static void dealloc(pyCPyEditWin *self)
+        {        
+                delete self;
+        }
+
+        staticforward PyTypeObject V_Type = 
+        {
+                PyObject_HEAD_INIT(&PyType_Type)
+                0,                                        /*ob_size*/
+                "Shell",                        /*tp_name*/
+                sizeof(pyCPyEditWin),        /*tp_basicsize*/
+                0,                        /*tp_itemsize*/
+                /* methods */
+                (destructor)dealloc, /*tp_dealloc*/
+                0,                        /*tp_print*/
+                (getattrfunc)getAttribDigitalType, /*tp_getattr*/
+                0,
+        /*        (setattrfunc)VConnection_setattr,*/ /*tp_setattr*/
+                0,                        /*tp_compare*/
+                0,                        /*tp_repr*/
+                0,                        /*tp_as_number*/
+                0,                        /*tp_as_sequence*/
+                0,                        /*tp_as_mapping*/
+                0,                        /*tp_hash*/
+        };        
+
+        pyCPyEditWin *allocPyEditWin(CPyEditWin *classType)
+        {
+                return NLAIC::CreatePyObjectInstance<CPyEditWin>(classType,&V_Type);
+        }
+}
+
\ No newline at end of file -- cgit v1.2.1