diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /cvs/cvsweb.cgi/code/nelns/agent_service/Attic/py_object_trans.cpp?rev=1.1&content-type=text | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to 'cvs/cvsweb.cgi/code/nelns/agent_service/Attic/py_object_trans.cpp?rev=1.1&content-type=text')
-rw-r--r-- | 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 | 145 |
1 files changed, 145 insertions, 0 deletions
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 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML> +<HEAD><style> A { color:black }</style> +<!-- hennerik CVSweb $Revision: 1.93 $ --> +<TITLE>code/nelns/agent_service/py_object_trans.cpp - view - 1.1</TITLE></HEAD> +<BODY BGCOLOR="#eeeeee"> +<table width="100%" border=0 cellspacing=0 cellpadding=1 bgcolor="#aaaaaa"><tr valign=bottom><td><a href="py_object_trans.cpp?hideattic=0"><IMG SRC="http://www.nevrax.org/inc/img/picto-up.gif" ALT="[BACK]" BORDER="0" WIDTH="14" HEIGHT="13"></a> <b>Return to <A HREF="py_object_trans.cpp?hideattic=0">py_object_trans.cpp</A> + CVS log</b> <IMG SRC="http://www.nevrax.org/inc/img/picto-news.gif" ALT="[TXT]" BORDER="0" WIDTH="13" HEIGHT="15"></td><td align=right><IMG SRC="http://www.nevrax.org/inc/img/picto-dir.gif" ALT="[DIR]" BORDER="0" WIDTH="15" HEIGHT="13"> <b>Up to <a href="/cvs/cvsweb.cgi/?hideattic=0">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/?hideattic=0">code</a> / <a href="/cvs/cvsweb.cgi/code/nelns/?hideattic=0">nelns</a> / <a href="/cvs/cvsweb.cgi/code/nelns/agent_service/?hideattic=0">agent_service</a></b></td></tr></table><HR noshade><table width="100%"><tr><td bgcolor="#ffffff">File: <a href="/cvs/cvsweb.cgi/?hideattic=0">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/?hideattic=0">code</a> / <a href="/cvs/cvsweb.cgi/code/nelns/?hideattic=0">nelns</a> / <a href="/cvs/cvsweb.cgi/code/nelns/agent_service/?hideattic=0">agent_service</a> / <a href="/cvs/cvsweb.cgi/code/nelns/agent_service/Attic/?hideattic=0">Attic</a> / <a href="/cvs/cvsweb.cgi/code/nelns/agent_service/Attic/py_object_trans.cpp?hideattic=0">py_object_trans.cpp</a> (<A HREF="/cvs/cvsweb.cgi/~checkout~/code/nelns/agent_service/Attic/py_object_trans.cpp?rev=1.1&hideattic=0" target="cvs_checkout" onClick="window.open('/cvs/cvsweb.cgi/~checkout~/code/nelns/agent_service/Attic/py_object_trans.cpp?rev=1.1','cvs_checkout','resizeable,scrollbars');"><b>download</b></A>)<BR> +Revision <B>1.1</B>, <i>Wed Apr 18 13:54:25 2001 UTC</i> (15 months, 1 week ago) by <i>valignat</i> +<BR>Branch: <b>MAIN</b> +<PRE> +RENAMED code/server to code/nelns. +</PRE> +</td></tr></table><HR noshade><PRE>#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); + } +} +</PRE>
\ No newline at end of file |