1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
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="/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="/inc/img/picto-news.gif" ALT="[TXT]" BORDER="0" WIDTH="13" HEIGHT="15"></td><td align=right><IMG SRC="/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>
|